Gen: Re-run script
- commit
- eae1610c7d83f854f1f5ca132ae5392905192913
- author
- Jeroen Wijenbergh · · 2025-10-22 07:52 UTC
- parent
- 048deed
- signature
- SSH Unverified
SHA256:8N5EoON8reSTMm461SyWlzRhib6IymBjUHb1p62kwywThe key is unknown
113 files · +4663 -3979
this diff holds invisible characters (direction controls, zero-width characters). They are shown as <U+XXXX> markers, never applied.
M v4/adw/adw-application.go +18 -0
| @@ -36,6 +36,15 @@ func (x *ApplicationClass) GoPointer() uintptr { | |||
| 36 | 36 | // | |
| 37 | 37 | // ## Automatic Resources | |
| 38 | 38 | // | |
| 39 | + | // ### Shortcuts Dialog | |
| 40 | + | // | |
| 41 | + | // If there's a resource located at `shortcuts-dialog.ui` which defines an | |
| 42 | + | // [class@ShortcutsDialog] with the ID `shortcuts_dialog`, `AdwApplication` | |
| 43 | + | // will set up an `app.shortcuts` action that creates and presents this dialog, | |
| 44 | + | // as well as a <kbd>Ctrl</kbd><kbd>?</kbd> accelerator for it. | |
| 45 | + | // | |
| 46 | + | // ### Stylesheet | |
| 47 | + | // | |
| 39 | 48 | // `AdwApplication` will automatically load stylesheets located in the | |
| 40 | 49 | // application's resource base path (see | |
| 41 | 50 | // [method@Gio.Application.set_resource_base_path], if they're present. | |
| @@ -52,6 +61,15 @@ func (x *ApplicationClass) GoPointer() uintptr { | |||
| 52 | 61 | // | |
| 53 | 62 | // - `style-hc-dark.css` contains styles used when the system high contrast | |
| 54 | 63 | // preference is enabled and [property@StyleManager:dark] is `TRUE`. | |
| 64 | + | // | |
| 65 | + | // :::note | |
| 66 | + | // | |
| 67 | + | // `style.css` can contain styles for dark and high contrast appearance as | |
| 68 | + | // well, using media queries: | |
| 69 | + | // | |
| 70 | + | // - `prefers-color-scheme: dark` for styles used only for dark appearance. | |
| 71 | + | // - `prefers-contrast: more` for styles used only when the system high | |
| 72 | + | // contrast preference is enabled. | |
| 55 | 73 | type Application struct { | |
| 56 | 74 | gtk.Application | |
| 57 | 75 | } | |
M v4/adw/adw-preferences-group.go +34 -0
| @@ -7,6 +7,8 @@ import ( | |||
| 7 | 7 | ||
| 8 | 8 | "github.com/jwijenbergh/purego" | |
| 9 | 9 | "github.com/jwijenbergh/puregotk/pkg/core" | |
| 10 | + | "github.com/jwijenbergh/puregotk/v4/gio" | |
| 11 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |
| 10 | 12 | "github.com/jwijenbergh/puregotk/v4/gobject" | |
| 11 | 13 | "github.com/jwijenbergh/puregotk/v4/gobject/types" | |
| 12 | 14 | "github.com/jwijenbergh/puregotk/v4/gtk" | |
| @@ -104,6 +106,17 @@ func (x *PreferencesGroup) Add(ChildVar *gtk.Widget) { | |||
| 104 | 106 | ||
| 105 | 107 | } | |
| 106 | 108 | ||
| 109 | + | var xPreferencesGroupBindModel func(uintptr, uintptr, uintptr, uintptr, uintptr) | |
| 110 | + | ||
| 111 | + | // Binds @model to @self. | |
| 112 | + | // | |
| 113 | + | // See [method@Gtk.ListBox.bind_model]. | |
| 114 | + | func (x *PreferencesGroup) BindModel(ModelVar gio.ListModel, CreateRowFuncVar *gtk.ListBoxCreateWidgetFunc, UserDataVar uintptr, UserDataFreeFuncVar *glib.DestroyNotify) { | |
| 115 | + | ||
| 116 | + | xPreferencesGroupBindModel(x.GoPointer(), ModelVar.GoPointer(), glib.NewCallbackNullable(CreateRowFuncVar), UserDataVar, glib.NewCallback(UserDataFreeFuncVar)) | |
| 117 | + | ||
| 118 | + | } | |
| 119 | + | ||
| 107 | 120 | var xPreferencesGroupGetDescription func(uintptr) string | |
| 108 | 121 | ||
| 109 | 122 | // Gets the description of @self. | |
| @@ -130,6 +143,25 @@ func (x *PreferencesGroup) GetHeaderSuffix() *gtk.Widget { | |||
| 130 | 143 | return cls | |
| 131 | 144 | } | |
| 132 | 145 | ||
| 146 | + | var xPreferencesGroupGetRow func(uintptr, uint) uintptr | |
| 147 | + | ||
| 148 | + | // Gets the row at @index. | |
| 149 | + | // | |
| 150 | + | // Can return `NULL` if @index is larger than the number of rows in the group. | |
| 151 | + | func (x *PreferencesGroup) GetRow(IndexVar uint) *gtk.Widget { | |
| 152 | + | var cls *gtk.Widget | |
| 153 | + | ||
| 154 | + | cret := xPreferencesGroupGetRow(x.GoPointer(), IndexVar) | |
| 155 | + | ||
| 156 | + | if cret == 0 { | |
| 157 | + | return nil | |
| 158 | + | } | |
| 159 | + | gobject.IncreaseRef(cret) | |
| 160 | + | cls = >k.Widget{} | |
| 161 | + | cls.Ptr = cret | |
| 162 | + | return cls | |
| 163 | + | } | |
| 164 | + | ||
| 133 | 165 | var xPreferencesGroupGetSeparateRows func(uintptr) bool | |
| 134 | 166 | ||
| 135 | 167 | // Gets whether @self's rows are separated. | |
| @@ -507,8 +539,10 @@ func init() { | |||
| 507 | 539 | core.PuregoSafeRegister(&xNewPreferencesGroup, libs, "adw_preferences_group_new") | |
| 508 | 540 | ||
| 509 | 541 | core.PuregoSafeRegister(&xPreferencesGroupAdd, libs, "adw_preferences_group_add") | |
| 542 | + | core.PuregoSafeRegister(&xPreferencesGroupBindModel, libs, "adw_preferences_group_bind_model") | |
| 510 | 543 | core.PuregoSafeRegister(&xPreferencesGroupGetDescription, libs, "adw_preferences_group_get_description") | |
| 511 | 544 | core.PuregoSafeRegister(&xPreferencesGroupGetHeaderSuffix, libs, "adw_preferences_group_get_header_suffix") | |
| 545 | + | core.PuregoSafeRegister(&xPreferencesGroupGetRow, libs, "adw_preferences_group_get_row") | |
| 512 | 546 | core.PuregoSafeRegister(&xPreferencesGroupGetSeparateRows, libs, "adw_preferences_group_get_separate_rows") | |
| 513 | 547 | core.PuregoSafeRegister(&xPreferencesGroupGetTitle, libs, "adw_preferences_group_get_title") | |
| 514 | 548 | core.PuregoSafeRegister(&xPreferencesGroupRemove, libs, "adw_preferences_group_remove") | |
M v4/adw/adw-preferences-page.go +33 -0
| @@ -120,6 +120,25 @@ func (x *PreferencesPage) GetDescriptionCentered() bool { | |||
| 120 | 120 | return cret | |
| 121 | 121 | } | |
| 122 | 122 | ||
| 123 | + | var xPreferencesPageGetGroup func(uintptr, uint) uintptr | |
| 124 | + | ||
| 125 | + | // Gets the group at @index. | |
| 126 | + | // | |
| 127 | + | // Can return `NULL` if @index is larger than the number of groups in the page. | |
| 128 | + | func (x *PreferencesPage) GetGroup(IndexVar uint) *PreferencesGroup { | |
| 129 | + | var cls *PreferencesGroup | |
| 130 | + | ||
| 131 | + | cret := xPreferencesPageGetGroup(x.GoPointer(), IndexVar) | |
| 132 | + | ||
| 133 | + | if cret == 0 { | |
| 134 | + | return nil | |
| 135 | + | } | |
| 136 | + | gobject.IncreaseRef(cret) | |
| 137 | + | cls = &PreferencesGroup{} | |
| 138 | + | cls.Ptr = cret | |
| 139 | + | return cls | |
| 140 | + | } | |
| 141 | + | ||
| 123 | 142 | var xPreferencesPageGetIconName func(uintptr) string | |
| 124 | 143 | ||
| 125 | 144 | // Gets the icon name for @self. | |
| @@ -156,6 +175,18 @@ func (x *PreferencesPage) GetUseUnderline() bool { | |||
| 156 | 175 | return cret | |
| 157 | 176 | } | |
| 158 | 177 | ||
| 178 | + | var xPreferencesPageInsert func(uintptr, uintptr, int) | |
| 179 | + | ||
| 180 | + | // Inserts a preferences group to @self at @index. | |
| 181 | + | // | |
| 182 | + | // If @index is negative or larger than the number of groups, appends the group, | |
| 183 | + | // same as [method@PreferencesPage.add]. | |
| 184 | + | func (x *PreferencesPage) Insert(GroupVar *PreferencesGroup, IndexVar int) { | |
| 185 | + | ||
| 186 | + | xPreferencesPageInsert(x.GoPointer(), GroupVar.GoPointer(), IndexVar) | |
| 187 | + | ||
| 188 | + | } | |
| 189 | + | ||
| 159 | 190 | var xPreferencesPageRemove func(uintptr, uintptr) | |
| 160 | 191 | ||
| 161 | 192 | // Removes a group from @self. | |
| @@ -548,10 +579,12 @@ func init() { | |||
| 548 | 579 | core.PuregoSafeRegister(&xPreferencesPageGetBanner, libs, "adw_preferences_page_get_banner") | |
| 549 | 580 | core.PuregoSafeRegister(&xPreferencesPageGetDescription, libs, "adw_preferences_page_get_description") | |
| 550 | 581 | core.PuregoSafeRegister(&xPreferencesPageGetDescriptionCentered, libs, "adw_preferences_page_get_description_centered") | |
| 582 | + | core.PuregoSafeRegister(&xPreferencesPageGetGroup, libs, "adw_preferences_page_get_group") | |
| 551 | 583 | core.PuregoSafeRegister(&xPreferencesPageGetIconName, libs, "adw_preferences_page_get_icon_name") | |
| 552 | 584 | core.PuregoSafeRegister(&xPreferencesPageGetName, libs, "adw_preferences_page_get_name") | |
| 553 | 585 | core.PuregoSafeRegister(&xPreferencesPageGetTitle, libs, "adw_preferences_page_get_title") | |
| 554 | 586 | core.PuregoSafeRegister(&xPreferencesPageGetUseUnderline, libs, "adw_preferences_page_get_use_underline") | |
| 587 | + | core.PuregoSafeRegister(&xPreferencesPageInsert, libs, "adw_preferences_page_insert") | |
| 555 | 588 | core.PuregoSafeRegister(&xPreferencesPageRemove, libs, "adw_preferences_page_remove") | |
| 556 | 589 | core.PuregoSafeRegister(&xPreferencesPageScrollToTop, libs, "adw_preferences_page_scroll_to_top") | |
| 557 | 590 | core.PuregoSafeRegister(&xPreferencesPageSetBanner, libs, "adw_preferences_page_set_banner") | |
A v4/adw/adw-shortcut-label.go +471 -0
| @@ -0,0 +1,471 @@ | |||
| 1 | + | // Package adw was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT | |
| 2 | + | package adw | |
| 3 | + | ||
| 4 | + | import ( | |
| 5 | + | "structs" | |
| 6 | + | "unsafe" | |
| 7 | + | ||
| 8 | + | "github.com/jwijenbergh/purego" | |
| 9 | + | "github.com/jwijenbergh/puregotk/pkg/core" | |
| 10 | + | "github.com/jwijenbergh/puregotk/v4/gobject" | |
| 11 | + | "github.com/jwijenbergh/puregotk/v4/gobject/types" | |
| 12 | + | "github.com/jwijenbergh/puregotk/v4/gtk" | |
| 13 | + | ) | |
| 14 | + | ||
| 15 | + | type ShortcutLabelClass struct { | |
| 16 | + | _ structs.HostLayout | |
| 17 | + | ||
| 18 | + | ParentClass gtk.WidgetClass | |
| 19 | + | } | |
| 20 | + | ||
| 21 | + | func (x *ShortcutLabelClass) GoPointer() uintptr { | |
| 22 | + | return uintptr(unsafe.Pointer(x)) | |
| 23 | + | } | |
| 24 | + | ||
| 25 | + | // A widget that displays a keyboard shortcut. | |
| 26 | + | // | |
| 27 | + | // <picture> | |
| 28 | + | // | |
| 29 | + | // <source srcset="shortcut-label-dark.png" media="(prefers-color-scheme: dark)"> | |
| 30 | + | // <img src="shortcut-label.png" alt="shortcut-label"> | |
| 31 | + | // | |
| 32 | + | // </picture> | |
| 33 | + | // | |
| 34 | + | // The shown shortcut can be set using the [property@ShortcutLabel:accelerator] | |
| 35 | + | // property. | |
| 36 | + | // | |
| 37 | + | // Optionally, if no shortcut is set, `AdwShortcutLabel` will display a | |
| 38 | + | // placeholder set with the [property@ShortcutLabel:disabled-text] property. | |
| 39 | + | // | |
| 40 | + | // The following types of shortcuts can be displayed: | |
| 41 | + | // | |
| 42 | + | // - A single shortcut in [func@Gtk.accelerator_parse] format, e.g. `<Control>C`: | |
| 43 | + | // | |
| 44 | + | // <picture> | |
| 45 | + | // <source srcset="shortcut-label-single-dark.png" media="(prefers-color-scheme: dark)"> | |
| 46 | + | // <img src="shortcut-label-single.png" alt="shortcut-label-single"> | |
| 47 | + | // </picture> | |
| 48 | + | // | |
| 49 | + | // - Multiple alternative shortcuts, separated with spaces, e.g. `<Shift>A Home`: | |
| 50 | + | // | |
| 51 | + | // <picture> | |
| 52 | + | // <source srcset="shortcut-label-alternative-dark.png" media="(prefers-color-scheme: dark)"> | |
| 53 | + | // <img src="shortcut-label-alternative.png" alt="shortcut-label-alternative"> | |
| 54 | + | // </picture> | |
| 55 | + | // | |
| 56 | + | // - A range of shortcuts, separated with `...`, e.g. `<Alt>1...9`: | |
| 57 | + | // | |
| 58 | + | // <picture> | |
| 59 | + | // <source srcset="shortcut-label-range-dark.png" media="(prefers-color-scheme: dark)"> | |
| 60 | + | // <img src="shortcut-label-range.png" alt="shortcut-label-range"> | |
| 61 | + | // </picture> | |
| 62 | + | // | |
| 63 | + | // - Multiple keys pressed at once, separated with `&`, e.g. `Control_L&Control_R`: | |
| 64 | + | // | |
| 65 | + | // <picture> | |
| 66 | + | // <source srcset="shortcut-label-multiple-dark.png" media="(prefers-color-scheme: dark)"> | |
| 67 | + | // <img src="shortcut-label-multiple.png" alt="shortcut-label-multiple"> | |
| 68 | + | // </picture> | |
| 69 | + | // | |
| 70 | + | // - Multiple shortcuts or keys, pressed sequentially, separated with `+`, e.g. `<Control>C+<Control>X`: | |
| 71 | + | // | |
| 72 | + | // <picture> | |
| 73 | + | // <source srcset="shortcut-label-sequence-dark.png" media="(prefers-color-scheme: dark)"> | |
| 74 | + | // <img src="shortcut-label-sequence.png" alt="shortcut-label-sequence"> | |
| 75 | + | // </picture> | |
| 76 | + | // | |
| 77 | + | // ::: note | |
| 78 | + | // | |
| 79 | + | // `<`, `>` and `&` need to be escaped as `&lt;`, `&gt;` and `&amp;` when used in UI files. | |
| 80 | + | // | |
| 81 | + | // ## CSS nodes | |
| 82 | + | // | |
| 83 | + | // `AdwShortcutLabel` has a single CSS node with name `shortcut-label`. The | |
| 84 | + | // individual keycap labels each have the `.keycap` style class, while the | |
| 85 | + | // labels separating them have the `.dimmed` style class. | |
| 86 | + | // | |
| 87 | + | // ## Accessibility | |
| 88 | + | // | |
| 89 | + | // `AdwShortcutLabel` uses the `GTK_ACCESSIBLE_ROLE_GENERIC` role. | |
| 90 | + | // | |
| 91 | + | // See also: [class@ShortcutsDialog]. | |
| 92 | + | type ShortcutLabel struct { | |
| 93 | + | gtk.Widget | |
| 94 | + | } | |
| 95 | + | ||
| 96 | + | var xShortcutLabelGLibType func() types.GType | |
| 97 | + | ||
| 98 | + | func ShortcutLabelGLibType() types.GType { | |
| 99 | + | return xShortcutLabelGLibType() | |
| 100 | + | } | |
| 101 | + | ||
| 102 | + | func ShortcutLabelNewFromInternalPtr(ptr uintptr) *ShortcutLabel { | |
| 103 | + | cls := &ShortcutLabel{} | |
| 104 | + | cls.Ptr = ptr | |
| 105 | + | return cls | |
| 106 | + | } | |
| 107 | + | ||
| 108 | + | var xNewShortcutLabel func(string) uintptr | |
| 109 | + | ||
| 110 | + | // Creates a new `AdwShortcutLabel` showing @accelerator. | |
| 111 | + | func NewShortcutLabel(AcceleratorVar string) *ShortcutLabel { | |
| 112 | + | var cls *ShortcutLabel | |
| 113 | + | ||
| 114 | + | cret := xNewShortcutLabel(AcceleratorVar) | |
| 115 | + | ||
| 116 | + | if cret == 0 { | |
| 117 | + | return nil | |
| 118 | + | } | |
| 119 | + | gobject.IncreaseRef(cret) | |
| 120 | + | cls = &ShortcutLabel{} | |
| 121 | + | cls.Ptr = cret | |
| 122 | + | return cls | |
| 123 | + | } | |
| 124 | + | ||
| 125 | + | var xShortcutLabelGetAccelerator func(uintptr) string | |
| 126 | + | ||
| 127 | + | // Gets the accelerator displayed by @self. | |
| 128 | + | func (x *ShortcutLabel) GetAccelerator() string { | |
| 129 | + | ||
| 130 | + | cret := xShortcutLabelGetAccelerator(x.GoPointer()) | |
| 131 | + | return cret | |
| 132 | + | } | |
| 133 | + | ||
| 134 | + | var xShortcutLabelGetDisabledText func(uintptr) string | |
| 135 | + | ||
| 136 | + | // Gets the text displayed by @self when no accelerator is set. | |
| 137 | + | func (x *ShortcutLabel) GetDisabledText() string { | |
| 138 | + | ||
| 139 | + | cret := xShortcutLabelGetDisabledText(x.GoPointer()) | |
| 140 | + | return cret | |
| 141 | + | } | |
| 142 | + | ||
| 143 | + | var xShortcutLabelSetAccelerator func(uintptr, string) | |
| 144 | + | ||
| 145 | + | // Sets the accelerator to be displayed by @self. | |
| 146 | + | func (x *ShortcutLabel) SetAccelerator(AcceleratorVar string) { | |
| 147 | + | ||
| 148 | + | xShortcutLabelSetAccelerator(x.GoPointer(), AcceleratorVar) | |
| 149 | + | ||
| 150 | + | } | |
| 151 | + | ||
| 152 | + | var xShortcutLabelSetDisabledText func(uintptr, string) | |
| 153 | + | ||
| 154 | + | // Sets the text to be displayed by @self when no accelerator is set. | |
| 155 | + | func (x *ShortcutLabel) SetDisabledText(DisabledTextVar string) { | |
| 156 | + | ||
| 157 | + | xShortcutLabelSetDisabledText(x.GoPointer(), DisabledTextVar) | |
| 158 | + | ||
| 159 | + | } | |
| 160 | + | ||
| 161 | + | func (c *ShortcutLabel) GoPointer() uintptr { | |
| 162 | + | if c == nil { | |
| 163 | + | return 0 | |
| 164 | + | } | |
| 165 | + | return c.Ptr | |
| 166 | + | } | |
| 167 | + | ||
| 168 | + | func (c *ShortcutLabel) SetGoPointer(ptr uintptr) { | |
| 169 | + | c.Ptr = ptr | |
| 170 | + | } | |
| 171 | + | ||
| 172 | + | // Requests the user's screen reader to announce the given message. | |
| 173 | + | // | |
| 174 | + | // This kind of notification is useful for messages that | |
| 175 | + | // either have only a visual representation or that are not | |
| 176 | + | // exposed visually at all, e.g. a notification about a | |
| 177 | + | // successful operation. | |
| 178 | + | // | |
| 179 | + | // Also, by using this API, you can ensure that the message | |
| 180 | + | // does not interrupts the user's current screen reader output. | |
| 181 | + | func (x *ShortcutLabel) Announce(MessageVar string, PriorityVar gtk.AccessibleAnnouncementPriority) { | |
| 182 | + | ||
| 183 | + | gtk.XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar) | |
| 184 | + | ||
| 185 | + | } | |
| 186 | + | ||
| 187 | + | // Retrieves the accessible parent for an accessible object. | |
| 188 | + | // | |
| 189 | + | // This function returns `NULL` for top level widgets. | |
| 190 | + | func (x *ShortcutLabel) GetAccessibleParent() *gtk.AccessibleBase { | |
| 191 | + | var cls *gtk.AccessibleBase | |
| 192 | + | ||
| 193 | + | cret := gtk.XGtkAccessibleGetAccessibleParent(x.GoPointer()) | |
| 194 | + | ||
| 195 | + | if cret == 0 { | |
| 196 | + | return nil | |
| 197 | + | } | |
| 198 | + | cls = >k.AccessibleBase{} | |
| 199 | + | cls.Ptr = cret | |
| 200 | + | return cls | |
| 201 | + | } | |
| 202 | + | ||
| 203 | + | // Retrieves the accessible role of an accessible object. | |
| 204 | + | func (x *ShortcutLabel) GetAccessibleRole() gtk.AccessibleRole { | |
| 205 | + | ||
| 206 | + | cret := gtk.XGtkAccessibleGetAccessibleRole(x.GoPointer()) | |
| 207 | + | return cret | |
| 208 | + | } | |
| 209 | + | ||
| 210 | + | // Retrieves the implementation for the given accessible object. | |
| 211 | + | func (x *ShortcutLabel) GetAtContext() *gtk.ATContext { | |
| 212 | + | var cls *gtk.ATContext | |
| 213 | + | ||
| 214 | + | cret := gtk.XGtkAccessibleGetAtContext(x.GoPointer()) | |
| 215 | + | ||
| 216 | + | if cret == 0 { | |
| 217 | + | return nil | |
| 218 | + | } | |
| 219 | + | cls = >k.ATContext{} | |
| 220 | + | cls.Ptr = cret | |
| 221 | + | return cls | |
| 222 | + | } | |
| 223 | + | ||
| 224 | + | // Queries the coordinates and dimensions of this accessible | |
| 225 | + | // | |
| 226 | + | // This functionality can be overridden by `GtkAccessible` | |
| 227 | + | // implementations, e.g. to get the bounds from an ignored | |
| 228 | + | // child widget. | |
| 229 | + | func (x *ShortcutLabel) GetBounds(XVar int, YVar int, WidthVar int, HeightVar int) bool { | |
| 230 | + | ||
| 231 | + | cret := gtk.XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar) | |
| 232 | + | return cret | |
| 233 | + | } | |
| 234 | + | ||
| 235 | + | // Retrieves the first accessible child of an accessible object. | |
| 236 | + | func (x *ShortcutLabel) GetFirstAccessibleChild() *gtk.AccessibleBase { | |
| 237 | + | var cls *gtk.AccessibleBase | |
| 238 | + | ||
| 239 | + | cret := gtk.XGtkAccessibleGetFirstAccessibleChild(x.GoPointer()) | |
| 240 | + | ||
| 241 | + | if cret == 0 { | |
| 242 | + | return nil | |
| 243 | + | } | |
| 244 | + | cls = >k.AccessibleBase{} | |
| 245 | + | cls.Ptr = cret | |
| 246 | + | return cls | |
| 247 | + | } | |
| 248 | + | ||
| 249 | + | // Retrieves the next accessible sibling of an accessible object | |
| 250 | + | func (x *ShortcutLabel) GetNextAccessibleSibling() *gtk.AccessibleBase { | |
| 251 | + | var cls *gtk.AccessibleBase | |
| 252 | + | ||
| 253 | + | cret := gtk.XGtkAccessibleGetNextAccessibleSibling(x.GoPointer()) | |
| 254 | + | ||
| 255 | + | if cret == 0 { | |
| 256 | + | return nil | |
| 257 | + | } | |
| 258 | + | cls = >k.AccessibleBase{} | |
| 259 | + | cls.Ptr = cret | |
| 260 | + | return cls | |
| 261 | + | } | |
| 262 | + | ||
| 263 | + | // Queries a platform state, such as focus. | |
| 264 | + | // | |
| 265 | + | // This functionality can be overridden by `GtkAccessible` | |
| 266 | + | // implementations, e.g. to get platform state from an ignored | |
| 267 | + | // child widget, as is the case for `GtkText` wrappers. | |
| 268 | + | func (x *ShortcutLabel) GetPlatformState(StateVar gtk.AccessiblePlatformState) bool { | |
| 269 | + | ||
| 270 | + | cret := gtk.XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar) | |
| 271 | + | return cret | |
| 272 | + | } | |
| 273 | + | ||
| 274 | + | // Resets the accessible property to its default value. | |
| 275 | + | func (x *ShortcutLabel) ResetProperty(PropertyVar gtk.AccessibleProperty) { | |
| 276 | + | ||
| 277 | + | gtk.XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar) | |
| 278 | + | ||
| 279 | + | } | |
| 280 | + | ||
| 281 | + | // Resets the accessible relation to its default value. | |
| 282 | + | func (x *ShortcutLabel) ResetRelation(RelationVar gtk.AccessibleRelation) { | |
| 283 | + | ||
| 284 | + | gtk.XGtkAccessibleResetRelation(x.GoPointer(), RelationVar) | |
| 285 | + | ||
| 286 | + | } | |
| 287 | + | ||
| 288 | + | // Resets the accessible state to its default value. | |
| 289 | + | func (x *ShortcutLabel) ResetState(StateVar gtk.AccessibleState) { | |
| 290 | + | ||
| 291 | + | gtk.XGtkAccessibleResetState(x.GoPointer(), StateVar) | |
| 292 | + | ||
| 293 | + | } | |
| 294 | + | ||
| 295 | + | // Sets the parent and sibling of an accessible object. | |
| 296 | + | // | |
| 297 | + | // This function is meant to be used by accessible implementations that are | |
| 298 | + | // not part of the widget hierarchy, and but act as a logical bridge between | |
| 299 | + | // widgets. For instance, if a widget creates an object that holds metadata | |
| 300 | + | // for each child, and you want that object to implement the `GtkAccessible` | |
| 301 | + | // interface, you will use this function to ensure that the parent of each | |
| 302 | + | // child widget is the metadata object, and the parent of each metadata | |
| 303 | + | // object is the container widget. | |
| 304 | + | func (x *ShortcutLabel) SetAccessibleParent(ParentVar gtk.Accessible, NextSiblingVar gtk.Accessible) { | |
| 305 | + | ||
| 306 | + | gtk.XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer()) | |
| 307 | + | ||
| 308 | + | } | |
| 309 | + | ||
| 310 | + | // Updates the next accessible sibling. | |
| 311 | + | // | |
| 312 | + | // That might be useful when a new child of a custom accessible | |
| 313 | + | // is created, and it needs to be linked to a previous child. | |
| 314 | + | func (x *ShortcutLabel) UpdateNextAccessibleSibling(NewSiblingVar gtk.Accessible) { | |
| 315 | + | ||
| 316 | + | gtk.XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer()) | |
| 317 | + | ||
| 318 | + | } | |
| 319 | + | ||
| 320 | + | // Informs ATs that the platform state has changed. | |
| 321 | + | // | |
| 322 | + | // This function should be used by `GtkAccessible` implementations that | |
| 323 | + | // have a platform state but are not widgets. Widgets handle platform | |
| 324 | + | // states automatically. | |
| 325 | + | func (x *ShortcutLabel) UpdatePlatformState(StateVar gtk.AccessiblePlatformState) { | |
| 326 | + | ||
| 327 | + | gtk.XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar) | |
| 328 | + | ||
| 329 | + | } | |
| 330 | + | ||
| 331 | + | // Updates a list of accessible properties. | |
| 332 | + | // | |
| 333 | + | // See the [enum@Gtk.AccessibleProperty] documentation for the | |
| 334 | + | // value types of accessible properties. | |
| 335 | + | // | |
| 336 | + | // This function should be called by `GtkWidget` types whenever | |
| 337 | + | // an accessible property change must be communicated to assistive | |
| 338 | + | // technologies. | |
| 339 | + | // | |
| 340 | + | // Example: | |
| 341 | + | // ```c | |
| 342 | + | // value = gtk_adjustment_get_value (adjustment); | |
| 343 | + | // gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button), | |
| 344 | + | // | |
| 345 | + | // GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value, | |
| 346 | + | // -1); | |
| 347 | + | // | |
| 348 | + | // ``` | |
| 349 | + | func (x *ShortcutLabel) UpdateProperty(FirstPropertyVar gtk.AccessibleProperty, varArgs ...interface{}) { | |
| 350 | + | ||
| 351 | + | gtk.XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...) | |
| 352 | + | ||
| 353 | + | } | |
| 354 | + | ||
| 355 | + | // Updates an array of accessible properties. | |
| 356 | + | // | |
| 357 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 358 | + | // property change must be communicated to assistive technologies. | |
| 359 | + | // | |
| 360 | + | // This function is meant to be used by language bindings. | |
| 361 | + | func (x *ShortcutLabel) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []gtk.AccessibleProperty, ValuesVar []gobject.Value) { | |
| 362 | + | ||
| 363 | + | gtk.XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar) | |
| 364 | + | ||
| 365 | + | } | |
| 366 | + | ||
| 367 | + | // Updates a list of accessible relations. | |
| 368 | + | // | |
| 369 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 370 | + | // relation change must be communicated to assistive technologies. | |
| 371 | + | // | |
| 372 | + | // If the [enum@Gtk.AccessibleRelation] requires a list of references, | |
| 373 | + | // you should pass each reference individually, followed by `NULL`, e.g. | |
| 374 | + | // | |
| 375 | + | // ```c | |
| 376 | + | // gtk_accessible_update_relation (accessible, | |
| 377 | + | // | |
| 378 | + | // GTK_ACCESSIBLE_RELATION_CONTROLS, | |
| 379 | + | // ref1, NULL, | |
| 380 | + | // GTK_ACCESSIBLE_RELATION_LABELLED_BY, | |
| 381 | + | // ref1, ref2, ref3, NULL, | |
| 382 | + | // -1); | |
| 383 | + | // | |
| 384 | + | // ``` | |
| 385 | + | func (x *ShortcutLabel) UpdateRelation(FirstRelationVar gtk.AccessibleRelation, varArgs ...interface{}) { | |
| 386 | + | ||
| 387 | + | gtk.XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...) | |
| 388 | + | ||
| 389 | + | } | |
| 390 | + | ||
| 391 | + | // Updates an array of accessible relations. | |
| 392 | + | // | |
| 393 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 394 | + | // relation change must be communicated to assistive technologies. | |
| 395 | + | // | |
| 396 | + | // This function is meant to be used by language bindings. | |
| 397 | + | func (x *ShortcutLabel) UpdateRelationValue(NRelationsVar int, RelationsVar []gtk.AccessibleRelation, ValuesVar []gobject.Value) { | |
| 398 | + | ||
| 399 | + | gtk.XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar) | |
| 400 | + | ||
| 401 | + | } | |
| 402 | + | ||
| 403 | + | // Updates a list of accessible states. | |
| 404 | + | // | |
| 405 | + | // See the [enum@Gtk.AccessibleState] documentation for the | |
| 406 | + | // value types of accessible states. | |
| 407 | + | // | |
| 408 | + | // This function should be called by `GtkWidget` types whenever | |
| 409 | + | // an accessible state change must be communicated to assistive | |
| 410 | + | // technologies. | |
| 411 | + | // | |
| 412 | + | // Example: | |
| 413 | + | // | |
| 414 | + | // ```c | |
| 415 | + | // value = GTK_ACCESSIBLE_TRISTATE_MIXED; | |
| 416 | + | // gtk_accessible_update_state (GTK_ACCESSIBLE (check_button), | |
| 417 | + | // | |
| 418 | + | // GTK_ACCESSIBLE_STATE_CHECKED, value, | |
| 419 | + | // -1); | |
| 420 | + | // | |
| 421 | + | // ``` | |
| 422 | + | func (x *ShortcutLabel) UpdateState(FirstStateVar gtk.AccessibleState, varArgs ...interface{}) { | |
| 423 | + | ||
| 424 | + | gtk.XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...) | |
| 425 | + | ||
| 426 | + | } | |
| 427 | + | ||
| 428 | + | // Updates an array of accessible states. | |
| 429 | + | // | |
| 430 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 431 | + | // state change must be communicated to assistive technologies. | |
| 432 | + | // | |
| 433 | + | // This function is meant to be used by language bindings. | |
| 434 | + | func (x *ShortcutLabel) UpdateStateValue(NStatesVar int, StatesVar []gtk.AccessibleState, ValuesVar []gobject.Value) { | |
| 435 | + | ||
| 436 | + | gtk.XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar) | |
| 437 | + | ||
| 438 | + | } | |
| 439 | + | ||
| 440 | + | // Gets the ID of the @buildable object. | |
| 441 | + | // | |
| 442 | + | // `GtkBuilder` sets the name based on the ID attribute | |
| 443 | + | // of the `<object>` tag used to construct the @buildable. | |
| 444 | + | func (x *ShortcutLabel) GetBuildableId() string { | |
| 445 | + | ||
| 446 | + | cret := gtk.XGtkBuildableGetBuildableId(x.GoPointer()) | |
| 447 | + | return cret | |
| 448 | + | } | |
| 449 | + | ||
| 450 | + | func init() { | |
| 451 | + | core.SetPackageName("ADW", "libadwaita-1") | |
| 452 | + | core.SetSharedLibraries("ADW", []string{"libadwaita-1.so.0"}) | |
| 453 | + | var libs []uintptr | |
| 454 | + | for _, libPath := range core.GetPaths("ADW") { | |
| 455 | + | lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) | |
| 456 | + | if err != nil { | |
| 457 | + | panic(err) | |
| 458 | + | } | |
| 459 | + | libs = append(libs, lib) | |
| 460 | + | } | |
| 461 | + | ||
| 462 | + | core.PuregoSafeRegister(&xShortcutLabelGLibType, libs, "adw_shortcut_label_get_type") | |
| 463 | + | ||
| 464 | + | core.PuregoSafeRegister(&xNewShortcutLabel, libs, "adw_shortcut_label_new") | |
| 465 | + | ||
| 466 | + | core.PuregoSafeRegister(&xShortcutLabelGetAccelerator, libs, "adw_shortcut_label_get_accelerator") | |
| 467 | + | core.PuregoSafeRegister(&xShortcutLabelGetDisabledText, libs, "adw_shortcut_label_get_disabled_text") | |
| 468 | + | core.PuregoSafeRegister(&xShortcutLabelSetAccelerator, libs, "adw_shortcut_label_set_accelerator") | |
| 469 | + | core.PuregoSafeRegister(&xShortcutLabelSetDisabledText, libs, "adw_shortcut_label_set_disabled_text") | |
| 470 | + | ||
| 471 | + | } | |
A v4/adw/adw-shortcuts-dialog.go +465 -0
| @@ -0,0 +1,465 @@ | |||
| 1 | + | // Package adw was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT | |
| 2 | + | package adw | |
| 3 | + | ||
| 4 | + | import ( | |
| 5 | + | "structs" | |
| 6 | + | "unsafe" | |
| 7 | + | ||
| 8 | + | "github.com/jwijenbergh/purego" | |
| 9 | + | "github.com/jwijenbergh/puregotk/pkg/core" | |
| 10 | + | "github.com/jwijenbergh/puregotk/v4/gobject" | |
| 11 | + | "github.com/jwijenbergh/puregotk/v4/gobject/types" | |
| 12 | + | "github.com/jwijenbergh/puregotk/v4/gtk" | |
| 13 | + | ) | |
| 14 | + | ||
| 15 | + | type ShortcutsDialogClass struct { | |
| 16 | + | _ structs.HostLayout | |
| 17 | + | ||
| 18 | + | ParentClass DialogClass | |
| 19 | + | } | |
| 20 | + | ||
| 21 | + | func (x *ShortcutsDialogClass) GoPointer() uintptr { | |
| 22 | + | return uintptr(unsafe.Pointer(x)) | |
| 23 | + | } | |
| 24 | + | ||
| 25 | + | // A dialog that displays application's keyboard shortcuts. | |
| 26 | + | // | |
| 27 | + | // <picture> | |
| 28 | + | // | |
| 29 | + | // <source srcset="shortcuts-dialog-dark.png" media="(prefers-color-scheme: dark)"> | |
| 30 | + | // <img src="shortcuts-dialog.png" alt="shortcuts-dialog"> | |
| 31 | + | // | |
| 32 | + | // </picture> | |
| 33 | + | // | |
| 34 | + | // Shortcuts are grouped into sections, represented by [class@ShortcutsSection] | |
| 35 | + | // objects. Each section has one or more items, represented by | |
| 36 | + | // [class@ShortcutsItem] objects. | |
| 37 | + | // | |
| 38 | + | // To add a section to the dialog, use [method@ShortcutsDialog.add], or add it | |
| 39 | + | // as a child when using UI files. | |
| 40 | + | // | |
| 41 | + | // Sections without titles can be used to further subdivide each section into | |
| 42 | + | // groups. | |
| 43 | + | // | |
| 44 | + | // Example of an `AdwShortcutsDialog` UI definition: | |
| 45 | + | // | |
| 46 | + | // ```xml | |
| 47 | + | // <object class="AdwShortcutsDialog" id="shortcuts_dialog"> | |
| 48 | + | // | |
| 49 | + | // <child> | |
| 50 | + | // <object class="AdwShortcutsSection"> | |
| 51 | + | // <property name="title" translatable="yes">General</property> | |
| 52 | + | // <child> | |
| 53 | + | // <object class="AdwShortcutsItem"> | |
| 54 | + | // <property name="title" translatable="yes">Open Menu</property> | |
| 55 | + | // <property name="accelerator">F10</property> | |
| 56 | + | // </object> | |
| 57 | + | // </child> | |
| 58 | + | // <child> | |
| 59 | + | // <object class="AdwShortcutsItem"> | |
| 60 | + | // <property name="title" translatable="yes">Quit</property> | |
| 61 | + | // <property name="action-name">app.quit</property> | |
| 62 | + | // </object> | |
| 63 | + | // </child> | |
| 64 | + | // </object> | |
| 65 | + | // </child> | |
| 66 | + | // <child> | |
| 67 | + | // <object class="AdwShortcutsSection"> | |
| 68 | + | // <child> | |
| 69 | + | // <object class="AdwShortcutsItem"> | |
| 70 | + | // <property name="title" translatable="yes">Move Tab Left</property> | |
| 71 | + | // <property name="accelerator">&lt;Shift&gt;&lt;Ctrl&gt;Page_Up</property> | |
| 72 | + | // <property name="direction">ltr</property> | |
| 73 | + | // </object> | |
| 74 | + | // </child> | |
| 75 | + | // <child> | |
| 76 | + | // <object class="AdwShortcutsItem"> | |
| 77 | + | // <property name="title" translatable="yes">Move Tab Right</property> | |
| 78 | + | // <property name="accelerator">&lt;Shift&gt;&lt;Ctrl&gt;Page_Down</property> | |
| 79 | + | // <property name="direction">ltr</property> | |
| 80 | + | // </object> | |
| 81 | + | // </child> | |
| 82 | + | // <child> | |
| 83 | + | // <object class="AdwShortcutsItem"> | |
| 84 | + | // <property name="title" translatable="yes">Move Tab Right</property> | |
| 85 | + | // <property name="accelerator">&lt;Shift&gt;&lt;Ctrl&gt;Page_Up</property> | |
| 86 | + | // <property name="direction">rtl</property> | |
| 87 | + | // </object> | |
| 88 | + | // </child> | |
| 89 | + | // <child> | |
| 90 | + | // <object class="AdwShortcutsItem"> | |
| 91 | + | // <property name="title" translatable="yes">Move Tab Left</property> | |
| 92 | + | // <property name="accelerator">&lt;Shift&gt;&lt;Ctrl&gt;Page_Down</property> | |
| 93 | + | // <property name="direction">rtl</property> | |
| 94 | + | // </object> | |
| 95 | + | // </child> | |
| 96 | + | // </object> | |
| 97 | + | // </child> | |
| 98 | + | // | |
| 99 | + | // </object> | |
| 100 | + | // ``` | |
| 101 | + | // | |
| 102 | + | // If the `app.quit` action has the <kbd>Ctrl</kbd><kbd>Q</kbd> accelerator | |
| 103 | + | // associated with it, the result will look as follows: | |
| 104 | + | // | |
| 105 | + | // <picture> | |
| 106 | + | // | |
| 107 | + | // <source srcset="shortcuts-dialog-example-dark.png" media="(prefers-color-scheme: dark)"> | |
| 108 | + | // <img src="shortcuts-dialog-example.png" alt="shortcuts-dialog-example"> | |
| 109 | + | // | |
| 110 | + | // </picture> | |
| 111 | + | // | |
| 112 | + | // The recommended way to use `AdwShortcutsDialog` is via [class@Application]'s | |
| 113 | + | // automatic resource loading. | |
| 114 | + | // | |
| 115 | + | // See also: [class@ShortcutLabel]. | |
| 116 | + | type ShortcutsDialog struct { | |
| 117 | + | Dialog | |
| 118 | + | } | |
| 119 | + | ||
| 120 | + | var xShortcutsDialogGLibType func() types.GType | |
| 121 | + | ||
| 122 | + | func ShortcutsDialogGLibType() types.GType { | |
| 123 | + | return xShortcutsDialogGLibType() | |
| 124 | + | } | |
| 125 | + | ||
| 126 | + | func ShortcutsDialogNewFromInternalPtr(ptr uintptr) *ShortcutsDialog { | |
| 127 | + | cls := &ShortcutsDialog{} | |
| 128 | + | cls.Ptr = ptr | |
| 129 | + | return cls | |
| 130 | + | } | |
| 131 | + | ||
| 132 | + | var xNewShortcutsDialog func() uintptr | |
| 133 | + | ||
| 134 | + | // Creates a new `AdwShortcutsDialog`. | |
| 135 | + | func NewShortcutsDialog() *ShortcutsDialog { | |
| 136 | + | var cls *ShortcutsDialog | |
| 137 | + | ||
| 138 | + | cret := xNewShortcutsDialog() | |
| 139 | + | ||
| 140 | + | if cret == 0 { | |
| 141 | + | return nil | |
| 142 | + | } | |
| 143 | + | gobject.IncreaseRef(cret) | |
| 144 | + | cls = &ShortcutsDialog{} | |
| 145 | + | cls.Ptr = cret | |
| 146 | + | return cls | |
| 147 | + | } | |
| 148 | + | ||
| 149 | + | var xShortcutsDialogAdd func(uintptr, uintptr) | |
| 150 | + | ||
| 151 | + | // Adds @section to @self. | |
| 152 | + | func (x *ShortcutsDialog) Add(SectionVar *ShortcutsSection) { | |
| 153 | + | ||
| 154 | + | xShortcutsDialogAdd(x.GoPointer(), SectionVar.GoPointer()) | |
| 155 | + | ||
| 156 | + | } | |
| 157 | + | ||
| 158 | + | func (c *ShortcutsDialog) GoPointer() uintptr { | |
| 159 | + | if c == nil { | |
| 160 | + | return 0 | |
| 161 | + | } | |
| 162 | + | return c.Ptr | |
| 163 | + | } | |
| 164 | + | ||
| 165 | + | func (c *ShortcutsDialog) SetGoPointer(ptr uintptr) { | |
| 166 | + | c.Ptr = ptr | |
| 167 | + | } | |
| 168 | + | ||
| 169 | + | // Requests the user's screen reader to announce the given message. | |
| 170 | + | // | |
| 171 | + | // This kind of notification is useful for messages that | |
| 172 | + | // either have only a visual representation or that are not | |
| 173 | + | // exposed visually at all, e.g. a notification about a | |
| 174 | + | // successful operation. | |
| 175 | + | // | |
| 176 | + | // Also, by using this API, you can ensure that the message | |
| 177 | + | // does not interrupts the user's current screen reader output. | |
| 178 | + | func (x *ShortcutsDialog) Announce(MessageVar string, PriorityVar gtk.AccessibleAnnouncementPriority) { | |
| 179 | + | ||
| 180 | + | gtk.XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar) | |
| 181 | + | ||
| 182 | + | } | |
| 183 | + | ||
| 184 | + | // Retrieves the accessible parent for an accessible object. | |
| 185 | + | // | |
| 186 | + | // This function returns `NULL` for top level widgets. | |
| 187 | + | func (x *ShortcutsDialog) GetAccessibleParent() *gtk.AccessibleBase { | |
| 188 | + | var cls *gtk.AccessibleBase | |
| 189 | + | ||
| 190 | + | cret := gtk.XGtkAccessibleGetAccessibleParent(x.GoPointer()) | |
| 191 | + | ||
| 192 | + | if cret == 0 { | |
| 193 | + | return nil | |
| 194 | + | } | |
| 195 | + | cls = >k.AccessibleBase{} | |
| 196 | + | cls.Ptr = cret | |
| 197 | + | return cls | |
| 198 | + | } | |
| 199 | + | ||
| 200 | + | // Retrieves the accessible role of an accessible object. | |
| 201 | + | func (x *ShortcutsDialog) GetAccessibleRole() gtk.AccessibleRole { | |
| 202 | + | ||
| 203 | + | cret := gtk.XGtkAccessibleGetAccessibleRole(x.GoPointer()) | |
| 204 | + | return cret | |
| 205 | + | } | |
| 206 | + | ||
| 207 | + | // Retrieves the implementation for the given accessible object. | |
| 208 | + | func (x *ShortcutsDialog) GetAtContext() *gtk.ATContext { | |
| 209 | + | var cls *gtk.ATContext | |
| 210 | + | ||
| 211 | + | cret := gtk.XGtkAccessibleGetAtContext(x.GoPointer()) | |
| 212 | + | ||
| 213 | + | if cret == 0 { | |
| 214 | + | return nil | |
| 215 | + | } | |
| 216 | + | cls = >k.ATContext{} | |
| 217 | + | cls.Ptr = cret | |
| 218 | + | return cls | |
| 219 | + | } | |
| 220 | + | ||
| 221 | + | // Queries the coordinates and dimensions of this accessible | |
| 222 | + | // | |
| 223 | + | // This functionality can be overridden by `GtkAccessible` | |
| 224 | + | // implementations, e.g. to get the bounds from an ignored | |
| 225 | + | // child widget. | |
| 226 | + | func (x *ShortcutsDialog) GetBounds(XVar int, YVar int, WidthVar int, HeightVar int) bool { | |
| 227 | + | ||
| 228 | + | cret := gtk.XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar) | |
| 229 | + | return cret | |
| 230 | + | } | |
| 231 | + | ||
| 232 | + | // Retrieves the first accessible child of an accessible object. | |
| 233 | + | func (x *ShortcutsDialog) GetFirstAccessibleChild() *gtk.AccessibleBase { | |
| 234 | + | var cls *gtk.AccessibleBase | |
| 235 | + | ||
| 236 | + | cret := gtk.XGtkAccessibleGetFirstAccessibleChild(x.GoPointer()) | |
| 237 | + | ||
| 238 | + | if cret == 0 { | |
| 239 | + | return nil | |
| 240 | + | } | |
| 241 | + | cls = >k.AccessibleBase{} | |
| 242 | + | cls.Ptr = cret | |
| 243 | + | return cls | |
| 244 | + | } | |
| 245 | + | ||
| 246 | + | // Retrieves the next accessible sibling of an accessible object | |
| 247 | + | func (x *ShortcutsDialog) GetNextAccessibleSibling() *gtk.AccessibleBase { | |
| 248 | + | var cls *gtk.AccessibleBase | |
| 249 | + | ||
| 250 | + | cret := gtk.XGtkAccessibleGetNextAccessibleSibling(x.GoPointer()) | |
| 251 | + | ||
| 252 | + | if cret == 0 { | |
| 253 | + | return nil | |
| 254 | + | } | |
| 255 | + | cls = >k.AccessibleBase{} | |
| 256 | + | cls.Ptr = cret | |
| 257 | + | return cls | |
| 258 | + | } | |
| 259 | + | ||
| 260 | + | // Queries a platform state, such as focus. | |
| 261 | + | // | |
| 262 | + | // This functionality can be overridden by `GtkAccessible` | |
| 263 | + | // implementations, e.g. to get platform state from an ignored | |
| 264 | + | // child widget, as is the case for `GtkText` wrappers. | |
| 265 | + | func (x *ShortcutsDialog) GetPlatformState(StateVar gtk.AccessiblePlatformState) bool { | |
| 266 | + | ||
| 267 | + | cret := gtk.XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar) | |
| 268 | + | return cret | |
| 269 | + | } | |
| 270 | + | ||
| 271 | + | // Resets the accessible property to its default value. | |
| 272 | + | func (x *ShortcutsDialog) ResetProperty(PropertyVar gtk.AccessibleProperty) { | |
| 273 | + | ||
| 274 | + | gtk.XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar) | |
| 275 | + | ||
| 276 | + | } | |
| 277 | + | ||
| 278 | + | // Resets the accessible relation to its default value. | |
| 279 | + | func (x *ShortcutsDialog) ResetRelation(RelationVar gtk.AccessibleRelation) { | |
| 280 | + | ||
| 281 | + | gtk.XGtkAccessibleResetRelation(x.GoPointer(), RelationVar) | |
| 282 | + | ||
| 283 | + | } | |
| 284 | + | ||
| 285 | + | // Resets the accessible state to its default value. | |
| 286 | + | func (x *ShortcutsDialog) ResetState(StateVar gtk.AccessibleState) { | |
| 287 | + | ||
| 288 | + | gtk.XGtkAccessibleResetState(x.GoPointer(), StateVar) | |
| 289 | + | ||
| 290 | + | } | |
| 291 | + | ||
| 292 | + | // Sets the parent and sibling of an accessible object. | |
| 293 | + | // | |
| 294 | + | // This function is meant to be used by accessible implementations that are | |
| 295 | + | // not part of the widget hierarchy, and but act as a logical bridge between | |
| 296 | + | // widgets. For instance, if a widget creates an object that holds metadata | |
| 297 | + | // for each child, and you want that object to implement the `GtkAccessible` | |
| 298 | + | // interface, you will use this function to ensure that the parent of each | |
| 299 | + | // child widget is the metadata object, and the parent of each metadata | |
| 300 | + | // object is the container widget. | |
| 301 | + | func (x *ShortcutsDialog) SetAccessibleParent(ParentVar gtk.Accessible, NextSiblingVar gtk.Accessible) { | |
| 302 | + | ||
| 303 | + | gtk.XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer()) | |
| 304 | + | ||
| 305 | + | } | |
| 306 | + | ||
| 307 | + | // Updates the next accessible sibling. | |
| 308 | + | // | |
| 309 | + | // That might be useful when a new child of a custom accessible | |
| 310 | + | // is created, and it needs to be linked to a previous child. | |
| 311 | + | func (x *ShortcutsDialog) UpdateNextAccessibleSibling(NewSiblingVar gtk.Accessible) { | |
| 312 | + | ||
| 313 | + | gtk.XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer()) | |
| 314 | + | ||
| 315 | + | } | |
| 316 | + | ||
| 317 | + | // Informs ATs that the platform state has changed. | |
| 318 | + | // | |
| 319 | + | // This function should be used by `GtkAccessible` implementations that | |
| 320 | + | // have a platform state but are not widgets. Widgets handle platform | |
| 321 | + | // states automatically. | |
| 322 | + | func (x *ShortcutsDialog) UpdatePlatformState(StateVar gtk.AccessiblePlatformState) { | |
| 323 | + | ||
| 324 | + | gtk.XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar) | |
| 325 | + | ||
| 326 | + | } | |
| 327 | + | ||
| 328 | + | // Updates a list of accessible properties. | |
| 329 | + | // | |
| 330 | + | // See the [enum@Gtk.AccessibleProperty] documentation for the | |
| 331 | + | // value types of accessible properties. | |
| 332 | + | // | |
| 333 | + | // This function should be called by `GtkWidget` types whenever | |
| 334 | + | // an accessible property change must be communicated to assistive | |
| 335 | + | // technologies. | |
| 336 | + | // | |
| 337 | + | // Example: | |
| 338 | + | // ```c | |
| 339 | + | // value = gtk_adjustment_get_value (adjustment); | |
| 340 | + | // gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button), | |
| 341 | + | // | |
| 342 | + | // GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value, | |
| 343 | + | // -1); | |
| 344 | + | // | |
| 345 | + | // ``` | |
| 346 | + | func (x *ShortcutsDialog) UpdateProperty(FirstPropertyVar gtk.AccessibleProperty, varArgs ...interface{}) { | |
| 347 | + | ||
| 348 | + | gtk.XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...) | |
| 349 | + | ||
| 350 | + | } | |
| 351 | + | ||
| 352 | + | // Updates an array of accessible properties. | |
| 353 | + | // | |
| 354 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 355 | + | // property change must be communicated to assistive technologies. | |
| 356 | + | // | |
| 357 | + | // This function is meant to be used by language bindings. | |
| 358 | + | func (x *ShortcutsDialog) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []gtk.AccessibleProperty, ValuesVar []gobject.Value) { | |
| 359 | + | ||
| 360 | + | gtk.XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar) | |
| 361 | + | ||
| 362 | + | } | |
| 363 | + | ||
| 364 | + | // Updates a list of accessible relations. | |
| 365 | + | // | |
| 366 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 367 | + | // relation change must be communicated to assistive technologies. | |
| 368 | + | // | |
| 369 | + | // If the [enum@Gtk.AccessibleRelation] requires a list of references, | |
| 370 | + | // you should pass each reference individually, followed by `NULL`, e.g. | |
| 371 | + | // | |
| 372 | + | // ```c | |
| 373 | + | // gtk_accessible_update_relation (accessible, | |
| 374 | + | // | |
| 375 | + | // GTK_ACCESSIBLE_RELATION_CONTROLS, | |
| 376 | + | // ref1, NULL, | |
| 377 | + | // GTK_ACCESSIBLE_RELATION_LABELLED_BY, | |
| 378 | + | // ref1, ref2, ref3, NULL, | |
| 379 | + | // -1); | |
| 380 | + | // | |
| 381 | + | // ``` | |
| 382 | + | func (x *ShortcutsDialog) UpdateRelation(FirstRelationVar gtk.AccessibleRelation, varArgs ...interface{}) { | |
| 383 | + | ||
| 384 | + | gtk.XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...) | |
| 385 | + | ||
| 386 | + | } | |
| 387 | + | ||
| 388 | + | // Updates an array of accessible relations. | |
| 389 | + | // | |
| 390 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 391 | + | // relation change must be communicated to assistive technologies. | |
| 392 | + | // | |
| 393 | + | // This function is meant to be used by language bindings. | |
| 394 | + | func (x *ShortcutsDialog) UpdateRelationValue(NRelationsVar int, RelationsVar []gtk.AccessibleRelation, ValuesVar []gobject.Value) { | |
| 395 | + | ||
| 396 | + | gtk.XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar) | |
| 397 | + | ||
| 398 | + | } | |
| 399 | + | ||
| 400 | + | // Updates a list of accessible states. | |
| 401 | + | // | |
| 402 | + | // See the [enum@Gtk.AccessibleState] documentation for the | |
| 403 | + | // value types of accessible states. | |
| 404 | + | // | |
| 405 | + | // This function should be called by `GtkWidget` types whenever | |
| 406 | + | // an accessible state change must be communicated to assistive | |
| 407 | + | // technologies. | |
| 408 | + | // | |
| 409 | + | // Example: | |
| 410 | + | // | |
| 411 | + | // ```c | |
| 412 | + | // value = GTK_ACCESSIBLE_TRISTATE_MIXED; | |
| 413 | + | // gtk_accessible_update_state (GTK_ACCESSIBLE (check_button), | |
| 414 | + | // | |
| 415 | + | // GTK_ACCESSIBLE_STATE_CHECKED, value, | |
| 416 | + | // -1); | |
| 417 | + | // | |
| 418 | + | // ``` | |
| 419 | + | func (x *ShortcutsDialog) UpdateState(FirstStateVar gtk.AccessibleState, varArgs ...interface{}) { | |
| 420 | + | ||
| 421 | + | gtk.XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...) | |
| 422 | + | ||
| 423 | + | } | |
| 424 | + | ||
| 425 | + | // Updates an array of accessible states. | |
| 426 | + | // | |
| 427 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 428 | + | // state change must be communicated to assistive technologies. | |
| 429 | + | // | |
| 430 | + | // This function is meant to be used by language bindings. | |
| 431 | + | func (x *ShortcutsDialog) UpdateStateValue(NStatesVar int, StatesVar []gtk.AccessibleState, ValuesVar []gobject.Value) { | |
| 432 | + | ||
| 433 | + | gtk.XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar) | |
| 434 | + | ||
| 435 | + | } | |
| 436 | + | ||
| 437 | + | // Gets the ID of the @buildable object. | |
| 438 | + | // | |
| 439 | + | // `GtkBuilder` sets the name based on the ID attribute | |
| 440 | + | // of the `<object>` tag used to construct the @buildable. | |
| 441 | + | func (x *ShortcutsDialog) GetBuildableId() string { | |
| 442 | + | ||
| 443 | + | cret := gtk.XGtkBuildableGetBuildableId(x.GoPointer()) | |
| 444 | + | return cret | |
| 445 | + | } | |
| 446 | + | ||
| 447 | + | func init() { | |
| 448 | + | core.SetPackageName("ADW", "libadwaita-1") | |
| 449 | + | core.SetSharedLibraries("ADW", []string{"libadwaita-1.so.0"}) | |
| 450 | + | var libs []uintptr | |
| 451 | + | for _, libPath := range core.GetPaths("ADW") { | |
| 452 | + | lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) | |
| 453 | + | if err != nil { | |
| 454 | + | panic(err) | |
| 455 | + | } | |
| 456 | + | libs = append(libs, lib) | |
| 457 | + | } | |
| 458 | + | ||
| 459 | + | core.PuregoSafeRegister(&xShortcutsDialogGLibType, libs, "adw_shortcuts_dialog_get_type") | |
| 460 | + | ||
| 461 | + | core.PuregoSafeRegister(&xNewShortcutsDialog, libs, "adw_shortcuts_dialog_new") | |
| 462 | + | ||
| 463 | + | core.PuregoSafeRegister(&xShortcutsDialogAdd, libs, "adw_shortcuts_dialog_add") | |
| 464 | + | ||
| 465 | + | } | |
A v4/adw/adw-shortcuts-item.go +223 -0
| @@ -0,0 +1,223 @@ | |||
| 1 | + | // Package adw was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT | |
| 2 | + | package adw | |
| 3 | + | ||
| 4 | + | import ( | |
| 5 | + | "structs" | |
| 6 | + | "unsafe" | |
| 7 | + | ||
| 8 | + | "github.com/jwijenbergh/purego" | |
| 9 | + | "github.com/jwijenbergh/puregotk/pkg/core" | |
| 10 | + | "github.com/jwijenbergh/puregotk/v4/gobject" | |
| 11 | + | "github.com/jwijenbergh/puregotk/v4/gobject/types" | |
| 12 | + | "github.com/jwijenbergh/puregotk/v4/gtk" | |
| 13 | + | ) | |
| 14 | + | ||
| 15 | + | type ShortcutsItemClass struct { | |
| 16 | + | _ structs.HostLayout | |
| 17 | + | ||
| 18 | + | ParentClass gobject.ObjectClass | |
| 19 | + | } | |
| 20 | + | ||
| 21 | + | func (x *ShortcutsItemClass) GoPointer() uintptr { | |
| 22 | + | return uintptr(unsafe.Pointer(x)) | |
| 23 | + | } | |
| 24 | + | ||
| 25 | + | // An object representing an individual shortcut in [class@ShortcutsSection]. | |
| 26 | + | // | |
| 27 | + | // A shortcut has a title, an optional subtitle, and an accelerator. | |
| 28 | + | // | |
| 29 | + | // Accelerator must be specified in the format [class@ShortcutLabel] accepts. | |
| 30 | + | // | |
| 31 | + | // Alternatively, the [property@ShortcutsItem:action-name] property can be used | |
| 32 | + | // to automatically get accelerator associated with the specified action, as set | |
| 33 | + | // via [method@Gtk.Application.set_accels_for_action]. | |
| 34 | + | // | |
| 35 | + | // If both are specified, the accelerator will be used if the action couldn't | |
| 36 | + | // be found or doesn't have an accelerator associated for it. | |
| 37 | + | // | |
| 38 | + | // If [property@ShortcutsItem:direction] is set, the shortcut will only be | |
| 39 | + | // displayed for the specified text direction. This allows to display different | |
| 40 | + | // shortcuts for different text directions. | |
| 41 | + | type ShortcutsItem struct { | |
| 42 | + | gobject.Object | |
| 43 | + | } | |
| 44 | + | ||
| 45 | + | var xShortcutsItemGLibType func() types.GType | |
| 46 | + | ||
| 47 | + | func ShortcutsItemGLibType() types.GType { | |
| 48 | + | return xShortcutsItemGLibType() | |
| 49 | + | } | |
| 50 | + | ||
| 51 | + | func ShortcutsItemNewFromInternalPtr(ptr uintptr) *ShortcutsItem { | |
| 52 | + | cls := &ShortcutsItem{} | |
| 53 | + | cls.Ptr = ptr | |
| 54 | + | return cls | |
| 55 | + | } | |
| 56 | + | ||
| 57 | + | var xNewShortcutsItem func(string, string) uintptr | |
| 58 | + | ||
| 59 | + | // Creates a new `AdwShortcutsItem` with @title and @accelerator. | |
| 60 | + | func NewShortcutsItem(TitleVar string, AcceleratorVar string) *ShortcutsItem { | |
| 61 | + | var cls *ShortcutsItem | |
| 62 | + | ||
| 63 | + | cret := xNewShortcutsItem(TitleVar, AcceleratorVar) | |
| 64 | + | ||
| 65 | + | if cret == 0 { | |
| 66 | + | return nil | |
| 67 | + | } | |
| 68 | + | cls = &ShortcutsItem{} | |
| 69 | + | cls.Ptr = cret | |
| 70 | + | return cls | |
| 71 | + | } | |
| 72 | + | ||
| 73 | + | var xNewShortcutsItemFromAction func(string, string) uintptr | |
| 74 | + | ||
| 75 | + | // Creates a new `AdwShortcutsItem` with @title and @action_name. | |
| 76 | + | func NewShortcutsItemFromAction(TitleVar string, ActionNameVar string) *ShortcutsItem { | |
| 77 | + | var cls *ShortcutsItem | |
| 78 | + | ||
| 79 | + | cret := xNewShortcutsItemFromAction(TitleVar, ActionNameVar) | |
| 80 | + | ||
| 81 | + | if cret == 0 { | |
| 82 | + | return nil | |
| 83 | + | } | |
| 84 | + | cls = &ShortcutsItem{} | |
| 85 | + | cls.Ptr = cret | |
| 86 | + | return cls | |
| 87 | + | } | |
| 88 | + | ||
| 89 | + | var xShortcutsItemGetAccelerator func(uintptr) string | |
| 90 | + | ||
| 91 | + | // Gets the accelerator of @self. | |
| 92 | + | func (x *ShortcutsItem) GetAccelerator() string { | |
| 93 | + | ||
| 94 | + | cret := xShortcutsItemGetAccelerator(x.GoPointer()) | |
| 95 | + | return cret | |
| 96 | + | } | |
| 97 | + | ||
| 98 | + | var xShortcutsItemGetActionName func(uintptr) string | |
| 99 | + | ||
| 100 | + | // Gets the action name to get the accelerator from. | |
| 101 | + | func (x *ShortcutsItem) GetActionName() string { | |
| 102 | + | ||
| 103 | + | cret := xShortcutsItemGetActionName(x.GoPointer()) | |
| 104 | + | return cret | |
| 105 | + | } | |
| 106 | + | ||
| 107 | + | var xShortcutsItemGetDirection func(uintptr) gtk.TextDirection | |
| 108 | + | ||
| 109 | + | // Gets the direction of @self. | |
| 110 | + | func (x *ShortcutsItem) GetDirection() gtk.TextDirection { | |
| 111 | + | ||
| 112 | + | cret := xShortcutsItemGetDirection(x.GoPointer()) | |
| 113 | + | return cret | |
| 114 | + | } | |
| 115 | + | ||
| 116 | + | var xShortcutsItemGetSubtitle func(uintptr) string | |
| 117 | + | ||
| 118 | + | // Gets the subtitle of @self. | |
| 119 | + | func (x *ShortcutsItem) GetSubtitle() string { | |
| 120 | + | ||
| 121 | + | cret := xShortcutsItemGetSubtitle(x.GoPointer()) | |
| 122 | + | return cret | |
| 123 | + | } | |
| 124 | + | ||
| 125 | + | var xShortcutsItemGetTitle func(uintptr) string | |
| 126 | + | ||
| 127 | + | // Gets the title of @self. | |
| 128 | + | func (x *ShortcutsItem) GetTitle() string { | |
| 129 | + | ||
| 130 | + | cret := xShortcutsItemGetTitle(x.GoPointer()) | |
| 131 | + | return cret | |
| 132 | + | } | |
| 133 | + | ||
| 134 | + | var xShortcutsItemSetAccelerator func(uintptr, string) | |
| 135 | + | ||
| 136 | + | // Sets the accelerator of @self. | |
| 137 | + | // | |
| 138 | + | // @accelerator must be in the format [class@ShortcutLabel] accepts. | |
| 139 | + | func (x *ShortcutsItem) SetAccelerator(AcceleratorVar string) { | |
| 140 | + | ||
| 141 | + | xShortcutsItemSetAccelerator(x.GoPointer(), AcceleratorVar) | |
| 142 | + | ||
| 143 | + | } | |
| 144 | + | ||
| 145 | + | var xShortcutsItemSetActionName func(uintptr, string) | |
| 146 | + | ||
| 147 | + | // Sets the action name to get the accelerator from. | |
| 148 | + | func (x *ShortcutsItem) SetActionName(ActionNameVar string) { | |
| 149 | + | ||
| 150 | + | xShortcutsItemSetActionName(x.GoPointer(), ActionNameVar) | |
| 151 | + | ||
| 152 | + | } | |
| 153 | + | ||
| 154 | + | var xShortcutsItemSetDirection func(uintptr, gtk.TextDirection) | |
| 155 | + | ||
| 156 | + | // Sets the direction of @self. | |
| 157 | + | // | |
| 158 | + | // If set to [enum@Gtk.TextDirection.LTR] or [enum@Gtk.TextDirection.RTL], the | |
| 159 | + | // shortcut will only be displayed for this direction. | |
| 160 | + | func (x *ShortcutsItem) SetDirection(DirectionVar gtk.TextDirection) { | |
| 161 | + | ||
| 162 | + | xShortcutsItemSetDirection(x.GoPointer(), DirectionVar) | |
| 163 | + | ||
| 164 | + | } | |
| 165 | + | ||
| 166 | + | var xShortcutsItemSetSubtitle func(uintptr, string) | |
| 167 | + | ||
| 168 | + | // Sets the subtitle of @self. | |
| 169 | + | func (x *ShortcutsItem) SetSubtitle(SubtitleVar string) { | |
| 170 | + | ||
| 171 | + | xShortcutsItemSetSubtitle(x.GoPointer(), SubtitleVar) | |
| 172 | + | ||
| 173 | + | } | |
| 174 | + | ||
| 175 | + | var xShortcutsItemSetTitle func(uintptr, string) | |
| 176 | + | ||
| 177 | + | // Sets the title of @self. | |
| 178 | + | func (x *ShortcutsItem) SetTitle(TitleVar string) { | |
| 179 | + | ||
| 180 | + | xShortcutsItemSetTitle(x.GoPointer(), TitleVar) | |
| 181 | + | ||
| 182 | + | } | |
| 183 | + | ||
| 184 | + | func (c *ShortcutsItem) GoPointer() uintptr { | |
| 185 | + | if c == nil { | |
| 186 | + | return 0 | |
| 187 | + | } | |
| 188 | + | return c.Ptr | |
| 189 | + | } | |
| 190 | + | ||
| 191 | + | func (c *ShortcutsItem) SetGoPointer(ptr uintptr) { | |
| 192 | + | c.Ptr = ptr | |
| 193 | + | } | |
| 194 | + | ||
| 195 | + | func init() { | |
| 196 | + | core.SetPackageName("ADW", "libadwaita-1") | |
| 197 | + | core.SetSharedLibraries("ADW", []string{"libadwaita-1.so.0"}) | |
| 198 | + | var libs []uintptr | |
| 199 | + | for _, libPath := range core.GetPaths("ADW") { | |
| 200 | + | lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) | |
| 201 | + | if err != nil { | |
| 202 | + | panic(err) | |
| 203 | + | } | |
| 204 | + | libs = append(libs, lib) | |
| 205 | + | } | |
| 206 | + | ||
| 207 | + | core.PuregoSafeRegister(&xShortcutsItemGLibType, libs, "adw_shortcuts_item_get_type") | |
| 208 | + | ||
| 209 | + | core.PuregoSafeRegister(&xNewShortcutsItem, libs, "adw_shortcuts_item_new") | |
| 210 | + | core.PuregoSafeRegister(&xNewShortcutsItemFromAction, libs, "adw_shortcuts_item_new_from_action") | |
| 211 | + | ||
| 212 | + | core.PuregoSafeRegister(&xShortcutsItemGetAccelerator, libs, "adw_shortcuts_item_get_accelerator") | |
| 213 | + | core.PuregoSafeRegister(&xShortcutsItemGetActionName, libs, "adw_shortcuts_item_get_action_name") | |
| 214 | + | core.PuregoSafeRegister(&xShortcutsItemGetDirection, libs, "adw_shortcuts_item_get_direction") | |
| 215 | + | core.PuregoSafeRegister(&xShortcutsItemGetSubtitle, libs, "adw_shortcuts_item_get_subtitle") | |
| 216 | + | core.PuregoSafeRegister(&xShortcutsItemGetTitle, libs, "adw_shortcuts_item_get_title") | |
| 217 | + | core.PuregoSafeRegister(&xShortcutsItemSetAccelerator, libs, "adw_shortcuts_item_set_accelerator") | |
| 218 | + | core.PuregoSafeRegister(&xShortcutsItemSetActionName, libs, "adw_shortcuts_item_set_action_name") | |
| 219 | + | core.PuregoSafeRegister(&xShortcutsItemSetDirection, libs, "adw_shortcuts_item_set_direction") | |
| 220 | + | core.PuregoSafeRegister(&xShortcutsItemSetSubtitle, libs, "adw_shortcuts_item_set_subtitle") | |
| 221 | + | core.PuregoSafeRegister(&xShortcutsItemSetTitle, libs, "adw_shortcuts_item_set_title") | |
| 222 | + | ||
| 223 | + | } | |
A v4/adw/adw-shortcuts-section.go +228 -0
| @@ -0,0 +1,228 @@ | |||
| 1 | + | // Package adw was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT | |
| 2 | + | package adw | |
| 3 | + | ||
| 4 | + | import ( | |
| 5 | + | "structs" | |
| 6 | + | "unsafe" | |
| 7 | + | ||
| 8 | + | "github.com/jwijenbergh/purego" | |
| 9 | + | "github.com/jwijenbergh/puregotk/pkg/core" | |
| 10 | + | "github.com/jwijenbergh/puregotk/v4/gio" | |
| 11 | + | "github.com/jwijenbergh/puregotk/v4/gobject" | |
| 12 | + | "github.com/jwijenbergh/puregotk/v4/gobject/types" | |
| 13 | + | "github.com/jwijenbergh/puregotk/v4/gtk" | |
| 14 | + | ) | |
| 15 | + | ||
| 16 | + | type ShortcutsSectionClass struct { | |
| 17 | + | _ structs.HostLayout | |
| 18 | + | ||
| 19 | + | ParentClass gobject.ObjectClass | |
| 20 | + | } | |
| 21 | + | ||
| 22 | + | func (x *ShortcutsSectionClass) GoPointer() uintptr { | |
| 23 | + | return uintptr(unsafe.Pointer(x)) | |
| 24 | + | } | |
| 25 | + | ||
| 26 | + | // An object representing a section in [class@ShortcutsDialog]. | |
| 27 | + | // | |
| 28 | + | // It contains [class@ShortcutsItem] objects, use [method@ShortcutsSection.add] to | |
| 29 | + | // add them. | |
| 30 | + | // | |
| 31 | + | // `AdwShortcutsSection` implements the [iface@Gio.ListModel] interface and | |
| 32 | + | // allows to access the added shortcut items through it. | |
| 33 | + | // | |
| 34 | + | // ## `AdwShortcutsSection` as `GtkBuildable` | |
| 35 | + | // | |
| 36 | + | // `AdwShortcutsSection` allows adding `AdwShortcutsItem` objects as children. | |
| 37 | + | type ShortcutsSection struct { | |
| 38 | + | gobject.Object | |
| 39 | + | } | |
| 40 | + | ||
| 41 | + | var xShortcutsSectionGLibType func() types.GType | |
| 42 | + | ||
| 43 | + | func ShortcutsSectionGLibType() types.GType { | |
| 44 | + | return xShortcutsSectionGLibType() | |
| 45 | + | } | |
| 46 | + | ||
| 47 | + | func ShortcutsSectionNewFromInternalPtr(ptr uintptr) *ShortcutsSection { | |
| 48 | + | cls := &ShortcutsSection{} | |
| 49 | + | cls.Ptr = ptr | |
| 50 | + | return cls | |
| 51 | + | } | |
| 52 | + | ||
| 53 | + | var xNewShortcutsSection func(string) uintptr | |
| 54 | + | ||
| 55 | + | // Creates a new `AdwShortcutsSection` with @title as its title if provided. | |
| 56 | + | func NewShortcutsSection(TitleVar string) *ShortcutsSection { | |
| 57 | + | var cls *ShortcutsSection | |
| 58 | + | ||
| 59 | + | cret := xNewShortcutsSection(TitleVar) | |
| 60 | + | ||
| 61 | + | if cret == 0 { | |
| 62 | + | return nil | |
| 63 | + | } | |
| 64 | + | cls = &ShortcutsSection{} | |
| 65 | + | cls.Ptr = cret | |
| 66 | + | return cls | |
| 67 | + | } | |
| 68 | + | ||
| 69 | + | var xShortcutsSectionAdd func(uintptr, uintptr) | |
| 70 | + | ||
| 71 | + | // Adds @item to @self. | |
| 72 | + | func (x *ShortcutsSection) Add(ItemVar *ShortcutsItem) { | |
| 73 | + | ||
| 74 | + | xShortcutsSectionAdd(x.GoPointer(), ItemVar.GoPointer()) | |
| 75 | + | ||
| 76 | + | } | |
| 77 | + | ||
| 78 | + | var xShortcutsSectionGetTitle func(uintptr) string | |
| 79 | + | ||
| 80 | + | // Gets the title of @self. | |
| 81 | + | func (x *ShortcutsSection) GetTitle() string { | |
| 82 | + | ||
| 83 | + | cret := xShortcutsSectionGetTitle(x.GoPointer()) | |
| 84 | + | return cret | |
| 85 | + | } | |
| 86 | + | ||
| 87 | + | var xShortcutsSectionSetTitle func(uintptr, string) | |
| 88 | + | ||
| 89 | + | // Sets the title of @self. | |
| 90 | + | func (x *ShortcutsSection) SetTitle(TitleVar string) { | |
| 91 | + | ||
| 92 | + | xShortcutsSectionSetTitle(x.GoPointer(), TitleVar) | |
| 93 | + | ||
| 94 | + | } | |
| 95 | + | ||
| 96 | + | func (c *ShortcutsSection) GoPointer() uintptr { | |
| 97 | + | if c == nil { | |
| 98 | + | return 0 | |
| 99 | + | } | |
| 100 | + | return c.Ptr | |
| 101 | + | } | |
| 102 | + | ||
| 103 | + | func (c *ShortcutsSection) SetGoPointer(ptr uintptr) { | |
| 104 | + | c.Ptr = ptr | |
| 105 | + | } | |
| 106 | + | ||
| 107 | + | // Get the item at @position. | |
| 108 | + | // | |
| 109 | + | // If @position is greater than the number of items in @list, %NULL is | |
| 110 | + | // returned. | |
| 111 | + | // | |
| 112 | + | // %NULL is never returned for an index that is smaller than the length | |
| 113 | + | // of the list. | |
| 114 | + | // | |
| 115 | + | // See also: g_list_model_get_n_items() | |
| 116 | + | func (x *ShortcutsSection) GetItem(PositionVar uint) uintptr { | |
| 117 | + | ||
| 118 | + | cret := gio.XGListModelGetItem(x.GoPointer(), PositionVar) | |
| 119 | + | return cret | |
| 120 | + | } | |
| 121 | + | ||
| 122 | + | // Gets the type of the items in @list. | |
| 123 | + | // | |
| 124 | + | // All items returned from g_list_model_get_item() are of the type | |
| 125 | + | // returned by this function, or a subtype, or if the type is an | |
| 126 | + | // interface, they are an implementation of that interface. | |
| 127 | + | // | |
| 128 | + | // The item type of a #GListModel can not change during the life of the | |
| 129 | + | // model. | |
| 130 | + | func (x *ShortcutsSection) GetItemType() types.GType { | |
| 131 | + | ||
| 132 | + | cret := gio.XGListModelGetItemType(x.GoPointer()) | |
| 133 | + | return cret | |
| 134 | + | } | |
| 135 | + | ||
| 136 | + | // Gets the number of items in @list. | |
| 137 | + | // | |
| 138 | + | // Depending on the model implementation, calling this function may be | |
| 139 | + | // less efficient than iterating the list with increasing values for | |
| 140 | + | // @position until g_list_model_get_item() returns %NULL. | |
| 141 | + | func (x *ShortcutsSection) GetNItems() uint { | |
| 142 | + | ||
| 143 | + | cret := gio.XGListModelGetNItems(x.GoPointer()) | |
| 144 | + | return cret | |
| 145 | + | } | |
| 146 | + | ||
| 147 | + | // Get the item at @position. | |
| 148 | + | // | |
| 149 | + | // If @position is greater than the number of items in @list, %NULL is | |
| 150 | + | // returned. | |
| 151 | + | // | |
| 152 | + | // %NULL is never returned for an index that is smaller than the length | |
| 153 | + | // of the list. | |
| 154 | + | // | |
| 155 | + | // This function is meant to be used by language bindings in place | |
| 156 | + | // of g_list_model_get_item(). | |
| 157 | + | // | |
| 158 | + | // See also: g_list_model_get_n_items() | |
| 159 | + | func (x *ShortcutsSection) GetObject(PositionVar uint) *gobject.Object { | |
| 160 | + | var cls *gobject.Object | |
| 161 | + | ||
| 162 | + | cret := gio.XGListModelGetObject(x.GoPointer(), PositionVar) | |
| 163 | + | ||
| 164 | + | if cret == 0 { | |
| 165 | + | return nil | |
| 166 | + | } | |
| 167 | + | cls = &gobject.Object{} | |
| 168 | + | cls.Ptr = cret | |
| 169 | + | return cls | |
| 170 | + | } | |
| 171 | + | ||
| 172 | + | // Emits the #GListModel::items-changed signal on @list. | |
| 173 | + | // | |
| 174 | + | // This function should only be called by classes implementing | |
| 175 | + | // #GListModel. It has to be called after the internal representation | |
| 176 | + | // of @list has been updated, because handlers connected to this signal | |
| 177 | + | // might query the new state of the list. | |
| 178 | + | // | |
| 179 | + | // Implementations must only make changes to the model (as visible to | |
| 180 | + | // its consumer) in places that will not cause problems for that | |
| 181 | + | // consumer. For models that are driven directly by a write API (such | |
| 182 | + | // as #GListStore), changes can be reported in response to uses of that | |
| 183 | + | // API. For models that represent remote data, changes should only be | |
| 184 | + | // made from a fresh mainloop dispatch. It is particularly not | |
| 185 | + | // permitted to make changes in response to a call to the #GListModel | |
| 186 | + | // consumer API. | |
| 187 | + | // | |
| 188 | + | // Stated another way: in general, it is assumed that code making a | |
| 189 | + | // series of accesses to the model via the API, without returning to the | |
| 190 | + | // mainloop, and without calling other code, will continue to view the | |
| 191 | + | // same contents of the model. | |
| 192 | + | func (x *ShortcutsSection) ItemsChanged(PositionVar uint, RemovedVar uint, AddedVar uint) { | |
| 193 | + | ||
| 194 | + | gio.XGListModelItemsChanged(x.GoPointer(), PositionVar, RemovedVar, AddedVar) | |
| 195 | + | ||
| 196 | + | } | |
| 197 | + | ||
| 198 | + | // Gets the ID of the @buildable object. | |
| 199 | + | // | |
| 200 | + | // `GtkBuilder` sets the name based on the ID attribute | |
| 201 | + | // of the `<object>` tag used to construct the @buildable. | |
| 202 | + | func (x *ShortcutsSection) GetBuildableId() string { | |
| 203 | + | ||
| 204 | + | cret := gtk.XGtkBuildableGetBuildableId(x.GoPointer()) | |
| 205 | + | return cret | |
| 206 | + | } | |
| 207 | + | ||
| 208 | + | func init() { | |
| 209 | + | core.SetPackageName("ADW", "libadwaita-1") | |
| 210 | + | core.SetSharedLibraries("ADW", []string{"libadwaita-1.so.0"}) | |
| 211 | + | var libs []uintptr | |
| 212 | + | for _, libPath := range core.GetPaths("ADW") { | |
| 213 | + | lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) | |
| 214 | + | if err != nil { | |
| 215 | + | panic(err) | |
| 216 | + | } | |
| 217 | + | libs = append(libs, lib) | |
| 218 | + | } | |
| 219 | + | ||
| 220 | + | core.PuregoSafeRegister(&xShortcutsSectionGLibType, libs, "adw_shortcuts_section_get_type") | |
| 221 | + | ||
| 222 | + | core.PuregoSafeRegister(&xNewShortcutsSection, libs, "adw_shortcuts_section_new") | |
| 223 | + | ||
| 224 | + | core.PuregoSafeRegister(&xShortcutsSectionAdd, libs, "adw_shortcuts_section_add") | |
| 225 | + | core.PuregoSafeRegister(&xShortcutsSectionGetTitle, libs, "adw_shortcuts_section_get_title") | |
| 226 | + | core.PuregoSafeRegister(&xShortcutsSectionSetTitle, libs, "adw_shortcuts_section_set_title") | |
| 227 | + | ||
| 228 | + | } | |
M v4/adw/adw-style-manager.go +1 -1
| @@ -146,7 +146,7 @@ var xStyleManagerGetDocumentFontName func(uintptr) string | |||
| 146 | 146 | // Gets the system document font. | |
| 147 | 147 | // | |
| 148 | 148 | // The font is in the same format as [property@Gtk.Settings:gtk-font-name], | |
| 149 | - | // e.g. "Adwaita Sans 11". | |
| 149 | + | // e.g. "Adwaita Sans 12". | |
| 150 | 150 | // | |
| 151 | 151 | // Use [func@Pango.FontDescription.from_string] to parse it. | |
| 152 | 152 | func (x *StyleManager) GetDocumentFontName() string { | |
M v4/adw/adw-version.go +3 -3
| @@ -10,12 +10,12 @@ const ( | |||
| 10 | 10 | // Adwaita major version component (e.g. 1 if the version is 1.2.3). | |
| 11 | 11 | MAJOR_VERSION int = 1 | |
| 12 | 12 | // Adwaita micro version component (e.g. 3 if the version is 1.2.3). | |
| 13 | - | MICRO_VERSION int = 7 | |
| 13 | + | MICRO_VERSION int = 1 | |
| 14 | 14 | // Adwaita minor version component (e.g. 2 if the version is 1.2.3). | |
| 15 | - | MINOR_VERSION int = 7 | |
| 15 | + | MINOR_VERSION int = 8 | |
| 16 | 16 | // Adwaita version, encoded as a string, useful for printing and | |
| 17 | 17 | // concatenation. | |
| 18 | - | VERSION_S string = "1.7.7" | |
| 18 | + | VERSION_S string = "1.8.1" | |
| 19 | 19 | ) | |
| 20 | 20 | ||
| 21 | 21 | var xGetMajorVersion func() uint | |
M v4/adw/adw-wrap-box.go +10 -0
| @@ -275,6 +275,15 @@ func (x *WrapBox) Remove(ChildVar *gtk.Widget) { | |||
| 275 | 275 | ||
| 276 | 276 | } | |
| 277 | 277 | ||
| 278 | + | var xWrapBoxRemoveAll func(uintptr) | |
| 279 | + | ||
| 280 | + | // Removes all children from @self. | |
| 281 | + | func (x *WrapBox) RemoveAll() { | |
| 282 | + | ||
| 283 | + | xWrapBoxRemoveAll(x.GoPointer()) | |
| 284 | + | ||
| 285 | + | } | |
| 286 | + | ||
| 278 | 287 | var xWrapBoxReorderChildAfter func(uintptr, uintptr, uintptr) | |
| 279 | 288 | ||
| 280 | 289 | // Moves @child to the position after @sibling in the list of @self children. | |
| @@ -796,6 +805,7 @@ func init() { | |||
| 796 | 805 | core.PuregoSafeRegister(&xWrapBoxInsertChildAfter, libs, "adw_wrap_box_insert_child_after") | |
| 797 | 806 | core.PuregoSafeRegister(&xWrapBoxPrepend, libs, "adw_wrap_box_prepend") | |
| 798 | 807 | core.PuregoSafeRegister(&xWrapBoxRemove, libs, "adw_wrap_box_remove") | |
| 808 | + | core.PuregoSafeRegister(&xWrapBoxRemoveAll, libs, "adw_wrap_box_remove_all") | |
| 799 | 809 | core.PuregoSafeRegister(&xWrapBoxReorderChildAfter, libs, "adw_wrap_box_reorder_child_after") | |
| 800 | 810 | core.PuregoSafeRegister(&xWrapBoxSetAlign, libs, "adw_wrap_box_set_align") | |
| 801 | 811 | core.PuregoSafeRegister(&xWrapBoxSetChildSpacing, libs, "adw_wrap_box_set_child_spacing") | |
M v4/cairo/main.go +42 -0
| @@ -182,6 +182,44 @@ func (x *RectangleInt) GoPointer() uintptr { | |||
| 182 | 182 | return uintptr(unsafe.Pointer(x)) | |
| 183 | 183 | } | |
| 184 | 184 | ||
| 185 | + | type Glyph struct { | |
| 186 | + | _ structs.HostLayout | |
| 187 | + | ||
| 188 | + | Index uint32 | |
| 189 | + | ||
| 190 | + | X float64 | |
| 191 | + | ||
| 192 | + | Y float64 | |
| 193 | + | } | |
| 194 | + | ||
| 195 | + | var xGlyphGLibType func() types.GType | |
| 196 | + | ||
| 197 | + | func GlyphGLibType() types.GType { | |
| 198 | + | return xGlyphGLibType() | |
| 199 | + | } | |
| 200 | + | ||
| 201 | + | func (x *Glyph) GoPointer() uintptr { | |
| 202 | + | return uintptr(unsafe.Pointer(x)) | |
| 203 | + | } | |
| 204 | + | ||
| 205 | + | type TextCluster struct { | |
| 206 | + | _ structs.HostLayout | |
| 207 | + | ||
| 208 | + | NumBytes int | |
| 209 | + | ||
| 210 | + | NumGlyphs int | |
| 211 | + | } | |
| 212 | + | ||
| 213 | + | var xTextClusterGLibType func() types.GType | |
| 214 | + | ||
| 215 | + | func TextClusterGLibType() types.GType { | |
| 216 | + | return xTextClusterGLibType() | |
| 217 | + | } | |
| 218 | + | ||
| 219 | + | func (x *TextCluster) GoPointer() uintptr { | |
| 220 | + | return uintptr(unsafe.Pointer(x)) | |
| 221 | + | } | |
| 222 | + | ||
| 185 | 223 | type Status int | |
| 186 | 224 | ||
| 187 | 225 | var xStatusGLibType func() types.GType | |
| @@ -836,4 +874,8 @@ func init() { | |||
| 836 | 874 | ||
| 837 | 875 | core.PuregoSafeRegister(&xRectangleIntGLibType, libs, "cairo_gobject_rectangle_int_get_type") | |
| 838 | 876 | ||
| 877 | + | core.PuregoSafeRegister(&xGlyphGLibType, libs, "cairo_gobject_glyph_get_type") | |
| 878 | + | ||
| 879 | + | core.PuregoSafeRegister(&xTextClusterGLibType, libs, "cairo_gobject_text_cluster_get_type") | |
| 880 | + | ||
| 839 | 881 | } | |
M v4/gdk/gdkclipboard.go +1 -1
| @@ -245,7 +245,7 @@ var xClipboardSet func(uintptr, types.GType, ...interface{}) | |||
| 245 | 245 | // [func@GObject.signal_emit]. | |
| 246 | 246 | // | |
| 247 | 247 | // ```c | |
| 248 | - | // gdk_clipboard_set (clipboard, GTK_TYPE_STRING, "Hello World"); | |
| 248 | + | // gdk_clipboard_set (clipboard, G_TYPE_STRING, "Hello World"); | |
| 249 | 249 | // | |
| 250 | 250 | // gdk_clipboard_set (clipboard, GDK_TYPE_TEXTURE, some_texture); | |
| 251 | 251 | // ``` | |
M v4/gdk/gdkcontentdeserializer.go +4 -0
| @@ -46,6 +46,10 @@ func ContentDeserializeFinish(ResultVar gio.AsyncResult, ValueVar *gobject.Value | |||
| 46 | 46 | var xContentRegisterDeserializer func(string, types.GType, uintptr, uintptr, uintptr) | |
| 47 | 47 | ||
| 48 | 48 | // Registers a function to deserialize object of a given type. | |
| 49 | + | // | |
| 50 | + | // Since 4.20, when looking up a deserializer to use, GTK will | |
| 51 | + | // use the last registered deserializer for a given mime type, | |
| 52 | + | // so applications can override the built-in deserializers. | |
| 49 | 53 | func ContentRegisterDeserializer(MimeTypeVar string, TypeVar types.GType, DeserializeVar *ContentDeserializeFunc, DataVar uintptr, NotifyVar *glib.DestroyNotify) { | |
| 50 | 54 | ||
| 51 | 55 | xContentRegisterDeserializer(MimeTypeVar, TypeVar, glib.NewCallback(DeserializeVar), DataVar, glib.NewCallback(NotifyVar)) | |
M v4/gdk/gdkcontentserializer.go +4 -0
| @@ -20,6 +20,10 @@ type ContentSerializeFunc func(uintptr) | |||
| 20 | 20 | var xContentRegisterSerializer func(types.GType, string, uintptr, uintptr, uintptr) | |
| 21 | 21 | ||
| 22 | 22 | // Registers a function to serialize objects of a given type. | |
| 23 | + | // | |
| 24 | + | // Since 4.20, when looking up a serializer to use, GTK will | |
| 25 | + | // use the last registered serializer for a given mime type, | |
| 26 | + | // so applications can override the built-in serializers. | |
| 23 | 27 | func ContentRegisterSerializer(TypeVar types.GType, MimeTypeVar string, SerializeVar *ContentSerializeFunc, DataVar uintptr, NotifyVar *glib.DestroyNotify) { | |
| 24 | 28 | ||
| 25 | 29 | xContentRegisterSerializer(TypeVar, MimeTypeVar, glib.NewCallback(SerializeVar), DataVar, glib.NewCallback(NotifyVar)) | |
M v4/gdk/gdkdisplay.go +2 -0
| @@ -183,6 +183,8 @@ var xDisplayGetDmabufFormats func(uintptr) *DmabufFormats | |||
| 183 | 183 | // buffer formats with producers such as v4l, pipewire or GStreamer. | |
| 184 | 184 | // | |
| 185 | 185 | // To learn more about dma-bufs, see [class@Gdk.DmabufTextureBuilder]. | |
| 186 | + | // | |
| 187 | + | // This function is threadsafe. It can be called from any thread. | |
| 186 | 188 | func (x *Display) GetDmabufFormats() *DmabufFormats { | |
| 187 | 189 | ||
| 188 | 190 | cret := xDisplayGetDmabufFormats(x.GoPointer()) | |
M v4/gdk/gdkdrag.go +1 -1
| @@ -35,7 +35,7 @@ var xDragActionIsUnique func(DragAction) bool | |||
| 35 | 35 | // Checks if @action represents a single action or includes | |
| 36 | 36 | // multiple actions. | |
| 37 | 37 | // | |
| 38 | - | // When @action is 0 - ie no action was given, %TRUE | |
| 38 | + | // When @action is `GDK_ACTION_NONE` - ie no action was given, `TRUE` | |
| 39 | 39 | // is returned. | |
| 40 | 40 | func DragActionIsUnique(ActionVar DragAction) bool { | |
| 41 | 41 | ||
M v4/gdk/gdkdrop.go +7 -7
| @@ -13,8 +13,8 @@ import ( | |||
| 13 | 13 | // Represents the target of an ongoing DND operation. | |
| 14 | 14 | // | |
| 15 | 15 | // Possible drop sites get informed about the status of the ongoing drag | |
| 16 | - | // operation with events of type %GDK_DRAG_ENTER, %GDK_DRAG_LEAVE, | |
| 17 | - | // %GDK_DRAG_MOTION and %GDK_DROP_START. The `GdkDrop` object can be obtained | |
| 16 | + | // operation with events of type `GDK_DRAG_ENTER`, `GDK_DRAG_LEAVE`, | |
| 17 | + | // `GDK_DRAG_MOTION` and `GDK_DROP_START`. The `GdkDrop` object can be obtained | |
| 18 | 18 | // from these [class@Gdk.Event] types using [method@Gdk.DNDEvent.get_drop]. | |
| 19 | 19 | // | |
| 20 | 20 | // The actual data transfer is initiated from the target side via an async | |
| @@ -57,11 +57,11 @@ var xDropGetActions func(uintptr) DragAction | |||
| 57 | 57 | // Returns the possible actions for this `GdkDrop`. | |
| 58 | 58 | // | |
| 59 | 59 | // If this value contains multiple actions - i.e. | |
| 60 | - | // [func@Gdk.DragAction.is_unique] returns %FALSE for the result - | |
| 60 | + | // [func@Gdk.DragAction.is_unique] returns false for the result - | |
| 61 | 61 | // [method@Gdk.Drop.finish] must choose the action to use when | |
| 62 | 62 | // accepting the drop. This will only happen if you passed | |
| 63 | - | // %GDK_ACTION_ASK as one of the possible actions in | |
| 64 | - | // [method@Gdk.Drop.status]. %GDK_ACTION_ASK itself will not | |
| 63 | + | // `GDK_ACTION_ASK` as one of the possible actions in | |
| 64 | + | // [method@Gdk.Drop.status]. `GDK_ACTION_ASK` itself will not | |
| 65 | 65 | // be included in the actions returned by this function. | |
| 66 | 66 | // | |
| 67 | 67 | // This value may change over the lifetime of the [class@Gdk.Drop] | |
| @@ -113,7 +113,7 @@ var xDropGetDrag func(uintptr) uintptr | |||
| 113 | 113 | // If this is an in-app drag-and-drop operation, returns the `GdkDrag` | |
| 114 | 114 | // that corresponds to this drop. | |
| 115 | 115 | // | |
| 116 | - | // If it is not, %NULL is returned. | |
| 116 | + | // If it is not, `NULL` is returned. | |
| 117 | 117 | func (x *Drop) GetDrag() *Drag { | |
| 118 | 118 | var cls *Drag | |
| 119 | 119 | ||
| @@ -235,7 +235,7 @@ var xDropStatus func(uintptr, DragAction, DragAction) | |||
| 235 | 235 | // action to use when multiple actions are possible. | |
| 236 | 236 | // | |
| 237 | 237 | // This function should be called by drag destinations in response to | |
| 238 | - | // %GDK_DRAG_ENTER or %GDK_DRAG_MOTION events. If the destination does | |
| 238 | + | // `GDK_DRAG_ENTER` or `GDK_DRAG_MOTION` events. If the destination does | |
| 239 | 239 | // not yet know the exact actions it supports, it should set any possible | |
| 240 | 240 | // actions first and then later call this function again. | |
| 241 | 241 | func (x *Drop) Status(ActionsVar DragAction, PreferredVar DragAction) { | |
M v4/gdk/gdkenums.go +471 -1
| @@ -60,6 +60,8 @@ func DragActionGLibType() types.GType { | |||
| 60 | 60 | ||
| 61 | 61 | const ( | |
| 62 | 62 | ||
| 63 | + | // No action. | |
| 64 | + | ActionNoneValue DragAction = 0 | |
| 63 | 65 | // Copy the data. | |
| 64 | 66 | ActionCopyValue DragAction = 1 | |
| 65 | 67 | // Move the data, i.e. first copy it, then delete | |
| @@ -357,9 +359,477 @@ const ( | |||
| 357 | 359 | MemoryR8g8b8x8Value MemoryFormat = 31 | |
| 358 | 360 | // 4 bytes; for unused, blue, green, red. | |
| 359 | 361 | MemoryX8b8g8r8Value MemoryFormat = 32 | |
| 362 | + | // Multiplane format with 2 planes. | |
| 363 | + | // | |
| 364 | + | // The first plane contains the first channel, usually containing | |
| 365 | + | // luma values. | |
| 366 | + | // The second plane with interleaved chroma values, Cb followed by Cr. | |
| 367 | + | // Subsampled in both the X and Y direction. | |
| 368 | + | // | |
| 369 | + | // Commonly known by the fourcc "NV12". | |
| 370 | + | MemoryG8B8r8420Value MemoryFormat = 33 | |
| 371 | + | // Multiplane format with 2 planes. | |
| 372 | + | // | |
| 373 | + | // The first plane contains the first channel, usually containing | |
| 374 | + | // luma values. | |
| 375 | + | // The second plane with interleaved chroma values, Cr followed by Cb. | |
| 376 | + | // Subsampled in both the X and Y direction. | |
| 377 | + | // | |
| 378 | + | // Commonly known by the fourcc "NV21". | |
| 379 | + | MemoryG8R8b8420Value MemoryFormat = 34 | |
| 380 | + | // Multiplane format with 2 planes. | |
| 381 | + | // | |
| 382 | + | // The first plane contains the first channel, usually containing | |
| 383 | + | // luma values. | |
| 384 | + | // The second plane with interleaved chroma values, Cb followed by Cr. | |
| 385 | + | // Subsampled in the X direction. | |
| 386 | + | // | |
| 387 | + | // Commonly known by the fourcc "NV16". | |
| 388 | + | MemoryG8B8r8422Value MemoryFormat = 35 | |
| 389 | + | // Multiplane format with 2 planes. | |
| 390 | + | // | |
| 391 | + | // The first plane contains the first channel, usually containing | |
| 392 | + | // luma values. | |
| 393 | + | // The second plane with interleaved chroma values, Cr followed by Cb. | |
| 394 | + | // Subsampled in the X direction. | |
| 395 | + | // | |
| 396 | + | // Commonly known by the fourcc "NV61". | |
| 397 | + | MemoryG8R8b8422Value MemoryFormat = 36 | |
| 398 | + | // Multiplane format with 2 planes. | |
| 399 | + | // | |
| 400 | + | // The first plane contains the first channel, usually containing | |
| 401 | + | // luma values. | |
| 402 | + | // The second plane with interleaved chroma values, Cb followed by Cr. | |
| 403 | + | // This format is not subsampled. | |
| 404 | + | // | |
| 405 | + | // Commonly known by the fourcc "NV24". | |
| 406 | + | MemoryG8B8r8444Value MemoryFormat = 37 | |
| 407 | + | // Multiplane format with 2 planes. | |
| 408 | + | // | |
| 409 | + | // The first plane contains the first channel, usually containing | |
| 410 | + | // luma values. | |
| 411 | + | // The second plane with interleaved chroma values, Cr followed by Cb. | |
| 412 | + | // This format is not subsampled. | |
| 413 | + | // | |
| 414 | + | // Commonly known by the fourcc "NV42". | |
| 415 | + | MemoryG8R8b8444Value MemoryFormat = 38 | |
| 416 | + | // Multiplane format with 2 planes. | |
| 417 | + | // | |
| 418 | + | // Each channel is a 16 bit integer, but only the highest 10 bits are used. | |
| 419 | + | // | |
| 420 | + | // The first plane contains the first channel, usually containing | |
| 421 | + | // luma values. | |
| 422 | + | // The second plane with interleaved chroma values, Cr followed by Cb. | |
| 423 | + | // This format is not subsampled. | |
| 424 | + | // | |
| 425 | + | // Commonly known by the fourcc "P010". | |
| 426 | + | MemoryG10x6B10x6r10x6420Value MemoryFormat = 39 | |
| 427 | + | // Multiplane format with 2 planes. | |
| 428 | + | // | |
| 429 | + | // Each channel is a 16 bit integer, but only the highest 10 bits are used. | |
| 430 | + | // | |
| 431 | + | // The first plane contains the first channel, usually containing | |
| 432 | + | // luma values. | |
| 433 | + | // The second plane with interleaved chroma values, Cr followed by Cb. | |
| 434 | + | // This format is not subsampled. | |
| 435 | + | // | |
| 436 | + | // Commonly known by the fourcc "P012". | |
| 437 | + | MemoryG12x4B12x4r12x4420Value MemoryFormat = 40 | |
| 438 | + | // Multiplane format with 2 planes. | |
| 439 | + | // | |
| 440 | + | // Each channel is a 16 bit integer. | |
| 441 | + | // | |
| 442 | + | // The first plane contains the first channel, usually containing | |
| 443 | + | // luma values. | |
| 444 | + | // The second plane with interleaved chroma values, Cr followed by Cb. | |
| 445 | + | // This format is not subsampled. | |
| 446 | + | // | |
| 447 | + | // Commonly known by the fourcc "P016". | |
| 448 | + | MemoryG16B16r16420Value MemoryFormat = 41 | |
| 449 | + | // Multiplane format with 3 planes. | |
| 450 | + | // | |
| 451 | + | // Each channel is a 8 bit integer. | |
| 452 | + | // | |
| 453 | + | // The first plane usually contains the luma channel. It is mapped | |
| 454 | + | // into the 2nd channel. | |
| 455 | + | // | |
| 456 | + | // The second plane usually contains the first chroma chanel. | |
| 457 | + | // Subsampled in both the X and Y direction with 4:1 ratio. It is | |
| 458 | + | // mapped into the 3rd channel. | |
| 459 | + | // | |
| 460 | + | // The third plane usually contains the second chroma channel. | |
| 461 | + | // Subsampled in both the X and Y direction with 4:1 ratio. It is | |
| 462 | + | // mapped into the 1st channel. | |
| 463 | + | // | |
| 464 | + | // Commonly known by the fourcc "YUV410". | |
| 465 | + | MemoryG8B8R8410Value MemoryFormat = 42 | |
| 466 | + | // Multiplane format with 3 planes. | |
| 467 | + | // | |
| 468 | + | // Each channel is a 8 bit integer. | |
| 469 | + | // | |
| 470 | + | // The first plane usually contains the luma channel. It is mapped | |
| 471 | + | // into the 2nd channel. | |
| 472 | + | // | |
| 473 | + | // The second plane usually contains the second chroma chanel. | |
| 474 | + | // Subsampled in both the X and Y direction with 4:1 ratio. It is | |
| 475 | + | // mapped into the 1st channel. | |
| 476 | + | // | |
| 477 | + | // The third plane usually contains the first chroma channel. | |
| 478 | + | // Subsampled in both the X and Y direction with 4:1 ratio. It is | |
| 479 | + | // mapped into the 3rd channel. | |
| 480 | + | // | |
| 481 | + | // Commonly known by the fourcc "YVU410". | |
| 482 | + | MemoryG8R8B8410Value MemoryFormat = 43 | |
| 483 | + | // Multiplane format with 3 planes. | |
| 484 | + | // | |
| 485 | + | // Each channel is a 8 bit integer. | |
| 486 | + | // | |
| 487 | + | // The first plane usually contains the luma channel. It is mapped | |
| 488 | + | // into the 2nd channel. | |
| 489 | + | // | |
| 490 | + | // The second plane usually contains the first chroma chanel. | |
| 491 | + | // Subsampled in the X direction with 4:1 ratio. It is | |
| 492 | + | // mapped into the 3rd channel. | |
| 493 | + | // | |
| 494 | + | // The third plane usually contains the second chroma channel. | |
| 495 | + | // Subsampled in the X direction with 4:1 ratio. It is | |
| 496 | + | // mapped into the 1st channel. | |
| 497 | + | // | |
| 498 | + | // Commonly known by the fourcc "YUV411". | |
| 499 | + | MemoryG8B8R8411Value MemoryFormat = 44 | |
| 500 | + | // Multiplane format with 3 planes. | |
| 501 | + | // | |
| 502 | + | // Each channel is a 8 bit integer. | |
| 503 | + | // | |
| 504 | + | // The first plane usually contains the luma channel. It is mapped | |
| 505 | + | // into the 2nd channel. | |
| 506 | + | // | |
| 507 | + | // The second plane usually contains the second chroma chanel. | |
| 508 | + | // Subsampled in the X direction with 4:1 ratio. It is | |
| 509 | + | // mapped into the 1st channel. | |
| 510 | + | // | |
| 511 | + | // The third plane usually contains the first chroma channel. | |
| 512 | + | // Subsampled in the X direction with 4:1 ratio. It is | |
| 513 | + | // mapped into the 3rd channel. | |
| 514 | + | // | |
| 515 | + | // Commonly known by the fourcc "YVU411". | |
| 516 | + | MemoryG8R8B8411Value MemoryFormat = 45 | |
| 517 | + | // Multiplane format with 3 planes. | |
| 518 | + | // | |
| 519 | + | // Each channel is a 8 bit integer. | |
| 520 | + | // | |
| 521 | + | // The first plane usually contains the luma channel. It is mapped | |
| 522 | + | // into the 2nd channel. | |
| 523 | + | // | |
| 524 | + | // The second plane usually contains the first chroma chanel. | |
| 525 | + | // Subsampled in both the X and Y direction. It is mapped into the | |
| 526 | + | // 3rd channel. | |
| 527 | + | // | |
| 528 | + | // The third plane usually contains the second chroma channel. | |
| 529 | + | // Subsampled in both the X and Y direction. It is mapped into the | |
| 530 | + | // 1st channel. | |
| 531 | + | // | |
| 532 | + | // Commonly known by the fourcc "YUV420". | |
| 533 | + | MemoryG8B8R8420Value MemoryFormat = 46 | |
| 534 | + | // Multiplane format with 3 planes. | |
| 535 | + | // | |
| 536 | + | // Each channel is a 8 bit integer. | |
| 537 | + | // | |
| 538 | + | // The first plane usually contains the luma channel. It is mapped | |
| 539 | + | // into the 2nd channel. | |
| 540 | + | // | |
| 541 | + | // The second plane usually contains the second chroma chanel. | |
| 542 | + | // Subsampled in both the X and Y direction. It is mapped into the | |
| 543 | + | // 1st channel. | |
| 544 | + | // | |
| 545 | + | // The third plane usually contains the first chroma channel. | |
| 546 | + | // Subsampled in both the X and Y direction. It is mapped into the | |
| 547 | + | // 3rd channel. | |
| 548 | + | // | |
| 549 | + | // Commonly known by the fourcc "YVU420". | |
| 550 | + | MemoryG8R8B8420Value MemoryFormat = 47 | |
| 551 | + | // Multiplane format with 3 planes. | |
| 552 | + | // | |
| 553 | + | // Each channel is a 8 bit integer. | |
| 554 | + | // | |
| 555 | + | // The first plane usually contains the luma channel. It is mapped | |
| 556 | + | // into the 2nd channel. | |
| 557 | + | // | |
| 558 | + | // The second plane usually contains the first chroma chanel. | |
| 559 | + | // Subsampled in the X direction. It is mapped into the 3rd channel. | |
| 560 | + | // | |
| 561 | + | // The third plane usually contains the second chroma channel. | |
| 562 | + | // Subsampled in the X direction. It is mapped into the 1st channel. | |
| 563 | + | // | |
| 564 | + | // Commonly known by the fourcc "YUV422". | |
| 565 | + | MemoryG8B8R8422Value MemoryFormat = 48 | |
| 566 | + | // Multiplane format with 3 planes. | |
| 567 | + | // | |
| 568 | + | // Each channel is a 8 bit integer. | |
| 569 | + | // | |
| 570 | + | // The first plane usually contains the luma channel. It is mapped | |
| 571 | + | // into the 2nd channel. | |
| 572 | + | // | |
| 573 | + | // The second plane usually contains the second chroma chanel. | |
| 574 | + | // Subsampled in the X direction. It is mapped into the 1st channel. | |
| 575 | + | // | |
| 576 | + | // The third plane usually contains the first chroma channel. | |
| 577 | + | // Subsampled in the X direction. It is mapped into the 3rd channel. | |
| 578 | + | // | |
| 579 | + | // Commonly known by the fourcc "YVU422". | |
| 580 | + | MemoryG8R8B8422Value MemoryFormat = 49 | |
| 581 | + | // Multiplane format with 3 planes. | |
| 582 | + | // | |
| 583 | + | // Each channel is a 8 bit integer. | |
| 584 | + | // | |
| 585 | + | // The first plane usually contains the luma channel. It is mapped | |
| 586 | + | // into the 2nd channel. | |
| 587 | + | // | |
| 588 | + | // The second plane usually contains the first chroma chanel. It is | |
| 589 | + | // mapped into the 3rd channel. | |
| 590 | + | // | |
| 591 | + | // The third plane usually contains the second chroma channel. It is | |
| 592 | + | // mapped into the 1st channel. | |
| 593 | + | // | |
| 594 | + | // Commonly known by the fourcc "YUV444". | |
| 595 | + | MemoryG8B8R8444Value MemoryFormat = 50 | |
| 596 | + | // Multiplane format with 3 planes. | |
| 597 | + | // | |
| 598 | + | // Each channel is a 8 bit integer. | |
| 599 | + | // | |
| 600 | + | // The first plane usually contains the luma channel. It is mapped | |
| 601 | + | // into the 2nd channel. | |
| 602 | + | // | |
| 603 | + | // The second plane usually contains the second chroma chanel. | |
| 604 | + | // Subsampled in the X direction. It is mapped into the 1st channel. | |
| 605 | + | // | |
| 606 | + | // The third plane usually contains the first chroma channel. | |
| 607 | + | // Subsampled in the X direction. It is mapped into the 3rd channel. | |
| 608 | + | // | |
| 609 | + | // Commonly known by the fourcc "YVU444". | |
| 610 | + | MemoryG8R8B8444Value MemoryFormat = 51 | |
| 611 | + | // Packed format with subsampled channels. | |
| 612 | + | // | |
| 613 | + | // Each channel is a 8 bit integer. The red and blue/chroma channels | |
| 614 | + | // are subsampled and interleaved with the green/luma channel. | |
| 615 | + | // | |
| 616 | + | // Each block contains 2 pixels, so the width must be a multiple of | |
| 617 | + | // 2. | |
| 618 | + | // | |
| 619 | + | // Commonly known by the fourcc "YUYV". | |
| 620 | + | MemoryG8b8g8r8422Value MemoryFormat = 52 | |
| 621 | + | // Packed format with subsampled channels. | |
| 622 | + | // | |
| 623 | + | // Each channel is a 8 bit integer. The red and blue/chroma channels | |
| 624 | + | // are subsampled and interleaved with the green/luma channel. | |
| 625 | + | // | |
| 626 | + | // Each block contains 2 pixels, so the width must be a multiple of | |
| 627 | + | // 2. | |
| 628 | + | // | |
| 629 | + | // Commonly known by the fourcc "YVYU". | |
| 630 | + | MemoryG8r8g8b8422Value MemoryFormat = 53 | |
| 631 | + | // Packed format with subsampled channels. | |
| 632 | + | // | |
| 633 | + | // Each channel is a 8 bit integer. The red and blue/chroma channels | |
| 634 | + | // are subsampled and interleaved with the green/luma channel. | |
| 635 | + | // | |
| 636 | + | // Each block contains 2 pixels, so the width must be a multiple of | |
| 637 | + | // 2. | |
| 638 | + | // | |
| 639 | + | // Commonly known by the fourcc "VYUY". | |
| 640 | + | MemoryR8g8b8g8422Value MemoryFormat = 54 | |
| 641 | + | // Packed format with subsampled channels. | |
| 642 | + | // | |
| 643 | + | // Each channel is a 8 bit integer. The red and blue/chroma channels | |
| 644 | + | // are subsampled and interleaved with the green/luma channel. | |
| 645 | + | // | |
| 646 | + | // Each block contains 2 pixels, so the width must be a multiple of | |
| 647 | + | // 2. | |
| 648 | + | // | |
| 649 | + | // Commonly known by the fourcc "UYVY". | |
| 650 | + | MemoryB8g8r8g8422Value MemoryFormat = 55 | |
| 651 | + | // Multiplane format with 3 planes. | |
| 652 | + | // | |
| 653 | + | // Each channel is a 16 bit integer. | |
| 654 | + | // | |
| 655 | + | // Only the 10 lower bits are used. The remaining ones must be set to 0 by the | |
| 656 | + | // producer. | |
| 657 | + | // | |
| 658 | + | // The first plane usually contains the luma channel. It is mapped | |
| 659 | + | // into the 2nd channel. | |
| 660 | + | // | |
| 661 | + | // The second plane usually contains the first chroma chanel. | |
| 662 | + | // Subsampled in both the X and Y direction. It is mapped into the | |
| 663 | + | // 3rd channel. | |
| 664 | + | // | |
| 665 | + | // The third plane usually contains the second chroma channel. | |
| 666 | + | // Subsampled in both the X and Y direction. It is mapped into the | |
| 667 | + | // 1st channel. | |
| 668 | + | // | |
| 669 | + | // Commonly known by the fourcc "S010". | |
| 670 | + | MemoryX6g10X6b10X6r10420Value MemoryFormat = 56 | |
| 671 | + | // Multiplane format with 3 planes. | |
| 672 | + | // | |
| 673 | + | // Each channel is a 16 bit integer. | |
| 674 | + | // | |
| 675 | + | // Only the 10 lower bits are used. The remaining ones must be set to 0 by the | |
| 676 | + | // producer. | |
| 677 | + | // | |
| 678 | + | // The first plane usually contains the luma channel. It is mapped | |
| 679 | + | // into the 2nd channel. | |
| 680 | + | // | |
| 681 | + | // The second plane usually contains the first chroma chanel. | |
| 682 | + | // Subsampled in the X direction. It is mapped into the 3rd channel. | |
| 683 | + | // | |
| 684 | + | // The third plane usually contains the second chroma channel. | |
| 685 | + | // Subsampled in the X direction. It is mapped into the 1st channel. | |
| 686 | + | // | |
| 687 | + | // Commonly known by the fourcc "S210". | |
| 688 | + | MemoryX6g10X6b10X6r10422Value MemoryFormat = 57 | |
| 689 | + | // Multiplane format with 3 planes. | |
| 690 | + | // | |
| 691 | + | // Each channel is a 16 bit integer. | |
| 692 | + | // | |
| 693 | + | // Only the 10 lower bits are used. The remaining ones must be set to 0 by the | |
| 694 | + | // producer. | |
| 695 | + | // | |
| 696 | + | // The first plane usually contains the luma channel. It is mapped | |
| 697 | + | // into the 2nd channel. | |
| 698 | + | // | |
| 699 | + | // The second plane usually contains the first chroma chanel. It is | |
| 700 | + | // mapped into the 3rd channel. | |
| 701 | + | // | |
| 702 | + | // The third plane usually contains the second chroma channel. It is | |
| 703 | + | // mapped into the 1st channel. | |
| 704 | + | // | |
| 705 | + | // Commonly known by the fourcc "S410". | |
| 706 | + | MemoryX6g10X6b10X6r10444Value MemoryFormat = 58 | |
| 707 | + | // Multiplane format with 3 planes. | |
| 708 | + | // | |
| 709 | + | // Each channel is a 16 bit integer. | |
| 710 | + | // | |
| 711 | + | // Only the 12 lower bits are used. The remaining ones must be set to 0 by the | |
| 712 | + | // producer. | |
| 713 | + | // | |
| 714 | + | // The first plane usually contains the luma channel. It is mapped | |
| 715 | + | // into the 2nd channel. | |
| 716 | + | // | |
| 717 | + | // The second plane usually contains the first chroma chanel. | |
| 718 | + | // Subsampled in both the X and Y direction. It is mapped into the | |
| 719 | + | // 3rd channel. | |
| 720 | + | // | |
| 721 | + | // The third plane usually contains the second chroma channel. | |
| 722 | + | // Subsampled in both the X and Y direction. It is mapped into the | |
| 723 | + | // 1st channel. | |
| 724 | + | // | |
| 725 | + | // Commonly known by the fourcc "S012". | |
| 726 | + | MemoryX4g12X4b12X4r12420Value MemoryFormat = 59 | |
| 727 | + | // Multiplane format with 3 planes. | |
| 728 | + | // | |
| 729 | + | // Each channel is a 16 bit integer. | |
| 730 | + | // | |
| 731 | + | // Only the 12 lower bits are used. The remaining ones must be set to 0 by the | |
| 732 | + | // producer. | |
| 733 | + | // | |
| 734 | + | // The first plane usually contains the luma channel. It is mapped | |
| 735 | + | // into the 2nd channel. | |
| 736 | + | // | |
| 737 | + | // The second plane usually contains the first chroma chanel. | |
| 738 | + | // Subsampled in the X direction. It is mapped into the 3rd channel. | |
| 739 | + | // | |
| 740 | + | // The third plane usually contains the second chroma channel. | |
| 741 | + | // Subsampled in the X direction. It is mapped into the 1st channel. | |
| 742 | + | // | |
| 743 | + | // Commonly known by the fourcc "S212". | |
| 744 | + | MemoryX4g12X4b12X4r12422Value MemoryFormat = 60 | |
| 745 | + | // Multiplane format with 3 planes. | |
| 746 | + | // | |
| 747 | + | // Each channel is a 16 bit integer. | |
| 748 | + | // | |
| 749 | + | // Only the 12 lower bits are used. The remaining ones must be set to 0 by the | |
| 750 | + | // producer. | |
| 751 | + | // | |
| 752 | + | // The first plane usually contains the luma channel. It is mapped | |
| 753 | + | // into the 2nd channel. | |
| 754 | + | // | |
| 755 | + | // The second plane usually contains the first chroma chanel. It is | |
| 756 | + | // mapped into the 3rd channel. | |
| 757 | + | // | |
| 758 | + | // The third plane usually contains the second chroma channel. It is | |
| 759 | + | // mapped into the 1st channel. | |
| 760 | + | // | |
| 761 | + | // Commonly known by the fourcc "S412". | |
| 762 | + | MemoryX4g12X4b12X4r12444Value MemoryFormat = 61 | |
| 763 | + | // Multiplane format with 3 planes. | |
| 764 | + | // | |
| 765 | + | // Each channel is a 16 bit integer. | |
| 766 | + | // | |
| 767 | + | // The first plane usually contains the luma channel. It is mapped | |
| 768 | + | // into the 2nd channel. | |
| 769 | + | // | |
| 770 | + | // The second plane usually contains the first chroma chanel. | |
| 771 | + | // Subsampled in both the X and Y direction. It is mapped into the | |
| 772 | + | // 3rd channel. | |
| 773 | + | // | |
| 774 | + | // The third plane usually contains the second chroma channel. | |
| 775 | + | // Subsampled in both the X and Y direction. It is mapped into the | |
| 776 | + | // 1st channel. | |
| 777 | + | // | |
| 778 | + | // Commonly known by the fourcc "S016". | |
| 779 | + | MemoryG16B16R16420Value MemoryFormat = 62 | |
| 780 | + | // Multiplane format with 3 planes. | |
| 781 | + | // | |
| 782 | + | // Each channel is a 16 bit integer. | |
| 783 | + | // | |
| 784 | + | // The first plane usually contains the luma channel. It is mapped | |
| 785 | + | // into the 2nd channel. | |
| 786 | + | // | |
| 787 | + | // The second plane usually contains the first chroma chanel. | |
| 788 | + | // Subsampled in the X direction. It is mapped into the 3rd channel. | |
| 789 | + | // | |
| 790 | + | // The third plane usually contains the second chroma channel. | |
| 791 | + | // Subsampled in the X direction. It is mapped into the 1st channel. | |
| 792 | + | // | |
| 793 | + | // Commonly known by the fourcc "S216". | |
| 794 | + | MemoryG16B16R16422Value MemoryFormat = 63 | |
| 795 | + | // Multiplane format with 3 planes. | |
| 796 | + | // | |
| 797 | + | // Each channel is a 16 bit integer. | |
| 798 | + | // | |
| 799 | + | // The first plane usually contains the luma channel. It is mapped | |
| 800 | + | // into the 2nd channel. | |
| 801 | + | // | |
| 802 | + | // The second plane usually contains the first chroma chanel. It is | |
| 803 | + | // mapped into the 3rd channel. | |
| 804 | + | // | |
| 805 | + | // The third plane usually contains the second chroma channel. It is | |
| 806 | + | // mapped into the 1st channel. | |
| 807 | + | // | |
| 808 | + | // Commonly known by the fourcc "S416". | |
| 809 | + | MemoryG16B16R16444Value MemoryFormat = 64 | |
| 360 | 810 | // The number of formats. This value will change as | |
| 361 | 811 | // more formats get added, so do not rely on its concrete integer. | |
| 362 | - | MemoryNFormatsValue MemoryFormat = 33 | |
| 812 | + | MemoryNFormatsValue MemoryFormat = 65 | |
| 813 | + | ) | |
| 814 | + | ||
| 815 | + | // Used in scroll events, to announce the direction relative | |
| 816 | + | // to physical motion. | |
| 817 | + | type ScrollRelativeDirection int | |
| 818 | + | ||
| 819 | + | var xScrollRelativeDirectionGLibType func() types.GType | |
| 820 | + | ||
| 821 | + | func ScrollRelativeDirectionGLibType() types.GType { | |
| 822 | + | return xScrollRelativeDirectionGLibType() | |
| 823 | + | } | |
| 824 | + | ||
| 825 | + | const ( | |
| 826 | + | ||
| 827 | + | // Physical motion and event motion are the same | |
| 828 | + | ScrollRelativeDirectionIdenticalValue ScrollRelativeDirection = 0 | |
| 829 | + | // Physical motion is inverted relative to event motion | |
| 830 | + | ScrollRelativeDirectionInvertedValue ScrollRelativeDirection = 1 | |
| 831 | + | // Relative motion is unknown on this device or backend | |
| 832 | + | ScrollRelativeDirectionUnknownValue ScrollRelativeDirection = 2 | |
| 363 | 833 | ) | |
| 364 | 834 | ||
| 365 | 835 | // Error enumeration for `GdkVulkanContext`. | |
M v4/gdk/gdkevents.go +13 -1
| @@ -159,8 +159,10 @@ const ( | |||
| 159 | 159 | // A touchpad hold gesture event, the current state is determined by its phase | |
| 160 | 160 | // field. | |
| 161 | 161 | TouchpadHoldValue EventType = 28 | |
| 162 | + | // A tablet pad axis event from a "dial". | |
| 163 | + | PadDialValue EventType = 29 | |
| 162 | 164 | // marks the end of the GdkEventType enumeration. | |
| 163 | - | EventLastValue EventType = 29 | |
| 165 | + | EventLastValue EventType = 30 | |
| 164 | 166 | ) | |
| 165 | 167 | ||
| 166 | 168 | // Describes how well an event matches a given keyval and modifiers. | |
| @@ -1237,6 +1239,14 @@ func (c *ScrollEvent) SetGoPointer(ptr uintptr) { | |||
| 1237 | 1239 | c.Ptr = ptr | |
| 1238 | 1240 | } | |
| 1239 | 1241 | ||
| 1242 | + | var xScrollEventGetRelativeDirection func(uintptr) ScrollRelativeDirection | |
| 1243 | + | ||
| 1244 | + | func ScrollEventGetRelativeDirection(EventVar *Event) ScrollRelativeDirection { | |
| 1245 | + | ||
| 1246 | + | cret := xScrollEventGetRelativeDirection(EventVar.GoPointer()) | |
| 1247 | + | return cret | |
| 1248 | + | } | |
| 1249 | + | ||
| 1240 | 1250 | // An event related to a touch-based device. | |
| 1241 | 1251 | type TouchEvent struct { | |
| 1242 | 1252 | Event | |
| @@ -1460,6 +1470,8 @@ func init() { | |||
| 1460 | 1470 | core.PuregoSafeRegister(&xScrollEventGetUnit, libs, "gdk_scroll_event_get_unit") | |
| 1461 | 1471 | core.PuregoSafeRegister(&xScrollEventIsStop, libs, "gdk_scroll_event_is_stop") | |
| 1462 | 1472 | ||
| 1473 | + | core.PuregoSafeRegister(&xScrollEventGetRelativeDirection, libs, "gdk_scroll_event_get_relative_direction") | |
| 1474 | + | ||
| 1463 | 1475 | core.PuregoSafeRegister(&xTouchEventGLibType, libs, "gdk_touch_event_get_type") | |
| 1464 | 1476 | ||
| 1465 | 1477 | core.PuregoSafeRegister(&xTouchEventGetEmulatingPointer, libs, "gdk_touch_event_get_emulating_pointer") | |
M v4/gdk/gdkmemorytexturebuilder.go +44 -2
| @@ -124,6 +124,15 @@ func (x *MemoryTextureBuilder) GetHeight() int { | |||
| 124 | 124 | return cret | |
| 125 | 125 | } | |
| 126 | 126 | ||
| 127 | + | var xMemoryTextureBuilderGetOffset func(uintptr, uint) uint | |
| 128 | + | ||
| 129 | + | // Gets the offset previously set via gdk_memory_texture_builder_set_offset(). | |
| 130 | + | func (x *MemoryTextureBuilder) GetOffset(PlaneVar uint) uint { | |
| 131 | + | ||
| 132 | + | cret := xMemoryTextureBuilderGetOffset(x.GoPointer(), PlaneVar) | |
| 133 | + | return cret | |
| 134 | + | } | |
| 135 | + | ||
| 127 | 136 | var xMemoryTextureBuilderGetStride func(uintptr) uint | |
| 128 | 137 | ||
| 129 | 138 | // Gets the stride previously set via gdk_memory_texture_builder_set_stride(). | |
| @@ -133,6 +142,15 @@ func (x *MemoryTextureBuilder) GetStride() uint { | |||
| 133 | 142 | return cret | |
| 134 | 143 | } | |
| 135 | 144 | ||
| 145 | + | var xMemoryTextureBuilderGetStrideForPlane func(uintptr, uint) uint | |
| 146 | + | ||
| 147 | + | // Gets the stride previously set via gdk_memory_texture_builder_set_stride_for_plane(). | |
| 148 | + | func (x *MemoryTextureBuilder) GetStrideForPlane(PlaneVar uint) uint { | |
| 149 | + | ||
| 150 | + | cret := xMemoryTextureBuilderGetStrideForPlane(x.GoPointer(), PlaneVar) | |
| 151 | + | return cret | |
| 152 | + | } | |
| 153 | + | ||
| 136 | 154 | var xMemoryTextureBuilderGetUpdateRegion func(uintptr) *cairo.Region | |
| 137 | 155 | ||
| 138 | 156 | // Gets the region previously set via gdk_memory_texture_builder_set_update_region() | |
| @@ -209,13 +227,23 @@ var xMemoryTextureBuilderSetHeight func(uintptr, int) | |||
| 209 | 227 | ||
| 210 | 228 | // Sets the height of the texture. | |
| 211 | 229 | // | |
| 212 | - | // The height must be set before calling [method@Gdk.MemoryTextureBuilder.build]. | |
| 230 | + | // The height must be set before calling [method@Gdk.MemoryTextureBuilder.build] | |
| 231 | + | // and conform to size requirements of the provided format. | |
| 213 | 232 | func (x *MemoryTextureBuilder) SetHeight(HeightVar int) { | |
| 214 | 233 | ||
| 215 | 234 | xMemoryTextureBuilderSetHeight(x.GoPointer(), HeightVar) | |
| 216 | 235 | ||
| 217 | 236 | } | |
| 218 | 237 | ||
| 238 | + | var xMemoryTextureBuilderSetOffset func(uintptr, uint, uint) | |
| 239 | + | ||
| 240 | + | // Sets the offset of the texture for @plane. | |
| 241 | + | func (x *MemoryTextureBuilder) SetOffset(PlaneVar uint, OffsetVar uint) { | |
| 242 | + | ||
| 243 | + | xMemoryTextureBuilderSetOffset(x.GoPointer(), PlaneVar, OffsetVar) | |
| 244 | + | ||
| 245 | + | } | |
| 246 | + | ||
| 219 | 247 | var xMemoryTextureBuilderSetStride func(uintptr, uint) | |
| 220 | 248 | ||
| 221 | 249 | // Sets the rowstride of the bytes used. | |
| @@ -227,6 +255,15 @@ func (x *MemoryTextureBuilder) SetStride(StrideVar uint) { | |||
| 227 | 255 | ||
| 228 | 256 | } | |
| 229 | 257 | ||
| 258 | + | var xMemoryTextureBuilderSetStrideForPlane func(uintptr, uint, uint) | |
| 259 | + | ||
| 260 | + | // Sets the stride of the texture for @plane. | |
| 261 | + | func (x *MemoryTextureBuilder) SetStrideForPlane(PlaneVar uint, StrideVar uint) { | |
| 262 | + | ||
| 263 | + | xMemoryTextureBuilderSetStrideForPlane(x.GoPointer(), PlaneVar, StrideVar) | |
| 264 | + | ||
| 265 | + | } | |
| 266 | + | ||
| 230 | 267 | var xMemoryTextureBuilderSetUpdateRegion func(uintptr, *cairo.Region) | |
| 231 | 268 | ||
| 232 | 269 | // Sets the region to be updated by this texture. | |
| @@ -261,7 +298,8 @@ var xMemoryTextureBuilderSetWidth func(uintptr, int) | |||
| 261 | 298 | ||
| 262 | 299 | // Sets the width of the texture. | |
| 263 | 300 | // | |
| 264 | - | // The width must be set before calling [method@Gdk.MemoryTextureBuilder.build]. | |
| 301 | + | // The width must be set before calling [method@Gdk.MemoryTextureBuilder.build] | |
| 302 | + | // and conform to size requirements of the provided format. | |
| 265 | 303 | func (x *MemoryTextureBuilder) SetWidth(WidthVar int) { | |
| 266 | 304 | ||
| 267 | 305 | xMemoryTextureBuilderSetWidth(x.GoPointer(), WidthVar) | |
| @@ -300,7 +338,9 @@ func init() { | |||
| 300 | 338 | core.PuregoSafeRegister(&xMemoryTextureBuilderGetColorState, libs, "gdk_memory_texture_builder_get_color_state") | |
| 301 | 339 | core.PuregoSafeRegister(&xMemoryTextureBuilderGetFormat, libs, "gdk_memory_texture_builder_get_format") | |
| 302 | 340 | core.PuregoSafeRegister(&xMemoryTextureBuilderGetHeight, libs, "gdk_memory_texture_builder_get_height") | |
| 341 | + | core.PuregoSafeRegister(&xMemoryTextureBuilderGetOffset, libs, "gdk_memory_texture_builder_get_offset") | |
| 303 | 342 | core.PuregoSafeRegister(&xMemoryTextureBuilderGetStride, libs, "gdk_memory_texture_builder_get_stride") | |
| 343 | + | core.PuregoSafeRegister(&xMemoryTextureBuilderGetStrideForPlane, libs, "gdk_memory_texture_builder_get_stride_for_plane") | |
| 304 | 344 | core.PuregoSafeRegister(&xMemoryTextureBuilderGetUpdateRegion, libs, "gdk_memory_texture_builder_get_update_region") | |
| 305 | 345 | core.PuregoSafeRegister(&xMemoryTextureBuilderGetUpdateTexture, libs, "gdk_memory_texture_builder_get_update_texture") | |
| 306 | 346 | core.PuregoSafeRegister(&xMemoryTextureBuilderGetWidth, libs, "gdk_memory_texture_builder_get_width") | |
| @@ -308,7 +348,9 @@ func init() { | |||
| 308 | 348 | core.PuregoSafeRegister(&xMemoryTextureBuilderSetColorState, libs, "gdk_memory_texture_builder_set_color_state") | |
| 309 | 349 | core.PuregoSafeRegister(&xMemoryTextureBuilderSetFormat, libs, "gdk_memory_texture_builder_set_format") | |
| 310 | 350 | core.PuregoSafeRegister(&xMemoryTextureBuilderSetHeight, libs, "gdk_memory_texture_builder_set_height") | |
| 351 | + | core.PuregoSafeRegister(&xMemoryTextureBuilderSetOffset, libs, "gdk_memory_texture_builder_set_offset") | |
| 311 | 352 | core.PuregoSafeRegister(&xMemoryTextureBuilderSetStride, libs, "gdk_memory_texture_builder_set_stride") | |
| 353 | + | core.PuregoSafeRegister(&xMemoryTextureBuilderSetStrideForPlane, libs, "gdk_memory_texture_builder_set_stride_for_plane") | |
| 312 | 354 | core.PuregoSafeRegister(&xMemoryTextureBuilderSetUpdateRegion, libs, "gdk_memory_texture_builder_set_update_region") | |
| 313 | 355 | core.PuregoSafeRegister(&xMemoryTextureBuilderSetUpdateTexture, libs, "gdk_memory_texture_builder_set_update_texture") | |
| 314 | 356 | core.PuregoSafeRegister(&xMemoryTextureBuilderSetWidth, libs, "gdk_memory_texture_builder_set_width") | |
M v4/gdk/gdkpopuplayout.go +3 -3
| @@ -97,7 +97,7 @@ func (x *PopupLayout) Equal(OtherVar *PopupLayout) bool { | |||
| 97 | 97 | ||
| 98 | 98 | var xPopupLayoutGetAnchorHints func(uintptr) AnchorHints | |
| 99 | 99 | ||
| 100 | - | // Get the `GdkAnchorHints`. | |
| 100 | + | // Get the anchor hints. | |
| 101 | 101 | func (x *PopupLayout) GetAnchorHints() AnchorHints { | |
| 102 | 102 | ||
| 103 | 103 | cret := xPopupLayoutGetAnchorHints(x.GoPointer()) | |
| @@ -164,8 +164,8 @@ var xPopupLayoutSetAnchorHints func(uintptr, AnchorHints) | |||
| 164 | 164 | // | |
| 165 | 165 | // The set @anchor_hints determines how @surface will be moved | |
| 166 | 166 | // if the anchor points cause it to move off-screen. For example, | |
| 167 | - | // %GDK_ANCHOR_FLIP_X will replace %GDK_GRAVITY_NORTH_WEST with | |
| 168 | - | // %GDK_GRAVITY_NORTH_EAST and vice versa if @surface extends | |
| 167 | + | // `GDK_ANCHOR_FLIP_X` will replace `GDK_GRAVITY_NORTH_WEST` with | |
| 168 | + | // `GDK_GRAVITY_NORTH_EAST` and vice versa if @surface extends | |
| 169 | 169 | // beyond the left or right edges of the monitor. | |
| 170 | 170 | func (x *PopupLayout) SetAnchorHints(AnchorHintsVar AnchorHints) { | |
| 171 | 171 | ||
M v4/gdk/gdktexture.go +28 -10
| @@ -100,8 +100,8 @@ var xNewTextureForPixbuf func(uintptr) uintptr | |||
| 100 | 100 | // Creates a new texture object representing the `GdkPixbuf`. | |
| 101 | 101 | // | |
| 102 | 102 | // This function is threadsafe, so that you can e.g. use GTask | |
| 103 | - | // and [method@Gio.Task.run_in_thread] to avoid blocking the main thread | |
| 104 | - | // while loading a big image. | |
| 103 | + | // and [method@Gio.Task.run_in_thread] to avoid blocking the main | |
| 104 | + | // thread while loading a big image. | |
| 105 | 105 | func NewTextureForPixbuf(PixbufVar *gdkpixbuf.Pixbuf) *Texture { | |
| 106 | 106 | var cls *Texture | |
| 107 | 107 | ||
| @@ -122,11 +122,17 @@ var xNewTextureFromBytes func(*glib.Bytes, **glib.Error) uintptr | |||
| 122 | 122 | // The file format is detected automatically. The supported formats | |
| 123 | 123 | // are PNG, JPEG and TIFF, though more formats might be available. | |
| 124 | 124 | // | |
| 125 | - | // If %NULL is returned, then @error will be set. | |
| 125 | + | // If `NULL` is returned, then @error will be set. | |
| 126 | 126 | // | |
| 127 | 127 | // This function is threadsafe, so that you can e.g. use GTask | |
| 128 | 128 | // and [method@Gio.Task.run_in_thread] to avoid blocking the main thread | |
| 129 | 129 | // while loading a big image. | |
| 130 | + | // | |
| 131 | + | // ::: warning | |
| 132 | + | // | |
| 133 | + | // Note that this function should not be used with untrusted data. | |
| 134 | + | // Use a proper image loading framework such as libglycin, which can | |
| 135 | + | // load many image formats into a `GdkTexture`. | |
| 130 | 136 | func NewTextureFromBytes(BytesVar *glib.Bytes) (*Texture, error) { | |
| 131 | 137 | var cls *Texture | |
| 132 | 138 | var cerr *glib.Error | |
| @@ -152,11 +158,17 @@ var xNewTextureFromFile func(uintptr, **glib.Error) uintptr | |||
| 152 | 158 | // The file format is detected automatically. The supported formats | |
| 153 | 159 | // are PNG, JPEG and TIFF, though more formats might be available. | |
| 154 | 160 | // | |
| 155 | - | // If %NULL is returned, then @error will be set. | |
| 161 | + | // If `NULL` is returned, then @error will be set. | |
| 156 | 162 | // | |
| 157 | 163 | // This function is threadsafe, so that you can e.g. use GTask | |
| 158 | 164 | // and [method@Gio.Task.run_in_thread] to avoid blocking the main thread | |
| 159 | 165 | // while loading a big image. | |
| 166 | + | // | |
| 167 | + | // ::: warning | |
| 168 | + | // | |
| 169 | + | // Note that this function should not be used with untrusted data. | |
| 170 | + | // Use a proper image loading framework such as libglycin, which can | |
| 171 | + | // load many image formats into a `GdkTexture`. | |
| 160 | 172 | func NewTextureFromFile(FileVar gio.File) (*Texture, error) { | |
| 161 | 173 | var cls *Texture | |
| 162 | 174 | var cerr *glib.Error | |
| @@ -182,11 +194,17 @@ var xNewTextureFromFilename func(string, **glib.Error) uintptr | |||
| 182 | 194 | // The file format is detected automatically. The supported formats | |
| 183 | 195 | // are PNG, JPEG and TIFF, though more formats might be available. | |
| 184 | 196 | // | |
| 185 | - | // If %NULL is returned, then @error will be set. | |
| 197 | + | // If `NULL` is returned, then @error will be set. | |
| 186 | 198 | // | |
| 187 | 199 | // This function is threadsafe, so that you can e.g. use GTask | |
| 188 | 200 | // and [method@Gio.Task.run_in_thread] to avoid blocking the main thread | |
| 189 | 201 | // while loading a big image. | |
| 202 | + | // | |
| 203 | + | // ::: warning | |
| 204 | + | // | |
| 205 | + | // Note that this function should not be used with untrusted data. | |
| 206 | + | // Use a proper image loading framework such as libglycin, which can | |
| 207 | + | // load many image formats into a `GdkTexture`. | |
| 190 | 208 | func NewTextureFromFilename(PathVar string) (*Texture, error) { | |
| 191 | 209 | var cls *Texture | |
| 192 | 210 | var cerr *glib.Error | |
| @@ -210,7 +228,7 @@ var xNewTextureFromResource func(string) uintptr | |||
| 210 | 228 | // Creates a new texture by loading an image from a resource. | |
| 211 | 229 | // | |
| 212 | 230 | // The file format is detected automatically. The supported formats | |
| 213 | - | // are PNG and JPEG, though more formats might be available. | |
| 231 | + | // are PNG, JPEG and TIFF, though more formats might be available. | |
| 214 | 232 | // | |
| 215 | 233 | // It is a fatal error if @resource_path does not specify a valid | |
| 216 | 234 | // image resource and the program will abort if that happens. | |
| @@ -317,9 +335,9 @@ var xTextureSaveToPng func(uintptr, string) bool | |||
| 317 | 335 | // | |
| 318 | 336 | // This is a utility function intended for debugging and testing. | |
| 319 | 337 | // If you want more control over formats, proper error handling or | |
| 320 | - | // want to store to a [iface@Gio.File] or other location, you might want to | |
| 321 | - | // use [method@Gdk.Texture.save_to_png_bytes] or look into the | |
| 322 | - | // gdk-pixbuf library. | |
| 338 | + | // want to store to a [iface@Gio.File] or other location, you might | |
| 339 | + | // want to use [method@Gdk.Texture.save_to_png_bytes] or look into | |
| 340 | + | // the libglycin library. | |
| 323 | 341 | func (x *Texture) SaveToPng(FilenameVar string) bool { | |
| 324 | 342 | ||
| 325 | 343 | cret := xTextureSaveToPng(x.GoPointer(), FilenameVar) | |
| @@ -337,7 +355,7 @@ var xTextureSaveToPngBytes func(uintptr) *glib.Bytes | |||
| 337 | 355 | // | |
| 338 | 356 | // If you need more control over the generated image, such as | |
| 339 | 357 | // attaching metadata, you should look into an image handling | |
| 340 | - | // library such as the gdk-pixbuf library. | |
| 358 | + | // library such as the libglycin library. | |
| 341 | 359 | // | |
| 342 | 360 | // If you are dealing with high dynamic range float data, you | |
| 343 | 361 | // might also want to consider [method@Gdk.Texture.save_to_tiff_bytes] | |
M v4/gdk/gdktoplevel.go +68 -0
| @@ -30,6 +30,8 @@ type Toplevel interface { | |||
| 30 | 30 | BeginMove(DeviceVar *Device, ButtonVar int, XVar float64, YVar float64, TimestampVar uint32) | |
| 31 | 31 | BeginResize(EdgeVar SurfaceEdge, DeviceVar *Device, ButtonVar int, XVar float64, YVar float64, TimestampVar uint32) | |
| 32 | 32 | Focus(TimestampVar uint32) | |
| 33 | + | GetCapabilities() ToplevelCapabilities | |
| 34 | + | GetGravity() Gravity | |
| 33 | 35 | GetState() ToplevelState | |
| 34 | 36 | InhibitSystemShortcuts(EventVar *Event) | |
| 35 | 37 | Lower() bool | |
| @@ -38,6 +40,7 @@ type Toplevel interface { | |||
| 38 | 40 | RestoreSystemShortcuts() | |
| 39 | 41 | SetDecorated(DecoratedVar bool) | |
| 40 | 42 | SetDeletable(DeletableVar bool) | |
| 43 | + | SetGravity(GravityVar Gravity) | |
| 41 | 44 | SetIconList(SurfacesVar *glib.List) | |
| 42 | 45 | SetModal(ModalVar bool) | |
| 43 | 46 | SetStartupId(StartupIdVar string) | |
| @@ -98,6 +101,21 @@ func (x *ToplevelBase) Focus(TimestampVar uint32) { | |||
| 98 | 101 | ||
| 99 | 102 | } | |
| 100 | 103 | ||
| 104 | + | // The capabilities that are available for this toplevel. | |
| 105 | + | func (x *ToplevelBase) GetCapabilities() ToplevelCapabilities { | |
| 106 | + | ||
| 107 | + | cret := XGdkToplevelGetCapabilities(x.GoPointer()) | |
| 108 | + | return cret | |
| 109 | + | } | |
| 110 | + | ||
| 111 | + | // Returns the gravity that is used when changing the toplevel | |
| 112 | + | // size programmatically. | |
| 113 | + | func (x *ToplevelBase) GetGravity() Gravity { | |
| 114 | + | ||
| 115 | + | cret := XGdkToplevelGetGravity(x.GoPointer()) | |
| 116 | + | return cret | |
| 117 | + | } | |
| 118 | + | ||
| 101 | 119 | // Gets the bitwise or of the currently active surface state flags, | |
| 102 | 120 | // from the `GdkToplevelState` enumeration. | |
| 103 | 121 | func (x *ToplevelBase) GetState() ToplevelState { | |
| @@ -199,6 +217,14 @@ func (x *ToplevelBase) SetDeletable(DeletableVar bool) { | |||
| 199 | 217 | ||
| 200 | 218 | } | |
| 201 | 219 | ||
| 220 | + | // Sets the gravity that is used when changing the toplevel | |
| 221 | + | // size programmatically. | |
| 222 | + | func (x *ToplevelBase) SetGravity(GravityVar Gravity) { | |
| 223 | + | ||
| 224 | + | XGdkToplevelSetGravity(x.GoPointer(), GravityVar) | |
| 225 | + | ||
| 226 | + | } | |
| 227 | + | ||
| 202 | 228 | // Sets a list of icons for the surface. | |
| 203 | 229 | // | |
| 204 | 230 | // One of these will be used to represent the surface in iconic form. | |
| @@ -295,6 +321,8 @@ func (x *ToplevelBase) TitlebarGesture(GestureVar TitlebarGesture) bool { | |||
| 295 | 321 | var XGdkToplevelBeginMove func(uintptr, uintptr, int, float64, float64, uint32) | |
| 296 | 322 | var XGdkToplevelBeginResize func(uintptr, SurfaceEdge, uintptr, int, float64, float64, uint32) | |
| 297 | 323 | var XGdkToplevelFocus func(uintptr, uint32) | |
| 324 | + | var XGdkToplevelGetCapabilities func(uintptr) ToplevelCapabilities | |
| 325 | + | var XGdkToplevelGetGravity func(uintptr) Gravity | |
| 298 | 326 | var XGdkToplevelGetState func(uintptr) ToplevelState | |
| 299 | 327 | var XGdkToplevelInhibitSystemShortcuts func(uintptr, uintptr) | |
| 300 | 328 | var XGdkToplevelLower func(uintptr) bool | |
| @@ -303,6 +331,7 @@ var XGdkToplevelPresent func(uintptr, *ToplevelLayout) | |||
| 303 | 331 | var XGdkToplevelRestoreSystemShortcuts func(uintptr) | |
| 304 | 332 | var XGdkToplevelSetDecorated func(uintptr, bool) | |
| 305 | 333 | var XGdkToplevelSetDeletable func(uintptr, bool) | |
| 334 | + | var XGdkToplevelSetGravity func(uintptr, Gravity) | |
| 306 | 335 | var XGdkToplevelSetIconList func(uintptr, *glib.List) | |
| 307 | 336 | var XGdkToplevelSetModal func(uintptr, bool) | |
| 308 | 337 | var XGdkToplevelSetStartupId func(uintptr, string) | |
| @@ -312,6 +341,40 @@ var XGdkToplevelShowWindowMenu func(uintptr, uintptr) bool | |||
| 312 | 341 | var XGdkToplevelSupportsEdgeConstraints func(uintptr) bool | |
| 313 | 342 | var XGdkToplevelTitlebarGesture func(uintptr, TitlebarGesture) bool | |
| 314 | 343 | ||
| 344 | + | // Reflects what features a `GdkToplevel` supports. | |
| 345 | + | type ToplevelCapabilities int | |
| 346 | + | ||
| 347 | + | var xToplevelCapabilitiesGLibType func() types.GType | |
| 348 | + | ||
| 349 | + | func ToplevelCapabilitiesGLibType() types.GType { | |
| 350 | + | return xToplevelCapabilitiesGLibType() | |
| 351 | + | } | |
| 352 | + | ||
| 353 | + | const ( | |
| 354 | + | ||
| 355 | + | // Whether tiled window states are supported. | |
| 356 | + | ToplevelCapabilitiesEdgeConstraintsValue ToplevelCapabilities = 1 | |
| 357 | + | // Whether inhibiting system shortcuts is supported. | |
| 358 | + | // See [method@Gdk.Toplevel.inhibit_system_shortcuts]. | |
| 359 | + | ToplevelCapabilitiesInhibitShortcutsValue ToplevelCapabilities = 2 | |
| 360 | + | // Whether titlebar gestures are supported. | |
| 361 | + | // See [method@Gdk.Toplevel.titlebar_gesture]. | |
| 362 | + | ToplevelCapabilitiesTitlebarGesturesValue ToplevelCapabilities = 4 | |
| 363 | + | // Whether showing the window menu is supported. | |
| 364 | + | // See [method@Gdk.Toplevel.show_window_menu]. | |
| 365 | + | ToplevelCapabilitiesWindowMenuValue ToplevelCapabilities = 8 | |
| 366 | + | // Whether the toplevel can be maximized. | |
| 367 | + | ToplevelCapabilitiesMaximizeValue ToplevelCapabilities = 16 | |
| 368 | + | // Whether the toplevel can be made fullscreen. | |
| 369 | + | ToplevelCapabilitiesFullscreenValue ToplevelCapabilities = 32 | |
| 370 | + | // Whether the toplevel can be minimized. | |
| 371 | + | // See [method@Gdk.Toplevel.minimize]. | |
| 372 | + | ToplevelCapabilitiesMinimizeValue ToplevelCapabilities = 64 | |
| 373 | + | // Whether the toplevel can be lowered. | |
| 374 | + | // See [method@Gdk.Toplevel.lower]. | |
| 375 | + | ToplevelCapabilitiesLowerValue ToplevelCapabilities = 128 | |
| 376 | + | ) | |
| 377 | + | ||
| 315 | 378 | // Specifies the state of a toplevel surface. | |
| 316 | 379 | // | |
| 317 | 380 | // On platforms that support information about individual edges, the | |
| @@ -443,6 +506,8 @@ func init() { | |||
| 443 | 506 | libs = append(libs, lib) | |
| 444 | 507 | } | |
| 445 | 508 | ||
| 509 | + | core.PuregoSafeRegister(&xToplevelCapabilitiesGLibType, libs, "gdk_toplevel_capabilities_get_type") | |
| 510 | + | ||
| 446 | 511 | core.PuregoSafeRegister(&xToplevelStateGLibType, libs, "gdk_toplevel_state_get_type") | |
| 447 | 512 | ||
| 448 | 513 | core.PuregoSafeRegister(&xFullscreenModeGLibType, libs, "gdk_fullscreen_mode_get_type") | |
| @@ -456,6 +521,8 @@ func init() { | |||
| 456 | 521 | core.PuregoSafeRegister(&XGdkToplevelBeginMove, libs, "gdk_toplevel_begin_move") | |
| 457 | 522 | core.PuregoSafeRegister(&XGdkToplevelBeginResize, libs, "gdk_toplevel_begin_resize") | |
| 458 | 523 | core.PuregoSafeRegister(&XGdkToplevelFocus, libs, "gdk_toplevel_focus") | |
| 524 | + | core.PuregoSafeRegister(&XGdkToplevelGetCapabilities, libs, "gdk_toplevel_get_capabilities") | |
| 525 | + | core.PuregoSafeRegister(&XGdkToplevelGetGravity, libs, "gdk_toplevel_get_gravity") | |
| 459 | 526 | core.PuregoSafeRegister(&XGdkToplevelGetState, libs, "gdk_toplevel_get_state") | |
| 460 | 527 | core.PuregoSafeRegister(&XGdkToplevelInhibitSystemShortcuts, libs, "gdk_toplevel_inhibit_system_shortcuts") | |
| 461 | 528 | core.PuregoSafeRegister(&XGdkToplevelLower, libs, "gdk_toplevel_lower") | |
| @@ -464,6 +531,7 @@ func init() { | |||
| 464 | 531 | core.PuregoSafeRegister(&XGdkToplevelRestoreSystemShortcuts, libs, "gdk_toplevel_restore_system_shortcuts") | |
| 465 | 532 | core.PuregoSafeRegister(&XGdkToplevelSetDecorated, libs, "gdk_toplevel_set_decorated") | |
| 466 | 533 | core.PuregoSafeRegister(&XGdkToplevelSetDeletable, libs, "gdk_toplevel_set_deletable") | |
| 534 | + | core.PuregoSafeRegister(&XGdkToplevelSetGravity, libs, "gdk_toplevel_set_gravity") | |
| 467 | 535 | core.PuregoSafeRegister(&XGdkToplevelSetIconList, libs, "gdk_toplevel_set_icon_list") | |
| 468 | 536 | core.PuregoSafeRegister(&XGdkToplevelSetModal, libs, "gdk_toplevel_set_modal") | |
| 469 | 537 | core.PuregoSafeRegister(&XGdkToplevelSetStartupId, libs, "gdk_toplevel_set_startup_id") | |
M v4/gdk/gdktoplevellayout.go +6 -6
| @@ -38,11 +38,11 @@ var xNewToplevelLayout func() *ToplevelLayout | |||
| 38 | 38 | ||
| 39 | 39 | // Create a toplevel layout description. | |
| 40 | 40 | // | |
| 41 | - | // Used together with gdk_toplevel_present() to describe | |
| 41 | + | // Used together with [method@Gdk.Toplevel.present] to describe | |
| 42 | 42 | // how a toplevel surface should be placed and behave on-screen. | |
| 43 | 43 | // | |
| 44 | 44 | // The size is in ”application pixels”, not | |
| 45 | - | // ”device pixels” (see gdk_surface_get_scale_factor()). | |
| 45 | + | // ”device pixels” (see [method@Gdk.Surface.get_scale]). | |
| 46 | 46 | func NewToplevelLayout() *ToplevelLayout { | |
| 47 | 47 | ||
| 48 | 48 | cret := xNewToplevelLayout() | |
| @@ -70,8 +70,8 @@ func (x *ToplevelLayout) Equal(OtherVar *ToplevelLayout) bool { | |||
| 70 | 70 | var xToplevelLayoutGetFullscreen func(uintptr, bool) bool | |
| 71 | 71 | ||
| 72 | 72 | // If the layout specifies whether to the toplevel should go fullscreen, | |
| 73 | - | // the value pointed to by @fullscreen is set to %TRUE if it should go | |
| 74 | - | // fullscreen, or %FALSE, if it should go unfullscreen. | |
| 73 | + | // the value pointed to by @fullscreen is set to true if it should go | |
| 74 | + | // fullscreen, or false, if it should go unfullscreen. | |
| 75 | 75 | func (x *ToplevelLayout) GetFullscreen(FullscreenVar bool) bool { | |
| 76 | 76 | ||
| 77 | 77 | cret := xToplevelLayoutGetFullscreen(x.GoPointer(), FullscreenVar) | |
| @@ -99,8 +99,8 @@ func (x *ToplevelLayout) GetFullscreenMonitor() *Monitor { | |||
| 99 | 99 | var xToplevelLayoutGetMaximized func(uintptr, bool) bool | |
| 100 | 100 | ||
| 101 | 101 | // If the layout specifies whether to the toplevel should go maximized, | |
| 102 | - | // the value pointed to by @maximized is set to %TRUE if it should go | |
| 103 | - | // fullscreen, or %FALSE, if it should go unmaximized. | |
| 102 | + | // the value pointed to by @maximized is set to true if it should go | |
| 103 | + | // maximized, or false, if it should go unmaximized. | |
| 104 | 104 | func (x *ToplevelLayout) GetMaximized(MaximizedVar bool) bool { | |
| 105 | 105 | ||
| 106 | 106 | cret := xToplevelLayoutGetMaximized(x.GoPointer(), MaximizedVar) | |
M v4/gdk/gdktypes.go +32 -0
| @@ -68,6 +68,18 @@ func (x *ColorState) Equal(OtherVar *ColorState) bool { | |||
| 68 | 68 | return cret | |
| 69 | 69 | } | |
| 70 | 70 | ||
| 71 | + | var xColorStateEquivalent func(uintptr, *ColorState) bool | |
| 72 | + | ||
| 73 | + | // Compares two `GdkColorStates` for equivalence. | |
| 74 | + | // | |
| 75 | + | // Two objects that represent the same color state should be equivalent, | |
| 76 | + | // even though they may not be equal in the sense of [method@Gdk.ColorState.equal]. | |
| 77 | + | func (x *ColorState) Equivalent(OtherVar *ColorState) bool { | |
| 78 | + | ||
| 79 | + | cret := xColorStateEquivalent(x.GoPointer(), OtherVar) | |
| 80 | + | return cret | |
| 81 | + | } | |
| 82 | + | ||
| 71 | 83 | var xColorStateRef func(uintptr) *ColorState | |
| 72 | 84 | ||
| 73 | 85 | // Increase the reference count of @self. | |
| @@ -589,15 +601,33 @@ var xTextureDownloaderDownloadBytes func(uintptr, uint) *glib.Bytes | |||
| 589 | 601 | // fails to allocate memory. If you think that may happen, you should handle | |
| 590 | 602 | // memory allocation yourself and use [method@Gdk.TextureDownloader.download_into] | |
| 591 | 603 | // once allocation succeeded. | |
| 604 | + | // | |
| 605 | + | // This function cannot be used with a multiplanar format. Use | |
| 606 | + | // [method@Gdk.TextureDownloader.download_bytes_with_planes] for that purpose. | |
| 592 | 607 | func (x *TextureDownloader) DownloadBytes(OutStrideVar uint) *glib.Bytes { | |
| 593 | 608 | ||
| 594 | 609 | cret := xTextureDownloaderDownloadBytes(x.GoPointer(), OutStrideVar) | |
| 595 | 610 | return cret | |
| 596 | 611 | } | |
| 597 | 612 | ||
| 613 | + | var xTextureDownloaderDownloadBytesWithPlanes func(uintptr, [4]uint, [4]uint) *glib.Bytes | |
| 614 | + | ||
| 615 | + | // Downloads the given texture pixels into a `GBytes`. The offsets and | |
| 616 | + | // strides of the resulting buffer will be stored in the respective values. | |
| 617 | + | // | |
| 618 | + | // If the format does have less than 4 planes, the remaining offsets and strides will be | |
| 619 | + | // set to `0`. | |
| 620 | + | func (x *TextureDownloader) DownloadBytesWithPlanes(OutOffsetsVar [4]uint, OutStridesVar [4]uint) *glib.Bytes { | |
| 621 | + | ||
| 622 | + | cret := xTextureDownloaderDownloadBytesWithPlanes(x.GoPointer(), OutOffsetsVar, OutStridesVar) | |
| 623 | + | return cret | |
| 624 | + | } | |
| 625 | + | ||
| 598 | 626 | var xTextureDownloaderDownloadInto func(uintptr, []byte, uint) | |
| 599 | 627 | ||
| 600 | 628 | // Downloads the @texture into local memory. | |
| 629 | + | // | |
| 630 | + | // This function cannot be used with a multiplanar format. | |
| 601 | 631 | func (x *TextureDownloader) DownloadInto(DataVar []byte, StrideVar uint) { | |
| 602 | 632 | ||
| 603 | 633 | xTextureDownloaderDownloadInto(x.GoPointer(), DataVar, StrideVar) | |
| @@ -701,6 +731,7 @@ func init() { | |||
| 701 | 731 | ||
| 702 | 732 | core.PuregoSafeRegister(&xColorStateCreateCicpParams, libs, "gdk_color_state_create_cicp_params") | |
| 703 | 733 | core.PuregoSafeRegister(&xColorStateEqual, libs, "gdk_color_state_equal") | |
| 734 | + | core.PuregoSafeRegister(&xColorStateEquivalent, libs, "gdk_color_state_equivalent") | |
| 704 | 735 | core.PuregoSafeRegister(&xColorStateRef, libs, "gdk_color_state_ref") | |
| 705 | 736 | core.PuregoSafeRegister(&xColorStateUnref, libs, "gdk_color_state_unref") | |
| 706 | 737 | ||
| @@ -749,6 +780,7 @@ func init() { | |||
| 749 | 780 | ||
| 750 | 781 | core.PuregoSafeRegister(&xTextureDownloaderCopy, libs, "gdk_texture_downloader_copy") | |
| 751 | 782 | core.PuregoSafeRegister(&xTextureDownloaderDownloadBytes, libs, "gdk_texture_downloader_download_bytes") | |
| 783 | + | core.PuregoSafeRegister(&xTextureDownloaderDownloadBytesWithPlanes, libs, "gdk_texture_downloader_download_bytes_with_planes") | |
| 752 | 784 | core.PuregoSafeRegister(&xTextureDownloaderDownloadInto, libs, "gdk_texture_downloader_download_into") | |
| 753 | 785 | core.PuregoSafeRegister(&xTextureDownloaderFree, libs, "gdk_texture_downloader_free") | |
| 754 | 786 | core.PuregoSafeRegister(&xTextureDownloaderGetColorState, libs, "gdk_texture_downloader_get_color_state") | |
M v4/gdk/gdkvulkancontext.go +0 -50
| @@ -6,7 +6,6 @@ import ( | |||
| 6 | 6 | ||
| 7 | 7 | "github.com/jwijenbergh/purego" | |
| 8 | 8 | "github.com/jwijenbergh/puregotk/pkg/core" | |
| 9 | - | "github.com/jwijenbergh/puregotk/v4/gio" | |
| 10 | 9 | "github.com/jwijenbergh/puregotk/v4/glib" | |
| 11 | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | |
| 12 | 11 | "github.com/jwijenbergh/puregotk/v4/gobject/types" | |
| @@ -79,55 +78,6 @@ func (x *VulkanContext) ConnectImagesUpdated(cb *func(VulkanContext)) uint32 { | |||
| 79 | 78 | return gobject.SignalConnect(x.GoPointer(), "images-updated", cbRefPtr) | |
| 80 | 79 | } | |
| 81 | 80 | ||
| 82 | - | // Initializes the object implementing the interface. | |
| 83 | - | // | |
| 84 | - | // This method is intended for language bindings. If writing in C, | |
| 85 | - | // g_initable_new() should typically be used instead. | |
| 86 | - | // | |
| 87 | - | // The object must be initialized before any real use after initial | |
| 88 | - | // construction, either with this function or g_async_initable_init_async(). | |
| 89 | - | // | |
| 90 | - | // Implementations may also support cancellation. If @cancellable is not %NULL, | |
| 91 | - | // then initialization can be cancelled by triggering the cancellable object | |
| 92 | - | // from another thread. If the operation was cancelled, the error | |
| 93 | - | // %G_IO_ERROR_CANCELLED will be returned. If @cancellable is not %NULL and | |
| 94 | - | // the object doesn't support cancellable initialization the error | |
| 95 | - | // %G_IO_ERROR_NOT_SUPPORTED will be returned. | |
| 96 | - | // | |
| 97 | - | // If the object is not initialized, or initialization returns with an | |
| 98 | - | // error, then all operations on the object except g_object_ref() and | |
| 99 | - | // g_object_unref() are considered to be invalid, and have undefined | |
| 100 | - | // behaviour. See the [description][iface@Gio.Initable#description] for more details. | |
| 101 | - | // | |
| 102 | - | // Callers should not assume that a class which implements #GInitable can be | |
| 103 | - | // initialized multiple times, unless the class explicitly documents itself as | |
| 104 | - | // supporting this. Generally, a class’ implementation of init() can assume | |
| 105 | - | // (and assert) that it will only be called once. Previously, this documentation | |
| 106 | - | // recommended all #GInitable implementations should be idempotent; that | |
| 107 | - | // recommendation was relaxed in GLib 2.54. | |
| 108 | - | // | |
| 109 | - | // If a class explicitly supports being initialized multiple times, it is | |
| 110 | - | // recommended that the method is idempotent: multiple calls with the same | |
| 111 | - | // arguments should return the same results. Only the first call initializes | |
| 112 | - | // the object; further calls return the result of the first call. | |
| 113 | - | // | |
| 114 | - | // One reason why a class might need to support idempotent initialization is if | |
| 115 | - | // it is designed to be used via the singleton pattern, with a | |
| 116 | - | // #GObjectClass.constructor that sometimes returns an existing instance. | |
| 117 | - | // In this pattern, a caller would expect to be able to call g_initable_init() | |
| 118 | - | // on the result of g_object_new(), regardless of whether it is in fact a new | |
| 119 | - | // instance. | |
| 120 | - | func (x *VulkanContext) Init(CancellableVar *gio.Cancellable) (bool, error) { | |
| 121 | - | var cerr *glib.Error | |
| 122 | - | ||
| 123 | - | cret := gio.XGInitableInit(x.GoPointer(), CancellableVar.GoPointer(), &cerr) | |
| 124 | - | if cerr == nil { | |
| 125 | - | return cret, nil | |
| 126 | - | } | |
| 127 | - | return cret, cerr | |
| 128 | - | ||
| 129 | - | } | |
| 130 | - | ||
| 131 | 81 | func init() { | |
| 132 | 82 | core.SetPackageName("GDK", "gtk4") | |
| 133 | 83 | core.SetSharedLibraries("GDK", []string{"libgtk-4.so.1"}) | |
M v4/gdkpixbuf/gdk-pixbuf-features.go +3 -3
| @@ -7,13 +7,13 @@ const ( | |||
| 7 | 7 | PIXBUF_MAJOR int = 2 | |
| 8 | 8 | // Micro version of gdk-pixbuf library, that is the "2" in | |
| 9 | 9 | // "0.8.2" for example. | |
| 10 | - | PIXBUF_MICRO int = 12 | |
| 10 | + | PIXBUF_MICRO int = 3 | |
| 11 | 11 | // Minor version of gdk-pixbuf library, that is the "8" in | |
| 12 | 12 | // "0.8.2" for example. | |
| 13 | - | PIXBUF_MINOR int = 42 | |
| 13 | + | PIXBUF_MINOR int = 44 | |
| 14 | 14 | // Contains the full version of GdkPixbuf as a string. | |
| 15 | 15 | // | |
| 16 | 16 | // This is the version being compiled against; contrast with | |
| 17 | 17 | // `gdk_pixbuf_version`. | |
| 18 | - | PIXBUF_VERSION string = "2.42.12" | |
| 18 | + | PIXBUF_VERSION string = "2.44.3" | |
| 19 | 19 | ) | |
M v4/gdkpixbuf/gdk-pixbuf.go +0 -3
| @@ -38,9 +38,6 @@ import ( | |||
| 38 | 38 | // function will compute an optimal rowstride so that rendering can be | |
| 39 | 39 | // performed with an efficient algorithm. | |
| 40 | 40 | // | |
| 41 | - | // As a special case, you can use the [`ctor@GdkPixbuf.Pixbuf.new_from_xpm_data`] | |
| 42 | - | // function to create a pixbuf from inline XPM image data. | |
| 43 | - | // | |
| 44 | 41 | // You can also copy an existing pixbuf with the [method@Pixbuf.copy] | |
| 45 | 42 | // function. This is not the same as just acquiring a reference to | |
| 46 | 43 | // the old pixbuf instance: the copy function will actually duplicate | |
M v4/gio/gapplication.go +6 -6
| @@ -198,7 +198,7 @@ func (x *ApplicationClass) GetLocalCommandLine() func(*Application, []string, in | |||
| 198 | 198 | // invoked on the primary instance before 'activate', 'open', | |
| 199 | 199 | // | |
| 200 | 200 | // 'command-line' or any action invocation, gets the 'platform data' from | |
| 201 | - | // the calling instance | |
| 201 | + | // the calling instance. Must chain up | |
| 202 | 202 | func (x *ApplicationClass) OverrideBeforeEmit(cb func(*Application, *glib.Variant)) { | |
| 203 | 203 | if cb == nil { | |
| 204 | 204 | x.xBeforeEmit = 0 | |
| @@ -213,7 +213,7 @@ func (x *ApplicationClass) OverrideBeforeEmit(cb func(*Application, *glib.Varian | |||
| 213 | 213 | // invoked on the primary instance before 'activate', 'open', | |
| 214 | 214 | // | |
| 215 | 215 | // 'command-line' or any action invocation, gets the 'platform data' from | |
| 216 | - | // the calling instance | |
| 216 | + | // the calling instance. Must chain up | |
| 217 | 217 | func (x *ApplicationClass) GetBeforeEmit() func(*Application, *glib.Variant) { | |
| 218 | 218 | if x.xBeforeEmit == 0 { | |
| 219 | 219 | return nil | |
| @@ -229,7 +229,7 @@ func (x *ApplicationClass) GetBeforeEmit() func(*Application, *glib.Variant) { | |||
| 229 | 229 | // invoked on the primary instance after 'activate', 'open', | |
| 230 | 230 | // | |
| 231 | 231 | // 'command-line' or any action invocation, gets the 'platform data' from | |
| 232 | - | // the calling instance | |
| 232 | + | // the calling instance. Must chain up | |
| 233 | 233 | func (x *ApplicationClass) OverrideAfterEmit(cb func(*Application, *glib.Variant)) { | |
| 234 | 234 | if cb == nil { | |
| 235 | 235 | x.xAfterEmit = 0 | |
| @@ -244,7 +244,7 @@ func (x *ApplicationClass) OverrideAfterEmit(cb func(*Application, *glib.Variant | |||
| 244 | 244 | // invoked on the primary instance after 'activate', 'open', | |
| 245 | 245 | // | |
| 246 | 246 | // 'command-line' or any action invocation, gets the 'platform data' from | |
| 247 | - | // the calling instance | |
| 247 | + | // the calling instance. Must chain up | |
| 248 | 248 | func (x *ApplicationClass) GetAfterEmit() func(*Application, *glib.Variant) { | |
| 249 | 249 | if x.xAfterEmit == 0 { | |
| 250 | 250 | return nil | |
| @@ -259,7 +259,7 @@ func (x *ApplicationClass) GetAfterEmit() func(*Application, *glib.Variant) { | |||
| 259 | 259 | // OverrideAddPlatformData sets the callback function. | |
| 260 | 260 | // invoked (locally) to add 'platform data' to be sent to | |
| 261 | 261 | // | |
| 262 | - | // the primary instance when activating, opening or invoking actions | |
| 262 | + | // the primary instance when activating, opening or invoking actions. Must chain up | |
| 263 | 263 | func (x *ApplicationClass) OverrideAddPlatformData(cb func(*Application, *glib.VariantBuilder)) { | |
| 264 | 264 | if cb == nil { | |
| 265 | 265 | x.xAddPlatformData = 0 | |
| @@ -273,7 +273,7 @@ func (x *ApplicationClass) OverrideAddPlatformData(cb func(*Application, *glib.V | |||
| 273 | 273 | // GetAddPlatformData gets the callback function. | |
| 274 | 274 | // invoked (locally) to add 'platform data' to be sent to | |
| 275 | 275 | // | |
| 276 | - | // the primary instance when activating, opening or invoking actions | |
| 276 | + | // the primary instance when activating, opening or invoking actions. Must chain up | |
| 277 | 277 | func (x *ApplicationClass) GetAddPlatformData() func(*Application, *glib.VariantBuilder) { | |
| 278 | 278 | if x.xAddPlatformData == 0 { | |
| 279 | 279 | return nil | |
M v4/gio/gdbuserror.go +41 -30
| @@ -10,7 +10,7 @@ import ( | |||
| 10 | 10 | "github.com/jwijenbergh/puregotk/v4/glib" | |
| 11 | 11 | ) | |
| 12 | 12 | ||
| 13 | - | // Struct used in g_dbus_error_register_error_domain(). | |
| 13 | + | // Struct used in [func@Gio.DBusError.register_error_domain]. | |
| 14 | 14 | type DBusErrorEntry struct { | |
| 15 | 15 | _ structs.HostLayout | |
| 16 | 16 | ||
| @@ -25,17 +25,20 @@ func (x *DBusErrorEntry) GoPointer() uintptr { | |||
| 25 | 25 | ||
| 26 | 26 | var xDbusErrorEncodeGerror func(*glib.Error) string | |
| 27 | 27 | ||
| 28 | - | // Creates a D-Bus error name to use for @error. If @error matches | |
| 29 | - | // a registered error (cf. g_dbus_error_register_error()), the corresponding | |
| 30 | - | // D-Bus error name will be returned. | |
| 28 | + | // Creates a D-Bus error name to use for @error. | |
| 29 | + | // | |
| 30 | + | // If @error matches a registered error (see | |
| 31 | + | // [func@Gio.DBusError.register_error]), the corresponding D-Bus error name | |
| 32 | + | // will be returned. | |
| 31 | 33 | // | |
| 32 | 34 | // Otherwise the a name of the form | |
| 33 | 35 | // `org.gtk.GDBus.UnmappedGError.Quark._ESCAPED_QUARK_NAME.Code_ERROR_CODE` | |
| 34 | 36 | // will be used. This allows other GDBus applications to map the error | |
| 35 | - | // on the wire back to a #GError using g_dbus_error_new_for_dbus_error(). | |
| 37 | + | // on the wire back to a [type@GLib.Error] using | |
| 38 | + | // [func@Gio.DBusError.new_for_dbus_error]. | |
| 36 | 39 | // | |
| 37 | 40 | // This function is typically only used in object mappings to put a | |
| 38 | - | // #GError on the wire. Regular applications should not use it. | |
| 41 | + | // [type@GLib.Error] on the wire. Regular applications should not use it. | |
| 39 | 42 | func DbusErrorEncodeGerror(ErrorVar *glib.Error) string { | |
| 40 | 43 | ||
| 41 | 44 | cret := xDbusErrorEncodeGerror(ErrorVar) | |
| @@ -47,9 +50,9 @@ var xDbusErrorGetRemoteError func(*glib.Error) string | |||
| 47 | 50 | // Gets the D-Bus error name used for @error, if any. | |
| 48 | 51 | // | |
| 49 | 52 | // This function is guaranteed to return a D-Bus error name for all | |
| 50 | - | // #GErrors returned from functions handling remote method calls | |
| 51 | - | // (e.g. g_dbus_connection_call_finish()) unless | |
| 52 | - | // g_dbus_error_strip_remote_error() has been used on @error. | |
| 53 | + | // [type@GLib.Error]s returned from functions handling remote method calls | |
| 54 | + | // (for example, [method@Gio.DBusConnection.call_finish]) unless | |
| 55 | + | // [func@Gio.DBusError.strip_remote_error] has already been used on @error. | |
| 53 | 56 | func DbusErrorGetRemoteError(ErrorVar *glib.Error) string { | |
| 54 | 57 | ||
| 55 | 58 | cret := xDbusErrorGetRemoteError(ErrorVar) | |
| @@ -58,8 +61,9 @@ func DbusErrorGetRemoteError(ErrorVar *glib.Error) string { | |||
| 58 | 61 | ||
| 59 | 62 | var xDbusErrorIsRemoteError func(*glib.Error) bool | |
| 60 | 63 | ||
| 61 | - | // Checks if @error represents an error received via D-Bus from a remote peer. If so, | |
| 62 | - | // use g_dbus_error_get_remote_error() to get the name of the error. | |
| 64 | + | // Checks if @error represents an error received via D-Bus from a remote peer. | |
| 65 | + | // | |
| 66 | + | // If so, use [func@Gio.DBusError.get_remote_error] to get the name of the error. | |
| 63 | 67 | func DbusErrorIsRemoteError(ErrorVar *glib.Error) bool { | |
| 64 | 68 | ||
| 65 | 69 | cret := xDbusErrorIsRemoteError(ErrorVar) | |
| @@ -68,32 +72,35 @@ func DbusErrorIsRemoteError(ErrorVar *glib.Error) bool { | |||
| 68 | 72 | ||
| 69 | 73 | var xDbusErrorNewForDbusError func(string, string) *glib.Error | |
| 70 | 74 | ||
| 71 | - | // Creates a #GError based on the contents of @dbus_error_name and | |
| 75 | + | // Creates a [type@GLib.Error] based on the contents of @dbus_error_name and | |
| 72 | 76 | // @dbus_error_message. | |
| 73 | 77 | // | |
| 74 | - | // Errors registered with g_dbus_error_register_error() will be looked | |
| 78 | + | // Errors registered with [func@Gio.DBusError.register_error] will be looked | |
| 75 | 79 | // up using @dbus_error_name and if a match is found, the error domain | |
| 76 | - | // and code is used. Applications can use g_dbus_error_get_remote_error() | |
| 80 | + | // and code is used. Applications can use [func@Gio.DBusError.get_remote_error] | |
| 77 | 81 | // to recover @dbus_error_name. | |
| 78 | 82 | // | |
| 79 | 83 | // If a match against a registered error is not found and the D-Bus | |
| 80 | - | // error name is in a form as returned by g_dbus_error_encode_gerror() | |
| 84 | + | // error name is in a form as returned by [func@Gio.DBusError.encode_gerror] | |
| 81 | 85 | // the error domain and code encoded in the name is used to | |
| 82 | - | // create the #GError. Also, @dbus_error_name is added to the error message | |
| 83 | - | // such that it can be recovered with g_dbus_error_get_remote_error(). | |
| 86 | + | // create the [type@GLib.Error]. Also, @dbus_error_name is added to the error | |
| 87 | + | // message such that it can be recovered with | |
| 88 | + | // [func@Gio.DBusError.get_remote_error]. | |
| 84 | 89 | // | |
| 85 | - | // Otherwise, a #GError with the error code %G_IO_ERROR_DBUS_ERROR | |
| 86 | - | // in the %G_IO_ERROR error domain is returned. Also, @dbus_error_name is | |
| 90 | + | // Otherwise, a [type@GLib.Error] with the error code | |
| 91 | + | // [error@Gio.IOErrorEnum.DBUS_ERROR] | |
| 92 | + | // in the [error@Gio.IOErrorEnum] error domain is returned. Also, @dbus_error_name is | |
| 87 | 93 | // added to the error message such that it can be recovered with | |
| 88 | - | // g_dbus_error_get_remote_error(). | |
| 94 | + | // [func@Gio.DBusError.get_remote_error]. | |
| 89 | 95 | // | |
| 90 | 96 | // In all three cases, @dbus_error_name can always be recovered from the | |
| 91 | - | // returned #GError using the g_dbus_error_get_remote_error() function | |
| 92 | - | // (unless g_dbus_error_strip_remote_error() hasn't been used on the returned error). | |
| 97 | + | // returned [type@GLib.Error] using the [func@Gio.DBusError.get_remote_error] | |
| 98 | + | // function (unless [func@Gio.DBusError.strip_remote_error] hasn’t been used on | |
| 99 | + | // the returned error). | |
| 93 | 100 | // | |
| 94 | 101 | // This function is typically only used in object mappings to prepare | |
| 95 | - | // #GError instances for applications. Regular applications should not use | |
| 96 | - | // it. | |
| 102 | + | // [type@GLib.Error] instances for applications. Regular applications should not | |
| 103 | + | // use it. | |
| 97 | 104 | func DbusErrorNewForDbusError(DbusErrorNameVar string, DbusErrorMessageVar string) *glib.Error { | |
| 98 | 105 | ||
| 99 | 106 | cret := xDbusErrorNewForDbusError(DbusErrorNameVar, DbusErrorMessageVar) | |
| @@ -102,10 +109,10 @@ func DbusErrorNewForDbusError(DbusErrorNameVar string, DbusErrorMessageVar strin | |||
| 102 | 109 | ||
| 103 | 110 | var xDbusErrorRegisterError func(glib.Quark, int, string) bool | |
| 104 | 111 | ||
| 105 | - | // Creates an association to map between @dbus_error_name and | |
| 106 | - | // #GErrors specified by @error_domain and @error_code. | |
| 112 | + | // Creates an association mapping between @dbus_error_name and | |
| 113 | + | // [type@GLib.Error]s specified by @error_domain and @error_code. | |
| 107 | 114 | // | |
| 108 | - | // This is typically done in the routine that returns the #GQuark for | |
| 115 | + | // This is typically done in the function that returns the [type@GLib.Quark] for | |
| 109 | 116 | // an error domain. | |
| 110 | 117 | func DbusErrorRegisterError(ErrorDomainVar glib.Quark, ErrorCodeVar int, DbusErrorNameVar string) bool { | |
| 111 | 118 | ||
| @@ -115,7 +122,8 @@ func DbusErrorRegisterError(ErrorDomainVar glib.Quark, ErrorCodeVar int, DbusErr | |||
| 115 | 122 | ||
| 116 | 123 | var xDbusErrorRegisterErrorDomain func(string, uint, []DBusErrorEntry, uint) | |
| 117 | 124 | ||
| 118 | - | // Helper function for associating a #GError error domain with D-Bus error names. | |
| 125 | + | // Helper function for associating a [type@GLib.Error] error domain with D-Bus | |
| 126 | + | // error names. | |
| 119 | 127 | // | |
| 120 | 128 | // While @quark_volatile has a `volatile` qualifier, this is a historical | |
| 121 | 129 | // artifact and the argument passed to it should not be `volatile`. | |
| @@ -128,7 +136,9 @@ func DbusErrorRegisterErrorDomain(ErrorDomainQuarkNameVar string, QuarkVolatileV | |||
| 128 | 136 | var xDbusErrorStripRemoteError func(*glib.Error) bool | |
| 129 | 137 | ||
| 130 | 138 | // Looks for extra information in the error message used to recover | |
| 131 | - | // the D-Bus error name and strips it if found. If stripped, the | |
| 139 | + | // the D-Bus error name and strips it if found. | |
| 140 | + | // | |
| 141 | + | // If stripped, the | |
| 132 | 142 | // message field in @error will correspond exactly to what was | |
| 133 | 143 | // received on the wire. | |
| 134 | 144 | // | |
| @@ -141,7 +151,8 @@ func DbusErrorStripRemoteError(ErrorVar *glib.Error) bool { | |||
| 141 | 151 | ||
| 142 | 152 | var xDbusErrorUnregisterError func(glib.Quark, int, string) bool | |
| 143 | 153 | ||
| 144 | - | // Destroys an association previously set up with g_dbus_error_register_error(). | |
| 154 | + | // Destroys an association previously set up with | |
| 155 | + | // [func@Gio.DBusError.register_error]. | |
| 145 | 156 | func DbusErrorUnregisterError(ErrorDomainVar glib.Quark, ErrorCodeVar int, DbusErrorNameVar string) bool { | |
| 146 | 157 | ||
| 147 | 158 | cret := xDbusErrorUnregisterError(ErrorDomainVar, ErrorCodeVar, DbusErrorNameVar) | |
M v4/gio/gdbusmessage.go +1 -1
| @@ -228,7 +228,7 @@ func (x *DBusMessage) GetInterface() string { | |||
| 228 | 228 | var xDBusMessageGetLocked func(uintptr) bool | |
| 229 | 229 | ||
| 230 | 230 | // Checks whether @message is locked. To monitor changes to this | |
| 231 | - | // value, conncet to the #GObject::notify signal to listen for changes | |
| 231 | + | // value, connect to the #GObject::notify signal to listen for changes | |
| 232 | 232 | // on the #GDBusMessage:locked property. | |
| 233 | 233 | func (x *DBusMessage) GetLocked() bool { | |
| 234 | 234 | ||
D v4/gio/gdesktopappinfo.go +0 -883
| @@ -1,883 +0,0 @@ | |||
| 1 | - | // Package gio was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT | |
| 2 | - | package gio | |
| 3 | - | ||
| 4 | - | import ( | |
| 5 | - | "structs" | |
| 6 | - | "unsafe" | |
| 7 | - | ||
| 8 | - | "github.com/jwijenbergh/purego" | |
| 9 | - | "github.com/jwijenbergh/puregotk/pkg/core" | |
| 10 | - | "github.com/jwijenbergh/puregotk/v4/glib" | |
| 11 | - | "github.com/jwijenbergh/puregotk/v4/gobject" | |
| 12 | - | "github.com/jwijenbergh/puregotk/v4/gobject/types" | |
| 13 | - | ) | |
| 14 | - | ||
| 15 | - | // During invocation, g_desktop_app_info_launch_uris_as_manager() may | |
| 16 | - | // create one or more child processes. This callback is invoked once | |
| 17 | - | // for each, providing the process ID. | |
| 18 | - | type DesktopAppLaunchCallback func(uintptr, glib.Pid, uintptr) | |
| 19 | - | ||
| 20 | - | type DesktopAppInfoClass struct { | |
| 21 | - | _ structs.HostLayout | |
| 22 | - | ||
| 23 | - | ParentClass gobject.ObjectClass | |
| 24 | - | } | |
| 25 | - | ||
| 26 | - | func (x *DesktopAppInfoClass) GoPointer() uintptr { | |
| 27 | - | return uintptr(unsafe.Pointer(x)) | |
| 28 | - | } | |
| 29 | - | ||
| 30 | - | // Interface that is used by backends to associate default | |
| 31 | - | // handlers with URI schemes. | |
| 32 | - | type DesktopAppInfoLookupIface struct { | |
| 33 | - | _ structs.HostLayout | |
| 34 | - | ||
| 35 | - | GIface uintptr | |
| 36 | - | ||
| 37 | - | xGetDefaultForUriScheme uintptr | |
| 38 | - | } | |
| 39 | - | ||
| 40 | - | func (x *DesktopAppInfoLookupIface) GoPointer() uintptr { | |
| 41 | - | return uintptr(unsafe.Pointer(x)) | |
| 42 | - | } | |
| 43 | - | ||
| 44 | - | // OverrideGetDefaultForUriScheme sets the callback function. | |
| 45 | - | // Virtual method for | |
| 46 | - | // | |
| 47 | - | // g_desktop_app_info_lookup_get_default_for_uri_scheme(). | |
| 48 | - | func (x *DesktopAppInfoLookupIface) OverrideGetDefaultForUriScheme(cb func(DesktopAppInfoLookup, string) *AppInfoBase) { | |
| 49 | - | if cb == nil { | |
| 50 | - | x.xGetDefaultForUriScheme = 0 | |
| 51 | - | } else { | |
| 52 | - | x.xGetDefaultForUriScheme = purego.NewCallback(func(LookupVarp uintptr, UriSchemeVarp string) uintptr { | |
| 53 | - | ret := cb(&DesktopAppInfoLookupBase{Ptr: LookupVarp}, UriSchemeVarp) | |
| 54 | - | if ret == nil { | |
| 55 | - | return 0 | |
| 56 | - | } | |
| 57 | - | return ret.GoPointer() | |
| 58 | - | }) | |
| 59 | - | } | |
| 60 | - | } | |
| 61 | - | ||
| 62 | - | // GetGetDefaultForUriScheme gets the callback function. | |
| 63 | - | // Virtual method for | |
| 64 | - | // | |
| 65 | - | // g_desktop_app_info_lookup_get_default_for_uri_scheme(). | |
| 66 | - | func (x *DesktopAppInfoLookupIface) GetGetDefaultForUriScheme() func(DesktopAppInfoLookup, string) *AppInfoBase { | |
| 67 | - | if x.xGetDefaultForUriScheme == 0 { | |
| 68 | - | return nil | |
| 69 | - | } | |
| 70 | - | var rawCallback func(LookupVarp uintptr, UriSchemeVarp string) uintptr | |
| 71 | - | purego.RegisterFunc(&rawCallback, x.xGetDefaultForUriScheme) | |
| 72 | - | return func(LookupVar DesktopAppInfoLookup, UriSchemeVar string) *AppInfoBase { | |
| 73 | - | rawRet := rawCallback(LookupVar.GoPointer(), UriSchemeVar) | |
| 74 | - | if rawRet == 0 { | |
| 75 | - | return nil | |
| 76 | - | } | |
| 77 | - | ret := &AppInfoBase{} | |
| 78 | - | ret.Ptr = rawRet | |
| 79 | - | return ret | |
| 80 | - | } | |
| 81 | - | } | |
| 82 | - | ||
| 83 | - | // #GDesktopAppInfoLookup is an opaque data structure and can only be accessed | |
| 84 | - | // using the following functions. | |
| 85 | - | type DesktopAppInfoLookup interface { | |
| 86 | - | GoPointer() uintptr | |
| 87 | - | SetGoPointer(uintptr) | |
| 88 | - | GetDefaultForUriScheme(UriSchemeVar string) *AppInfoBase | |
| 89 | - | } | |
| 90 | - | ||
| 91 | - | var xDesktopAppInfoLookupGLibType func() types.GType | |
| 92 | - | ||
| 93 | - | func DesktopAppInfoLookupGLibType() types.GType { | |
| 94 | - | return xDesktopAppInfoLookupGLibType() | |
| 95 | - | } | |
| 96 | - | ||
| 97 | - | type DesktopAppInfoLookupBase struct { | |
| 98 | - | Ptr uintptr | |
| 99 | - | } | |
| 100 | - | ||
| 101 | - | func (x *DesktopAppInfoLookupBase) GoPointer() uintptr { | |
| 102 | - | if x == nil { | |
| 103 | - | return 0 | |
| 104 | - | } | |
| 105 | - | return x.Ptr | |
| 106 | - | } | |
| 107 | - | ||
| 108 | - | func (x *DesktopAppInfoLookupBase) SetGoPointer(ptr uintptr) { | |
| 109 | - | x.Ptr = ptr | |
| 110 | - | } | |
| 111 | - | ||
| 112 | - | // Gets the default application for launching applications | |
| 113 | - | // using this URI scheme for a particular [iface@Gio.DesktopAppInfoLookup] | |
| 114 | - | // implementation. | |
| 115 | - | // | |
| 116 | - | // The [iface@Gio.DesktopAppInfoLookup] interface and this function is used | |
| 117 | - | // to implement [func@Gio.AppInfo.get_default_for_uri_scheme] backends | |
| 118 | - | // in a GIO module. There is no reason for applications to use it | |
| 119 | - | // directly. Applications should use | |
| 120 | - | // [func@Gio.AppInfo.get_default_for_uri_scheme]. | |
| 121 | - | func (x *DesktopAppInfoLookupBase) GetDefaultForUriScheme(UriSchemeVar string) *AppInfoBase { | |
| 122 | - | var cls *AppInfoBase | |
| 123 | - | ||
| 124 | - | cret := XGDesktopAppInfoLookupGetDefaultForUriScheme(x.GoPointer(), UriSchemeVar) | |
| 125 | - | ||
| 126 | - | if cret == 0 { | |
| 127 | - | return nil | |
| 128 | - | } | |
| 129 | - | cls = &AppInfoBase{} | |
| 130 | - | cls.Ptr = cret | |
| 131 | - | return cls | |
| 132 | - | } | |
| 133 | - | ||
| 134 | - | var XGDesktopAppInfoLookupGetDefaultForUriScheme func(uintptr, string) uintptr | |
| 135 | - | ||
| 136 | - | const ( | |
| 137 | - | // Extension point for default handler to URI association. See | |
| 138 | - | // [Extending GIO](overview.html#extending-gio). | |
| 139 | - | DESKTOP_APP_INFO_LOOKUP_EXTENSION_POINT_NAME string = "gio-desktop-app-info-lookup" | |
| 140 | - | ) | |
| 141 | - | ||
| 142 | - | // `GDesktopAppInfo` is an implementation of [iface@Gio.AppInfo] based on | |
| 143 | - | // desktop files. | |
| 144 | - | // | |
| 145 | - | // Note that `<gio/gdesktopappinfo.h>` belongs to the UNIX-specific | |
| 146 | - | // GIO interfaces, thus you have to use the `gio-unix-2.0.pc` pkg-config | |
| 147 | - | // file or the `GioUnix-2.0` GIR namespace when using it. | |
| 148 | - | type DesktopAppInfo struct { | |
| 149 | - | gobject.Object | |
| 150 | - | } | |
| 151 | - | ||
| 152 | - | var xDesktopAppInfoGLibType func() types.GType | |
| 153 | - | ||
| 154 | - | func DesktopAppInfoGLibType() types.GType { | |
| 155 | - | return xDesktopAppInfoGLibType() | |
| 156 | - | } | |
| 157 | - | ||
| 158 | - | func DesktopAppInfoNewFromInternalPtr(ptr uintptr) *DesktopAppInfo { | |
| 159 | - | cls := &DesktopAppInfo{} | |
| 160 | - | cls.Ptr = ptr | |
| 161 | - | return cls | |
| 162 | - | } | |
| 163 | - | ||
| 164 | - | var xNewDesktopAppInfo func(string) uintptr | |
| 165 | - | ||
| 166 | - | // Creates a new [class@Gio.DesktopAppInfo] based on a desktop file ID. | |
| 167 | - | // | |
| 168 | - | // A desktop file ID is the basename of the desktop file, including the | |
| 169 | - | // `.desktop` extension. GIO is looking for a desktop file with this name | |
| 170 | - | // in the `applications` subdirectories of the XDG | |
| 171 | - | // data directories (i.e. the directories specified in the `XDG_DATA_HOME` | |
| 172 | - | // and `XDG_DATA_DIRS` environment variables). GIO also supports the | |
| 173 | - | // prefix-to-subdirectory mapping that is described in the | |
| 174 | - | // [Menu Spec](http://standards.freedesktop.org/menu-spec/latest/) | |
| 175 | - | // (i.e. a desktop ID of `kde-foo.desktop` will match | |
| 176 | - | // `/usr/share/applications/kde/foo.desktop`). | |
| 177 | - | func NewDesktopAppInfo(DesktopIdVar string) *DesktopAppInfo { | |
| 178 | - | var cls *DesktopAppInfo | |
| 179 | - | ||
| 180 | - | cret := xNewDesktopAppInfo(DesktopIdVar) | |
| 181 | - | ||
| 182 | - | if cret == 0 { | |
| 183 | - | return nil | |
| 184 | - | } | |
| 185 | - | cls = &DesktopAppInfo{} | |
| 186 | - | cls.Ptr = cret | |
| 187 | - | return cls | |
| 188 | - | } | |
| 189 | - | ||
| 190 | - | var xNewDesktopAppInfoFromFilename func(string) uintptr | |
| 191 | - | ||
| 192 | - | // Creates a new [class@Gio.DesktopAppInfo]. | |
| 193 | - | func NewDesktopAppInfoFromFilename(FilenameVar string) *DesktopAppInfo { | |
| 194 | - | var cls *DesktopAppInfo | |
| 195 | - | ||
| 196 | - | cret := xNewDesktopAppInfoFromFilename(FilenameVar) | |
| 197 | - | ||
| 198 | - | if cret == 0 { | |
| 199 | - | return nil | |
| 200 | - | } | |
| 201 | - | cls = &DesktopAppInfo{} | |
| 202 | - | cls.Ptr = cret | |
| 203 | - | return cls | |
| 204 | - | } | |
| 205 | - | ||
| 206 | - | var xNewDesktopAppInfoFromKeyfile func(*glib.KeyFile) uintptr | |
| 207 | - | ||
| 208 | - | // Creates a new [class@Gio.DesktopAppInfo]. | |
| 209 | - | func NewDesktopAppInfoFromKeyfile(KeyFileVar *glib.KeyFile) *DesktopAppInfo { | |
| 210 | - | var cls *DesktopAppInfo | |
| 211 | - | ||
| 212 | - | cret := xNewDesktopAppInfoFromKeyfile(KeyFileVar) | |
| 213 | - | ||
| 214 | - | if cret == 0 { | |
| 215 | - | return nil | |
| 216 | - | } | |
| 217 | - | cls = &DesktopAppInfo{} | |
| 218 | - | cls.Ptr = cret | |
| 219 | - | return cls | |
| 220 | - | } | |
| 221 | - | ||
| 222 | - | var xDesktopAppInfoGetActionName func(uintptr, string) string | |
| 223 | - | ||
| 224 | - | // Gets the user-visible display name of the | |
| 225 | - | // [‘additional application actions’](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s11.html) | |
| 226 | - | // specified by @action_name. | |
| 227 | - | // | |
| 228 | - | // This corresponds to the `Name` key within the keyfile group for the | |
| 229 | - | // action. | |
| 230 | - | func (x *DesktopAppInfo) GetActionName(ActionNameVar string) string { | |
| 231 | - | ||
| 232 | - | cret := xDesktopAppInfoGetActionName(x.GoPointer(), ActionNameVar) | |
| 233 | - | return cret | |
| 234 | - | } | |
| 235 | - | ||
| 236 | - | var xDesktopAppInfoGetBoolean func(uintptr, string) bool | |
| 237 | - | ||
| 238 | - | // Looks up a boolean value in the keyfile backing @info. | |
| 239 | - | // | |
| 240 | - | // The @key is looked up in the `Desktop Entry` group. | |
| 241 | - | func (x *DesktopAppInfo) GetBoolean(KeyVar string) bool { | |
| 242 | - | ||
| 243 | - | cret := xDesktopAppInfoGetBoolean(x.GoPointer(), KeyVar) | |
| 244 | - | return cret | |
| 245 | - | } | |
| 246 | - | ||
| 247 | - | var xDesktopAppInfoGetCategories func(uintptr) string | |
| 248 | - | ||
| 249 | - | // Gets the categories from the desktop file. | |
| 250 | - | func (x *DesktopAppInfo) GetCategories() string { | |
| 251 | - | ||
| 252 | - | cret := xDesktopAppInfoGetCategories(x.GoPointer()) | |
| 253 | - | return cret | |
| 254 | - | } | |
| 255 | - | ||
| 256 | - | var xDesktopAppInfoGetFilename func(uintptr) string | |
| 257 | - | ||
| 258 | - | // When @info was created from a known filename, return it. In some | |
| 259 | - | // situations such as a [class@Gio.DesktopAppInfo] returned from | |
| 260 | - | // [ctor@Gio.DesktopAppInfo.new_from_keyfile], this function will return `NULL`. | |
| 261 | - | func (x *DesktopAppInfo) GetFilename() string { | |
| 262 | - | ||
| 263 | - | cret := xDesktopAppInfoGetFilename(x.GoPointer()) | |
| 264 | - | return cret | |
| 265 | - | } | |
| 266 | - | ||
| 267 | - | var xDesktopAppInfoGetGenericName func(uintptr) string | |
| 268 | - | ||
| 269 | - | // Gets the generic name from the desktop file. | |
| 270 | - | func (x *DesktopAppInfo) GetGenericName() string { | |
| 271 | - | ||
| 272 | - | cret := xDesktopAppInfoGetGenericName(x.GoPointer()) | |
| 273 | - | return cret | |
| 274 | - | } | |
| 275 | - | ||
| 276 | - | var xDesktopAppInfoGetIsHidden func(uintptr) bool | |
| 277 | - | ||
| 278 | - | // A desktop file is hidden if the | |
| 279 | - | // [`Hidden` key](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s06.html#key-hidden) | |
| 280 | - | // in it is set to `True`. | |
| 281 | - | func (x *DesktopAppInfo) GetIsHidden() bool { | |
| 282 | - | ||
| 283 | - | cret := xDesktopAppInfoGetIsHidden(x.GoPointer()) | |
| 284 | - | return cret | |
| 285 | - | } | |
| 286 | - | ||
| 287 | - | var xDesktopAppInfoGetKeywords func(uintptr) []string | |
| 288 | - | ||
| 289 | - | // Gets the keywords from the desktop file. | |
| 290 | - | func (x *DesktopAppInfo) GetKeywords() []string { | |
| 291 | - | ||
| 292 | - | cret := xDesktopAppInfoGetKeywords(x.GoPointer()) | |
| 293 | - | return cret | |
| 294 | - | } | |
| 295 | - | ||
| 296 | - | var xDesktopAppInfoGetLocaleString func(uintptr, string) string | |
| 297 | - | ||
| 298 | - | // Looks up a localized string value in the keyfile backing @info | |
| 299 | - | // translated to the current locale. | |
| 300 | - | // | |
| 301 | - | // The @key is looked up in the `Desktop Entry` group. | |
| 302 | - | func (x *DesktopAppInfo) GetLocaleString(KeyVar string) string { | |
| 303 | - | ||
| 304 | - | cret := xDesktopAppInfoGetLocaleString(x.GoPointer(), KeyVar) | |
| 305 | - | return cret | |
| 306 | - | } | |
| 307 | - | ||
| 308 | - | var xDesktopAppInfoGetNodisplay func(uintptr) bool | |
| 309 | - | ||
| 310 | - | // Gets the value of the | |
| 311 | - | // [`NoDisplay` key](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s06.html#key-nodisplay) | |
| 312 | - | // | |
| 313 | - | // which helps determine if the application info should be shown in menus. See | |
| 314 | - | // | |
| 315 | - | // `G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY` and [method@Gio.AppInfo.should_show]. | |
| 316 | - | func (x *DesktopAppInfo) GetNodisplay() bool { | |
| 317 | - | ||
| 318 | - | cret := xDesktopAppInfoGetNodisplay(x.GoPointer()) | |
| 319 | - | return cret | |
| 320 | - | } | |
| 321 | - | ||
| 322 | - | var xDesktopAppInfoGetShowIn func(uintptr, string) bool | |
| 323 | - | ||
| 324 | - | // Checks if the application info should be shown in menus that list available | |
| 325 | - | // applications for a specific name of the desktop, based on the | |
| 326 | - | // [`OnlyShowIn`](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s06.html#key-onlyshowin) | |
| 327 | - | // and [`NotShowIn`](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s06.html#key-notshowin) | |
| 328 | - | // keys. | |
| 329 | - | // | |
| 330 | - | // @desktop_env should typically be given as `NULL`, in which case the | |
| 331 | - | // `XDG_CURRENT_DESKTOP` environment variable is consulted. If you want | |
| 332 | - | // to override the default mechanism then you may specify @desktop_env, | |
| 333 | - | // but this is not recommended. | |
| 334 | - | // | |
| 335 | - | // Note that [method@Gio.AppInfo.should_show] for @info will include this check | |
| 336 | - | // (with `NULL` for @desktop_env) as well as additional checks. | |
| 337 | - | func (x *DesktopAppInfo) GetShowIn(DesktopEnvVar string) bool { | |
| 338 | - | ||
| 339 | - | cret := xDesktopAppInfoGetShowIn(x.GoPointer(), DesktopEnvVar) | |
| 340 | - | return cret | |
| 341 | - | } | |
| 342 | - | ||
| 343 | - | var xDesktopAppInfoGetStartupWmClass func(uintptr) string | |
| 344 | - | ||
| 345 | - | // Retrieves the `StartupWMClass` field from @info. This represents the | |
| 346 | - | // `WM_CLASS` property of the main window of the application, if launched | |
| 347 | - | // through @info. | |
| 348 | - | func (x *DesktopAppInfo) GetStartupWmClass() string { | |
| 349 | - | ||
| 350 | - | cret := xDesktopAppInfoGetStartupWmClass(x.GoPointer()) | |
| 351 | - | return cret | |
| 352 | - | } | |
| 353 | - | ||
| 354 | - | var xDesktopAppInfoGetString func(uintptr, string) string | |
| 355 | - | ||
| 356 | - | // Looks up a string value in the keyfile backing @info. | |
| 357 | - | // | |
| 358 | - | // The @key is looked up in the `Desktop Entry` group. | |
| 359 | - | func (x *DesktopAppInfo) GetString(KeyVar string) string { | |
| 360 | - | ||
| 361 | - | cret := xDesktopAppInfoGetString(x.GoPointer(), KeyVar) | |
| 362 | - | return cret | |
| 363 | - | } | |
| 364 | - | ||
| 365 | - | var xDesktopAppInfoGetStringList func(uintptr, string, uint) []string | |
| 366 | - | ||
| 367 | - | // Looks up a string list value in the keyfile backing @info. | |
| 368 | - | // | |
| 369 | - | // The @key is looked up in the `Desktop Entry` group. | |
| 370 | - | func (x *DesktopAppInfo) GetStringList(KeyVar string, LengthVar uint) []string { | |
| 371 | - | ||
| 372 | - | cret := xDesktopAppInfoGetStringList(x.GoPointer(), KeyVar, LengthVar) | |
| 373 | - | return cret | |
| 374 | - | } | |
| 375 | - | ||
| 376 | - | var xDesktopAppInfoHasKey func(uintptr, string) bool | |
| 377 | - | ||
| 378 | - | // Returns whether @key exists in the `Desktop Entry` group | |
| 379 | - | // of the keyfile backing @info. | |
| 380 | - | func (x *DesktopAppInfo) HasKey(KeyVar string) bool { | |
| 381 | - | ||
| 382 | - | cret := xDesktopAppInfoHasKey(x.GoPointer(), KeyVar) | |
| 383 | - | return cret | |
| 384 | - | } | |
| 385 | - | ||
| 386 | - | var xDesktopAppInfoLaunchAction func(uintptr, string, uintptr) | |
| 387 | - | ||
| 388 | - | // Activates the named application action. | |
| 389 | - | // | |
| 390 | - | // You may only call this function on action names that were | |
| 391 | - | // returned from [method@Gio.DesktopAppInfo.list_actions]. | |
| 392 | - | // | |
| 393 | - | // Note that if the main entry of the desktop file indicates that the | |
| 394 | - | // application supports startup notification, and @launch_context is | |
| 395 | - | // non-`NULL`, then startup notification will be used when activating the | |
| 396 | - | // action (and as such, invocation of the action on the receiving side | |
| 397 | - | // must signal the end of startup notification when it is completed). | |
| 398 | - | // This is the expected behaviour of applications declaring additional | |
| 399 | - | // actions, as per the | |
| 400 | - | // [desktop file specification](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s11.html). | |
| 401 | - | // | |
| 402 | - | // As with [method@Gio.AppInfo.launch] there is no way to detect failures that | |
| 403 | - | // occur while using this function. | |
| 404 | - | func (x *DesktopAppInfo) LaunchAction(ActionNameVar string, LaunchContextVar *AppLaunchContext) { | |
| 405 | - | ||
| 406 | - | xDesktopAppInfoLaunchAction(x.GoPointer(), ActionNameVar, LaunchContextVar.GoPointer()) | |
| 407 | - | ||
| 408 | - | } | |
| 409 | - | ||
| 410 | - | var xDesktopAppInfoLaunchUrisAsManager func(uintptr, *glib.List, uintptr, glib.SpawnFlags, uintptr, uintptr, uintptr, uintptr, **glib.Error) bool | |
| 411 | - | ||
| 412 | - | // This function performs the equivalent of [method@Gio.AppInfo.launch_uris], | |
| 413 | - | // but is intended primarily for operating system components that | |
| 414 | - | // launch applications. Ordinary applications should use | |
| 415 | - | // [method@Gio.AppInfo.launch_uris]. | |
| 416 | - | // | |
| 417 | - | // If the application is launched via GSpawn, then @spawn_flags, @user_setup | |
| 418 | - | // and @user_setup_data are used for the call to [func@GLib.spawn_async]. | |
| 419 | - | // Additionally, @pid_callback (with @pid_callback_data) will be called to | |
| 420 | - | // inform about the PID of the created process. See | |
| 421 | - | // [func@GLib.spawn_async_with_pipes] for information on certain parameter | |
| 422 | - | // conditions that can enable an optimized [`posix_spawn()`](man:posix_spawn(3)) | |
| 423 | - | // code path to be used. | |
| 424 | - | // | |
| 425 | - | // If application launching occurs via some other mechanism (for example, D-Bus | |
| 426 | - | // activation) then @spawn_flags, @user_setup, @user_setup_data, | |
| 427 | - | // @pid_callback and @pid_callback_data are ignored. | |
| 428 | - | func (x *DesktopAppInfo) LaunchUrisAsManager(UrisVar *glib.List, LaunchContextVar *AppLaunchContext, SpawnFlagsVar glib.SpawnFlags, UserSetupVar *glib.SpawnChildSetupFunc, UserSetupDataVar uintptr, PidCallbackVar *DesktopAppLaunchCallback, PidCallbackDataVar uintptr) (bool, error) { | |
| 429 | - | var cerr *glib.Error | |
| 430 | - | ||
| 431 | - | cret := xDesktopAppInfoLaunchUrisAsManager(x.GoPointer(), UrisVar, LaunchContextVar.GoPointer(), SpawnFlagsVar, glib.NewCallbackNullable(UserSetupVar), UserSetupDataVar, glib.NewCallbackNullable(PidCallbackVar), PidCallbackDataVar, &cerr) | |
| 432 | - | if cerr == nil { | |
| 433 | - | return cret, nil | |
| 434 | - | } | |
| 435 | - | return cret, cerr | |
| 436 | - | ||
| 437 | - | } | |
| 438 | - | ||
| 439 | - | var xDesktopAppInfoLaunchUrisAsManagerWithFds func(uintptr, *glib.List, uintptr, glib.SpawnFlags, uintptr, uintptr, uintptr, uintptr, int, int, int, **glib.Error) bool | |
| 440 | - | ||
| 441 | - | // Equivalent to [method@Gio.DesktopAppInfo.launch_uris_as_manager] but allows | |
| 442 | - | // you to pass in file descriptors for the stdin, stdout and stderr streams | |
| 443 | - | // of the launched process. | |
| 444 | - | // | |
| 445 | - | // If application launching occurs via some non-spawn mechanism (e.g. D-Bus | |
| 446 | - | // activation) then @stdin_fd, @stdout_fd and @stderr_fd are ignored. | |
| 447 | - | func (x *DesktopAppInfo) LaunchUrisAsManagerWithFds(UrisVar *glib.List, LaunchContextVar *AppLaunchContext, SpawnFlagsVar glib.SpawnFlags, UserSetupVar *glib.SpawnChildSetupFunc, UserSetupDataVar uintptr, PidCallbackVar *DesktopAppLaunchCallback, PidCallbackDataVar uintptr, StdinFdVar int, StdoutFdVar int, StderrFdVar int) (bool, error) { | |
| 448 | - | var cerr *glib.Error | |
| 449 | - | ||
| 450 | - | cret := xDesktopAppInfoLaunchUrisAsManagerWithFds(x.GoPointer(), UrisVar, LaunchContextVar.GoPointer(), SpawnFlagsVar, glib.NewCallbackNullable(UserSetupVar), UserSetupDataVar, glib.NewCallbackNullable(PidCallbackVar), PidCallbackDataVar, StdinFdVar, StdoutFdVar, StderrFdVar, &cerr) | |
| 451 | - | if cerr == nil { | |
| 452 | - | return cret, nil | |
| 453 | - | } | |
| 454 | - | return cret, cerr | |
| 455 | - | ||
| 456 | - | } | |
| 457 | - | ||
| 458 | - | var xDesktopAppInfoListActions func(uintptr) []string | |
| 459 | - | ||
| 460 | - | // Returns the list of | |
| 461 | - | // [‘additional application actions’](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s11.html) | |
| 462 | - | // supported on the desktop file, as per the desktop file specification. | |
| 463 | - | // | |
| 464 | - | // As per the specification, this is the list of actions that are | |
| 465 | - | // explicitly listed in the `Actions` key of the `Desktop Entry` group. | |
| 466 | - | func (x *DesktopAppInfo) ListActions() []string { | |
| 467 | - | ||
| 468 | - | cret := xDesktopAppInfoListActions(x.GoPointer()) | |
| 469 | - | return cret | |
| 470 | - | } | |
| 471 | - | ||
| 472 | - | func (c *DesktopAppInfo) GoPointer() uintptr { | |
| 473 | - | if c == nil { | |
| 474 | - | return 0 | |
| 475 | - | } | |
| 476 | - | return c.Ptr | |
| 477 | - | } | |
| 478 | - | ||
| 479 | - | func (c *DesktopAppInfo) SetGoPointer(ptr uintptr) { | |
| 480 | - | c.Ptr = ptr | |
| 481 | - | } | |
| 482 | - | ||
| 483 | - | // Adds a content type to the application information to indicate the | |
| 484 | - | // application is capable of opening files with the given content type. | |
| 485 | - | func (x *DesktopAppInfo) AddSupportsType(ContentTypeVar string) (bool, error) { | |
| 486 | - | var cerr *glib.Error | |
| 487 | - | ||
| 488 | - | cret := XGAppInfoAddSupportsType(x.GoPointer(), ContentTypeVar, &cerr) | |
| 489 | - | if cerr == nil { | |
| 490 | - | return cret, nil | |
| 491 | - | } | |
| 492 | - | return cret, cerr | |
| 493 | - | ||
| 494 | - | } | |
| 495 | - | ||
| 496 | - | // Obtains the information whether the [iface@Gio.AppInfo] can be deleted. | |
| 497 | - | // See [method@Gio.AppInfo.delete]. | |
| 498 | - | func (x *DesktopAppInfo) CanDelete() bool { | |
| 499 | - | ||
| 500 | - | cret := XGAppInfoCanDelete(x.GoPointer()) | |
| 501 | - | return cret | |
| 502 | - | } | |
| 503 | - | ||
| 504 | - | // Checks if a supported content type can be removed from an application. | |
| 505 | - | func (x *DesktopAppInfo) CanRemoveSupportsType() bool { | |
| 506 | - | ||
| 507 | - | cret := XGAppInfoCanRemoveSupportsType(x.GoPointer()) | |
| 508 | - | return cret | |
| 509 | - | } | |
| 510 | - | ||
| 511 | - | // Tries to delete a [iface@Gio.AppInfo]. | |
| 512 | - | // | |
| 513 | - | // On some platforms, there may be a difference between user-defined | |
| 514 | - | // [iface@Gio.AppInfo]s which can be deleted, and system-wide ones which cannot. | |
| 515 | - | // See [method@Gio.AppInfo.can_delete]. | |
| 516 | - | func (x *DesktopAppInfo) Delete() bool { | |
| 517 | - | ||
| 518 | - | cret := XGAppInfoDelete(x.GoPointer()) | |
| 519 | - | return cret | |
| 520 | - | } | |
| 521 | - | ||
| 522 | - | // Creates a duplicate of a [iface@Gio.AppInfo]. | |
| 523 | - | func (x *DesktopAppInfo) Dup() *AppInfoBase { | |
| 524 | - | var cls *AppInfoBase | |
| 525 | - | ||
| 526 | - | cret := XGAppInfoDup(x.GoPointer()) | |
| 527 | - | ||
| 528 | - | if cret == 0 { | |
| 529 | - | return nil | |
| 530 | - | } | |
| 531 | - | cls = &AppInfoBase{} | |
| 532 | - | cls.Ptr = cret | |
| 533 | - | return cls | |
| 534 | - | } | |
| 535 | - | ||
| 536 | - | // Checks if two [iface@Gio.AppInfo]s are equal. | |
| 537 | - | // | |
| 538 | - | // Note that the check *may not* compare each individual field, and only does | |
| 539 | - | // an identity check. In case detecting changes in the contents is needed, | |
| 540 | - | // program code must additionally compare relevant fields. | |
| 541 | - | func (x *DesktopAppInfo) Equal(Appinfo2Var AppInfo) bool { | |
| 542 | - | ||
| 543 | - | cret := XGAppInfoEqual(x.GoPointer(), Appinfo2Var.GoPointer()) | |
| 544 | - | return cret | |
| 545 | - | } | |
| 546 | - | ||
| 547 | - | // Gets the commandline with which the application will be | |
| 548 | - | // started. | |
| 549 | - | func (x *DesktopAppInfo) GetCommandline() string { | |
| 550 | - | ||
| 551 | - | cret := XGAppInfoGetCommandline(x.GoPointer()) | |
| 552 | - | return cret | |
| 553 | - | } | |
| 554 | - | ||
| 555 | - | // Gets a human-readable description of an installed application. | |
| 556 | - | func (x *DesktopAppInfo) GetDescription() string { | |
| 557 | - | ||
| 558 | - | cret := XGAppInfoGetDescription(x.GoPointer()) | |
| 559 | - | return cret | |
| 560 | - | } | |
| 561 | - | ||
| 562 | - | // Gets the display name of the application. The display name is often more | |
| 563 | - | // descriptive to the user than the name itself. | |
| 564 | - | func (x *DesktopAppInfo) GetDisplayName() string { | |
| 565 | - | ||
| 566 | - | cret := XGAppInfoGetDisplayName(x.GoPointer()) | |
| 567 | - | return cret | |
| 568 | - | } | |
| 569 | - | ||
| 570 | - | // Gets the executable’s name for the installed application. | |
| 571 | - | // | |
| 572 | - | // This is intended to be used for debugging or labelling what program is going | |
| 573 | - | // to be run. To launch the executable, use [method@Gio.AppInfo.launch] and related | |
| 574 | - | // functions, rather than spawning the return value from this function. | |
| 575 | - | func (x *DesktopAppInfo) GetExecutable() string { | |
| 576 | - | ||
| 577 | - | cret := XGAppInfoGetExecutable(x.GoPointer()) | |
| 578 | - | return cret | |
| 579 | - | } | |
| 580 | - | ||
| 581 | - | // Gets the icon for the application. | |
| 582 | - | func (x *DesktopAppInfo) GetIcon() *IconBase { | |
| 583 | - | var cls *IconBase | |
| 584 | - | ||
| 585 | - | cret := XGAppInfoGetIcon(x.GoPointer()) | |
| 586 | - | ||
| 587 | - | if cret == 0 { | |
| 588 | - | return nil | |
| 589 | - | } | |
| 590 | - | gobject.IncreaseRef(cret) | |
| 591 | - | cls = &IconBase{} | |
| 592 | - | cls.Ptr = cret | |
| 593 | - | return cls | |
| 594 | - | } | |
| 595 | - | ||
| 596 | - | // Gets the ID of an application. An id is a string that identifies the | |
| 597 | - | // application. The exact format of the id is platform dependent. For instance, | |
| 598 | - | // on Unix this is the desktop file id from the xdg menu specification. | |
| 599 | - | // | |
| 600 | - | // Note that the returned ID may be `NULL`, depending on how the @appinfo has | |
| 601 | - | // been constructed. | |
| 602 | - | func (x *DesktopAppInfo) GetId() string { | |
| 603 | - | ||
| 604 | - | cret := XGAppInfoGetId(x.GoPointer()) | |
| 605 | - | return cret | |
| 606 | - | } | |
| 607 | - | ||
| 608 | - | // Gets the installed name of the application. | |
| 609 | - | func (x *DesktopAppInfo) GetName() string { | |
| 610 | - | ||
| 611 | - | cret := XGAppInfoGetName(x.GoPointer()) | |
| 612 | - | return cret | |
| 613 | - | } | |
| 614 | - | ||
| 615 | - | // Retrieves the list of content types that @app_info claims to support. | |
| 616 | - | // If this information is not provided by the environment, this function | |
| 617 | - | // will return `NULL`. | |
| 618 | - | // | |
| 619 | - | // This function does not take in consideration associations added with | |
| 620 | - | // [method@Gio.AppInfo.add_supports_type], but only those exported directly by | |
| 621 | - | // the application. | |
| 622 | - | func (x *DesktopAppInfo) GetSupportedTypes() []string { | |
| 623 | - | ||
| 624 | - | cret := XGAppInfoGetSupportedTypes(x.GoPointer()) | |
| 625 | - | return cret | |
| 626 | - | } | |
| 627 | - | ||
| 628 | - | // Launches the application. Passes @files to the launched application | |
| 629 | - | // as arguments, using the optional @context to get information | |
| 630 | - | // about the details of the launcher (like what screen it is on). | |
| 631 | - | // On error, @error will be set accordingly. | |
| 632 | - | // | |
| 633 | - | // To launch the application without arguments pass a `NULL` @files list. | |
| 634 | - | // | |
| 635 | - | // Note that even if the launch is successful the application launched | |
| 636 | - | // can fail to start if it runs into problems during startup. There is | |
| 637 | - | // no way to detect this. | |
| 638 | - | // | |
| 639 | - | // Some URIs can be changed when passed through a GFile (for instance | |
| 640 | - | // unsupported URIs with strange formats like mailto:), so if you have | |
| 641 | - | // a textual URI you want to pass in as argument, consider using | |
| 642 | - | // [method@Gio.AppInfo.launch_uris] instead. | |
| 643 | - | // | |
| 644 | - | // The launched application inherits the environment of the launching | |
| 645 | - | // process, but it can be modified with [method@Gio.AppLaunchContext.setenv] | |
| 646 | - | // and [method@Gio.AppLaunchContext.unsetenv]. | |
| 647 | - | // | |
| 648 | - | // On UNIX, this function sets the `GIO_LAUNCHED_DESKTOP_FILE` | |
| 649 | - | // environment variable with the path of the launched desktop file and | |
| 650 | - | // `GIO_LAUNCHED_DESKTOP_FILE_PID` to the process id of the launched | |
| 651 | - | // process. This can be used to ignore `GIO_LAUNCHED_DESKTOP_FILE`, | |
| 652 | - | // should it be inherited by further processes. The `DISPLAY`, | |
| 653 | - | // `XDG_ACTIVATION_TOKEN` and `DESKTOP_STARTUP_ID` environment | |
| 654 | - | // variables are also set, based on information provided in @context. | |
| 655 | - | func (x *DesktopAppInfo) Launch(FilesVar *glib.List, ContextVar *AppLaunchContext) (bool, error) { | |
| 656 | - | var cerr *glib.Error | |
| 657 | - | ||
| 658 | - | cret := XGAppInfoLaunch(x.GoPointer(), FilesVar, ContextVar.GoPointer(), &cerr) | |
| 659 | - | if cerr == nil { | |
| 660 | - | return cret, nil | |
| 661 | - | } | |
| 662 | - | return cret, cerr | |
| 663 | - | ||
| 664 | - | } | |
| 665 | - | ||
| 666 | - | // Launches the application. This passes the @uris to the launched application | |
| 667 | - | // as arguments, using the optional @context to get information | |
| 668 | - | // about the details of the launcher (like what screen it is on). | |
| 669 | - | // On error, @error will be set accordingly. If the application only supports | |
| 670 | - | // one URI per invocation as part of their command-line, multiple instances | |
| 671 | - | // of the application will be spawned. | |
| 672 | - | // | |
| 673 | - | // To launch the application without arguments pass a `NULL` @uris list. | |
| 674 | - | // | |
| 675 | - | // Note that even if the launch is successful the application launched | |
| 676 | - | // can fail to start if it runs into problems during startup. There is | |
| 677 | - | // no way to detect this. | |
| 678 | - | func (x *DesktopAppInfo) LaunchUris(UrisVar *glib.List, ContextVar *AppLaunchContext) (bool, error) { | |
| 679 | - | var cerr *glib.Error | |
| 680 | - | ||
| 681 | - | cret := XGAppInfoLaunchUris(x.GoPointer(), UrisVar, ContextVar.GoPointer(), &cerr) | |
| 682 | - | if cerr == nil { | |
| 683 | - | return cret, nil | |
| 684 | - | } | |
| 685 | - | return cret, cerr | |
| 686 | - | ||
| 687 | - | } | |
| 688 | - | ||
| 689 | - | // Async version of [method@Gio.AppInfo.launch_uris]. | |
| 690 | - | // | |
| 691 | - | // The @callback is invoked immediately after the application launch, but it | |
| 692 | - | // waits for activation in case of D-Bus–activated applications and also provides | |
| 693 | - | // extended error information for sandboxed applications, see notes for | |
| 694 | - | // [func@Gio.AppInfo.launch_default_for_uri_async]. | |
| 695 | - | func (x *DesktopAppInfo) LaunchUrisAsync(UrisVar *glib.List, ContextVar *AppLaunchContext, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { | |
| 696 | - | ||
| 697 | - | XGAppInfoLaunchUrisAsync(x.GoPointer(), UrisVar, ContextVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar) | |
| 698 | - | ||
| 699 | - | } | |
| 700 | - | ||
| 701 | - | // Finishes a [method@Gio.AppInfo.launch_uris_async] operation. | |
| 702 | - | func (x *DesktopAppInfo) LaunchUrisFinish(ResultVar AsyncResult) (bool, error) { | |
| 703 | - | var cerr *glib.Error | |
| 704 | - | ||
| 705 | - | cret := XGAppInfoLaunchUrisFinish(x.GoPointer(), ResultVar.GoPointer(), &cerr) | |
| 706 | - | if cerr == nil { | |
| 707 | - | return cret, nil | |
| 708 | - | } | |
| 709 | - | return cret, cerr | |
| 710 | - | ||
| 711 | - | } | |
| 712 | - | ||
| 713 | - | // Removes a supported type from an application, if possible. | |
| 714 | - | func (x *DesktopAppInfo) RemoveSupportsType(ContentTypeVar string) (bool, error) { | |
| 715 | - | var cerr *glib.Error | |
| 716 | - | ||
| 717 | - | cret := XGAppInfoRemoveSupportsType(x.GoPointer(), ContentTypeVar, &cerr) | |
| 718 | - | if cerr == nil { | |
| 719 | - | return cret, nil | |
| 720 | - | } | |
| 721 | - | return cret, cerr | |
| 722 | - | ||
| 723 | - | } | |
| 724 | - | ||
| 725 | - | // Sets the application as the default handler for the given file extension. | |
| 726 | - | func (x *DesktopAppInfo) SetAsDefaultForExtension(ExtensionVar string) (bool, error) { | |
| 727 | - | var cerr *glib.Error | |
| 728 | - | ||
| 729 | - | cret := XGAppInfoSetAsDefaultForExtension(x.GoPointer(), ExtensionVar, &cerr) | |
| 730 | - | if cerr == nil { | |
| 731 | - | return cret, nil | |
| 732 | - | } | |
| 733 | - | return cret, cerr | |
| 734 | - | ||
| 735 | - | } | |
| 736 | - | ||
| 737 | - | // Sets the application as the default handler for a given type. | |
| 738 | - | func (x *DesktopAppInfo) SetAsDefaultForType(ContentTypeVar string) (bool, error) { | |
| 739 | - | var cerr *glib.Error | |
| 740 | - | ||
| 741 | - | cret := XGAppInfoSetAsDefaultForType(x.GoPointer(), ContentTypeVar, &cerr) | |
| 742 | - | if cerr == nil { | |
| 743 | - | return cret, nil | |
| 744 | - | } | |
| 745 | - | return cret, cerr | |
| 746 | - | ||
| 747 | - | } | |
| 748 | - | ||
| 749 | - | // Sets the application as the last used application for a given type. This | |
| 750 | - | // will make the application appear as first in the list returned by | |
| 751 | - | // [func@Gio.AppInfo.get_recommended_for_type], regardless of the default | |
| 752 | - | // application for that content type. | |
| 753 | - | func (x *DesktopAppInfo) SetAsLastUsedForType(ContentTypeVar string) (bool, error) { | |
| 754 | - | var cerr *glib.Error | |
| 755 | - | ||
| 756 | - | cret := XGAppInfoSetAsLastUsedForType(x.GoPointer(), ContentTypeVar, &cerr) | |
| 757 | - | if cerr == nil { | |
| 758 | - | return cret, nil | |
| 759 | - | } | |
| 760 | - | return cret, cerr | |
| 761 | - | ||
| 762 | - | } | |
| 763 | - | ||
| 764 | - | // Checks if the application info should be shown in menus that | |
| 765 | - | // list available applications. | |
| 766 | - | func (x *DesktopAppInfo) ShouldShow() bool { | |
| 767 | - | ||
| 768 | - | cret := XGAppInfoShouldShow(x.GoPointer()) | |
| 769 | - | return cret | |
| 770 | - | } | |
| 771 | - | ||
| 772 | - | // Checks if the application accepts files as arguments. | |
| 773 | - | func (x *DesktopAppInfo) SupportsFiles() bool { | |
| 774 | - | ||
| 775 | - | cret := XGAppInfoSupportsFiles(x.GoPointer()) | |
| 776 | - | return cret | |
| 777 | - | } | |
| 778 | - | ||
| 779 | - | // Checks if the application supports reading files and directories from URIs. | |
| 780 | - | func (x *DesktopAppInfo) SupportsUris() bool { | |
| 781 | - | ||
| 782 | - | cret := XGAppInfoSupportsUris(x.GoPointer()) | |
| 783 | - | return cret | |
| 784 | - | } | |
| 785 | - | ||
| 786 | - | var xDesktopAppInfoGetImplementations func(string) *glib.List | |
| 787 | - | ||
| 788 | - | // Gets all applications that implement @interface. | |
| 789 | - | // | |
| 790 | - | // An application implements an interface if that interface is listed in | |
| 791 | - | // the `Implements` line of the desktop file of the application. | |
| 792 | - | func DesktopAppInfoGetImplementations(InterfaceVar string) *glib.List { | |
| 793 | - | ||
| 794 | - | cret := xDesktopAppInfoGetImplementations(InterfaceVar) | |
| 795 | - | return cret | |
| 796 | - | } | |
| 797 | - | ||
| 798 | - | var xDesktopAppInfoSearch func(string) uintptr | |
| 799 | - | ||
| 800 | - | // Searches desktop files for ones that match @search_string. | |
| 801 | - | // | |
| 802 | - | // The return value is an array of strvs. Each strv contains a list of | |
| 803 | - | // applications that matched @search_string with an equal score. The | |
| 804 | - | // outer list is sorted by score so that the first strv contains the | |
| 805 | - | // best-matching applications, and so on. | |
| 806 | - | // The algorithm for determining matches is undefined and may change at | |
| 807 | - | // any time. | |
| 808 | - | // | |
| 809 | - | // None of the search results are subjected to the normal validation | |
| 810 | - | // checks performed by [ctor@Gio.DesktopAppInfo.new] (for example, checking that | |
| 811 | - | // the executable referenced by a result exists), and so it is possible for | |
| 812 | - | // [ctor@Gio.DesktopAppInfo.new] to return `NULL` when passed an app ID returned | |
| 813 | - | // by this function. It is expected that calling code will do this when | |
| 814 | - | // subsequently creating a [class@Gio.DesktopAppInfo] for each result. | |
| 815 | - | func DesktopAppInfoSearch(SearchStringVar string) uintptr { | |
| 816 | - | ||
| 817 | - | cret := xDesktopAppInfoSearch(SearchStringVar) | |
| 818 | - | return cret | |
| 819 | - | } | |
| 820 | - | ||
| 821 | - | var xDesktopAppInfoSetDesktopEnv func(string) | |
| 822 | - | ||
| 823 | - | // Sets the name of the desktop that the application is running in. | |
| 824 | - | // | |
| 825 | - | // This is used by [method@Gio.AppInfo.should_show] and | |
| 826 | - | // [method@Gio.DesktopAppInfo.get_show_in] to evaluate the | |
| 827 | - | // [`OnlyShowIn`](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s06.html#key-onlyshowin) | |
| 828 | - | // and [`NotShowIn`](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s06.html#key-notshowin) | |
| 829 | - | // keys. | |
| 830 | - | // | |
| 831 | - | // Should be called only once; subsequent calls are ignored. | |
| 832 | - | func DesktopAppInfoSetDesktopEnv(DesktopEnvVar string) { | |
| 833 | - | ||
| 834 | - | xDesktopAppInfoSetDesktopEnv(DesktopEnvVar) | |
| 835 | - | ||
| 836 | - | } | |
| 837 | - | ||
| 838 | - | func init() { | |
| 839 | - | core.SetPackageName("GIO", "gio-2.0") | |
| 840 | - | core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"}) | |
| 841 | - | var libs []uintptr | |
| 842 | - | for _, libPath := range core.GetPaths("GIO") { | |
| 843 | - | lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) | |
| 844 | - | if err != nil { | |
| 845 | - | panic(err) | |
| 846 | - | } | |
| 847 | - | libs = append(libs, lib) | |
| 848 | - | } | |
| 849 | - | ||
| 850 | - | core.PuregoSafeRegister(&xDesktopAppInfoGLibType, libs, "g_desktop_app_info_get_type") | |
| 851 | - | ||
| 852 | - | core.PuregoSafeRegister(&xNewDesktopAppInfo, libs, "g_desktop_app_info_new") | |
| 853 | - | core.PuregoSafeRegister(&xNewDesktopAppInfoFromFilename, libs, "g_desktop_app_info_new_from_filename") | |
| 854 | - | core.PuregoSafeRegister(&xNewDesktopAppInfoFromKeyfile, libs, "g_desktop_app_info_new_from_keyfile") | |
| 855 | - | ||
| 856 | - | core.PuregoSafeRegister(&xDesktopAppInfoGetActionName, libs, "g_desktop_app_info_get_action_name") | |
| 857 | - | core.PuregoSafeRegister(&xDesktopAppInfoGetBoolean, libs, "g_desktop_app_info_get_boolean") | |
| 858 | - | core.PuregoSafeRegister(&xDesktopAppInfoGetCategories, libs, "g_desktop_app_info_get_categories") | |
| 859 | - | core.PuregoSafeRegister(&xDesktopAppInfoGetFilename, libs, "g_desktop_app_info_get_filename") | |
| 860 | - | core.PuregoSafeRegister(&xDesktopAppInfoGetGenericName, libs, "g_desktop_app_info_get_generic_name") | |
| 861 | - | core.PuregoSafeRegister(&xDesktopAppInfoGetIsHidden, libs, "g_desktop_app_info_get_is_hidden") | |
| 862 | - | core.PuregoSafeRegister(&xDesktopAppInfoGetKeywords, libs, "g_desktop_app_info_get_keywords") | |
| 863 | - | core.PuregoSafeRegister(&xDesktopAppInfoGetLocaleString, libs, "g_desktop_app_info_get_locale_string") | |
| 864 | - | core.PuregoSafeRegister(&xDesktopAppInfoGetNodisplay, libs, "g_desktop_app_info_get_nodisplay") | |
| 865 | - | core.PuregoSafeRegister(&xDesktopAppInfoGetShowIn, libs, "g_desktop_app_info_get_show_in") | |
| 866 | - | core.PuregoSafeRegister(&xDesktopAppInfoGetStartupWmClass, libs, "g_desktop_app_info_get_startup_wm_class") | |
| 867 | - | core.PuregoSafeRegister(&xDesktopAppInfoGetString, libs, "g_desktop_app_info_get_string") | |
| 868 | - | core.PuregoSafeRegister(&xDesktopAppInfoGetStringList, libs, "g_desktop_app_info_get_string_list") | |
| 869 | - | core.PuregoSafeRegister(&xDesktopAppInfoHasKey, libs, "g_desktop_app_info_has_key") | |
| 870 | - | core.PuregoSafeRegister(&xDesktopAppInfoLaunchAction, libs, "g_desktop_app_info_launch_action") | |
| 871 | - | core.PuregoSafeRegister(&xDesktopAppInfoLaunchUrisAsManager, libs, "g_desktop_app_info_launch_uris_as_manager") | |
| 872 | - | core.PuregoSafeRegister(&xDesktopAppInfoLaunchUrisAsManagerWithFds, libs, "g_desktop_app_info_launch_uris_as_manager_with_fds") | |
| 873 | - | core.PuregoSafeRegister(&xDesktopAppInfoListActions, libs, "g_desktop_app_info_list_actions") | |
| 874 | - | ||
| 875 | - | core.PuregoSafeRegister(&xDesktopAppInfoGetImplementations, libs, "g_desktop_app_info_get_implementations") | |
| 876 | - | core.PuregoSafeRegister(&xDesktopAppInfoSearch, libs, "g_desktop_app_info_search") | |
| 877 | - | core.PuregoSafeRegister(&xDesktopAppInfoSetDesktopEnv, libs, "g_desktop_app_info_set_desktop_env") | |
| 878 | - | ||
| 879 | - | core.PuregoSafeRegister(&xDesktopAppInfoLookupGLibType, libs, "g_desktop_app_info_lookup_get_type") | |
| 880 | - | ||
| 881 | - | core.PuregoSafeRegister(&XGDesktopAppInfoLookupGetDefaultForUriScheme, libs, "g_desktop_app_info_lookup_get_default_for_uri_scheme") | |
| 882 | - | ||
| 883 | - | } | |
M v4/gio/gfile.go +26 -13
| @@ -5042,35 +5042,48 @@ func (x *FileBase) QueryFilesystemInfoFinish(ResVar AsyncResult) (*FileInfo, err | |||
| 5042 | 5042 | } | |
| 5043 | 5043 | ||
| 5044 | 5044 | // Gets the requested information about specified @file. | |
| 5045 | - | // The result is a #GFileInfo object that contains key-value | |
| 5045 | + | // | |
| 5046 | + | // The result is a [class@Gio.FileInfo] object that contains key-value | |
| 5046 | 5047 | // attributes (such as the type or size of the file). | |
| 5047 | 5048 | // | |
| 5048 | 5049 | // The @attributes value is a string that specifies the file | |
| 5049 | 5050 | // attributes that should be gathered. It is not an error if | |
| 5050 | - | // it's not possible to read a particular requested attribute | |
| 5051 | - | // from a file - it just won't be set. @attributes should be a | |
| 5052 | - | // comma-separated list of attributes or attribute wildcards. | |
| 5053 | - | // The wildcard "*" means all attributes, and a wildcard like | |
| 5054 | - | // "standard::*" means all attributes in the standard namespace. | |
| 5055 | - | // An example attribute query be "standard::*,owner::user". | |
| 5051 | + | // it’s not possible to read a particular requested attribute | |
| 5052 | + | // from a file — it just won't be set. In particular this means that if a file | |
| 5053 | + | // is inaccessible (due to being in a folder with restrictive permissions), for | |
| 5054 | + | // example, you can expect the returned [class@Gio.FileInfo] to have very few | |
| 5055 | + | // attributes set. You should check whether an attribute is set using | |
| 5056 | + | // [method@Gio.FileInfo.has_attribute] before trying to retrieve its value. | |
| 5057 | + | // | |
| 5058 | + | // It is guaranteed that if any of the following attributes are listed in | |
| 5059 | + | // @attributes, they will always be set in the returned [class@Gio.FileInfo], | |
| 5060 | + | // even if the user doesn’t have permissions to access the file: | |
| 5061 | + | // | |
| 5062 | + | // - [const@Gio.FILE_ATTRIBUTE_STANDARD_NAME] | |
| 5063 | + | // - [const@Gio.FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME] | |
| 5064 | + | // | |
| 5065 | + | // @attributes should be a comma-separated list of attributes or attribute | |
| 5066 | + | // wildcards. The wildcard `"*"` means all attributes, and a wildcard like | |
| 5067 | + | // `"standard::*"` means all attributes in the standard namespace. | |
| 5068 | + | // An example attribute query might be `"standard::*,owner::user"`. | |
| 5056 | 5069 | // The standard attributes are available as defines, like | |
| 5057 | - | // %G_FILE_ATTRIBUTE_STANDARD_NAME. | |
| 5070 | + | // [const@Gio.FILE_ATTRIBUTE_STANDARD_NAME]. | |
| 5058 | 5071 | // | |
| 5059 | - | // If @cancellable is not %NULL, then the operation can be cancelled | |
| 5072 | + | // If @cancellable is not `NULL`, then the operation can be cancelled | |
| 5060 | 5073 | // by triggering the cancellable object from another thread. If the | |
| 5061 | - | // operation was cancelled, the error %G_IO_ERROR_CANCELLED will be | |
| 5074 | + | // operation was cancelled, the error [error@Gio.IOErrorEnum.CANCELLED] will be | |
| 5062 | 5075 | // returned. | |
| 5063 | 5076 | // | |
| 5064 | 5077 | // For symlinks, normally the information about the target of the | |
| 5065 | 5078 | // symlink is returned, rather than information about the symlink | |
| 5066 | - | // itself. However if you pass %G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS | |
| 5079 | + | // itself. However if you pass [flags@Gio.FileQueryInfoFlags.NOFOLLOW_SYMLINKS] | |
| 5067 | 5080 | // in @flags the information about the symlink itself will be returned. | |
| 5068 | 5081 | // Also, for symlinks that point to non-existing files the information | |
| 5069 | 5082 | // about the symlink itself will be returned. | |
| 5070 | 5083 | // | |
| 5071 | - | // If the file does not exist, the %G_IO_ERROR_NOT_FOUND error will be | |
| 5084 | + | // If the file does not exist, the [error@Gio.IOErrorEnum.NOT_FOUND] error will be | |
| 5072 | 5085 | // returned. Other errors are possible too, and depend on what kind of | |
| 5073 | - | // filesystem the file is on. | |
| 5086 | + | // file system the file is on. | |
| 5074 | 5087 | func (x *FileBase) QueryInfo(AttributesVar string, FlagsVar FileQueryInfoFlags, CancellableVar *Cancellable) (*FileInfo, error) { | |
| 5075 | 5088 | var cls *FileInfo | |
| 5076 | 5089 | var cerr *glib.Error | |
D v4/gio/gfiledescriptorbased.go +0 -111
| @@ -1,111 +0,0 @@ | |||
| 1 | - | // Package gio was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT | |
| 2 | - | package gio | |
| 3 | - | ||
| 4 | - | import ( | |
| 5 | - | "structs" | |
| 6 | - | "unsafe" | |
| 7 | - | ||
| 8 | - | "github.com/jwijenbergh/purego" | |
| 9 | - | "github.com/jwijenbergh/puregotk/pkg/core" | |
| 10 | - | "github.com/jwijenbergh/puregotk/v4/gobject/types" | |
| 11 | - | ) | |
| 12 | - | ||
| 13 | - | // An interface for file descriptor based io objects. | |
| 14 | - | type FileDescriptorBasedIface struct { | |
| 15 | - | _ structs.HostLayout | |
| 16 | - | ||
| 17 | - | GIface uintptr | |
| 18 | - | ||
| 19 | - | xGetFd uintptr | |
| 20 | - | } | |
| 21 | - | ||
| 22 | - | func (x *FileDescriptorBasedIface) GoPointer() uintptr { | |
| 23 | - | return uintptr(unsafe.Pointer(x)) | |
| 24 | - | } | |
| 25 | - | ||
| 26 | - | // OverrideGetFd sets the callback function. | |
| 27 | - | // Gets the underlying file descriptor. | |
| 28 | - | func (x *FileDescriptorBasedIface) OverrideGetFd(cb func(FileDescriptorBased) int) { | |
| 29 | - | if cb == nil { | |
| 30 | - | x.xGetFd = 0 | |
| 31 | - | } else { | |
| 32 | - | x.xGetFd = purego.NewCallback(func(FdBasedVarp uintptr) int { | |
| 33 | - | return cb(&FileDescriptorBasedBase{Ptr: FdBasedVarp}) | |
| 34 | - | }) | |
| 35 | - | } | |
| 36 | - | } | |
| 37 | - | ||
| 38 | - | // GetGetFd gets the callback function. | |
| 39 | - | // Gets the underlying file descriptor. | |
| 40 | - | func (x *FileDescriptorBasedIface) GetGetFd() func(FileDescriptorBased) int { | |
| 41 | - | if x.xGetFd == 0 { | |
| 42 | - | return nil | |
| 43 | - | } | |
| 44 | - | var rawCallback func(FdBasedVarp uintptr) int | |
| 45 | - | purego.RegisterFunc(&rawCallback, x.xGetFd) | |
| 46 | - | return func(FdBasedVar FileDescriptorBased) int { | |
| 47 | - | return rawCallback(FdBasedVar.GoPointer()) | |
| 48 | - | } | |
| 49 | - | } | |
| 50 | - | ||
| 51 | - | // `GFileDescriptorBased` is an interface for file descriptor based IO. | |
| 52 | - | // | |
| 53 | - | // It is implemented by streams (implementations of [class@Gio.InputStream] or | |
| 54 | - | // [class@Gio.OutputStream]) that are based on file descriptors. | |
| 55 | - | // | |
| 56 | - | // Note that `<gio/gfiledescriptorbased.h>` belongs to the UNIX-specific | |
| 57 | - | // GIO interfaces, thus you have to use the `gio-unix-2.0.pc` pkg-config | |
| 58 | - | // file or the `GioUnix-2.0` GIR namespace when using it. | |
| 59 | - | type FileDescriptorBased interface { | |
| 60 | - | GoPointer() uintptr | |
| 61 | - | SetGoPointer(uintptr) | |
| 62 | - | GetFd() int | |
| 63 | - | } | |
| 64 | - | ||
| 65 | - | var xFileDescriptorBasedGLibType func() types.GType | |
| 66 | - | ||
| 67 | - | func FileDescriptorBasedGLibType() types.GType { | |
| 68 | - | return xFileDescriptorBasedGLibType() | |
| 69 | - | } | |
| 70 | - | ||
| 71 | - | type FileDescriptorBasedBase struct { | |
| 72 | - | Ptr uintptr | |
| 73 | - | } | |
| 74 | - | ||
| 75 | - | func (x *FileDescriptorBasedBase) GoPointer() uintptr { | |
| 76 | - | if x == nil { | |
| 77 | - | return 0 | |
| 78 | - | } | |
| 79 | - | return x.Ptr | |
| 80 | - | } | |
| 81 | - | ||
| 82 | - | func (x *FileDescriptorBasedBase) SetGoPointer(ptr uintptr) { | |
| 83 | - | x.Ptr = ptr | |
| 84 | - | } | |
| 85 | - | ||
| 86 | - | // Gets the underlying file descriptor. | |
| 87 | - | func (x *FileDescriptorBasedBase) GetFd() int { | |
| 88 | - | ||
| 89 | - | cret := XGFileDescriptorBasedGetFd(x.GoPointer()) | |
| 90 | - | return cret | |
| 91 | - | } | |
| 92 | - | ||
| 93 | - | var XGFileDescriptorBasedGetFd func(uintptr) int | |
| 94 | - | ||
| 95 | - | func init() { | |
| 96 | - | core.SetPackageName("GIO", "gio-2.0") | |
| 97 | - | core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"}) | |
| 98 | - | var libs []uintptr | |
| 99 | - | for _, libPath := range core.GetPaths("GIO") { | |
| 100 | - | lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) | |
| 101 | - | if err != nil { | |
| 102 | - | panic(err) | |
| 103 | - | } | |
| 104 | - | libs = append(libs, lib) | |
| 105 | - | } | |
| 106 | - | ||
| 107 | - | core.PuregoSafeRegister(&xFileDescriptorBasedGLibType, libs, "g_file_descriptor_based_get_type") | |
| 108 | - | ||
| 109 | - | core.PuregoSafeRegister(&XGFileDescriptorBasedGetFd, libs, "g_file_descriptor_based_get_fd") | |
| 110 | - | ||
| 111 | - | } | |
M v4/gio/gfilenamecompleter.go +7 -1
| @@ -159,7 +159,10 @@ func NewFilenameCompleter() *FilenameCompleter { | |||
| 159 | 159 | ||
| 160 | 160 | var xFilenameCompleterGetCompletionSuffix func(uintptr, string) string | |
| 161 | 161 | ||
| 162 | - | // Obtains a completion for @initial_text from @completer. | |
| 162 | + | // Obtains a suffix completion for @initial_text from @completer. | |
| 163 | + | // | |
| 164 | + | // Suffix will be an empty string if there's no shared suffix among matching | |
| 165 | + | // completions. If there's no matching completions anyway, `NULL` is returned. | |
| 163 | 166 | func (x *FilenameCompleter) GetCompletionSuffix(InitialTextVar string) string { | |
| 164 | 167 | ||
| 165 | 168 | cret := xFilenameCompleterGetCompletionSuffix(x.GoPointer(), InitialTextVar) | |
| @@ -179,6 +182,9 @@ var xFilenameCompleterSetDirsOnly func(uintptr, bool) | |||
| 179 | 182 | ||
| 180 | 183 | // If @dirs_only is %TRUE, @completer will only | |
| 181 | 184 | // complete directory names, and not file names. | |
| 185 | + | // | |
| 186 | + | // This function needs to be called before waiting for results from the | |
| 187 | + | // completer to be populated. | |
| 182 | 188 | func (x *FilenameCompleter) SetDirsOnly(DirsOnlyVar bool) { | |
| 183 | 189 | ||
| 184 | 190 | xFilenameCompleterSetDirsOnly(x.GoPointer(), DirsOnlyVar) | |
M v4/gio/ginetaddress.go +45 -0
| @@ -140,9 +140,33 @@ func NewInetAddressFromBytes(BytesVar []byte, FamilyVar SocketFamily) *InetAddre | |||
| 140 | 140 | return cls | |
| 141 | 141 | } | |
| 142 | 142 | ||
| 143 | + | var xNewInetAddressFromBytesWithIpv6Info func([]byte, SocketFamily, uint32, uint32) uintptr | |
| 144 | + | ||
| 145 | + | // Creates a new [class@Gio.InetAddress] from the given @family, @bytes | |
| 146 | + | // and @scope_id. | |
| 147 | + | // | |
| 148 | + | // @bytes must be 4 bytes for [enum@Gio.SocketFamily.IPV4] and 16 bytes for | |
| 149 | + | // [enum@Gio.SocketFamily.IPV6]. | |
| 150 | + | func NewInetAddressFromBytesWithIpv6Info(BytesVar []byte, FamilyVar SocketFamily, FlowinfoVar uint32, ScopeIdVar uint32) *InetAddress { | |
| 151 | + | var cls *InetAddress | |
| 152 | + | ||
| 153 | + | cret := xNewInetAddressFromBytesWithIpv6Info(BytesVar, FamilyVar, FlowinfoVar, ScopeIdVar) | |
| 154 | + | ||
| 155 | + | if cret == 0 { | |
| 156 | + | return nil | |
| 157 | + | } | |
| 158 | + | cls = &InetAddress{} | |
| 159 | + | cls.Ptr = cret | |
| 160 | + | return cls | |
| 161 | + | } | |
| 162 | + | ||
| 143 | 163 | var xNewInetAddressFromString func(string) uintptr | |
| 144 | 164 | ||
| 145 | 165 | // Parses @string as an IP address and creates a new #GInetAddress. | |
| 166 | + | // | |
| 167 | + | // If @address is an IPv6 address, it can also contain a scope ID | |
| 168 | + | // (separated from the address by a `%`). Note that currently this | |
| 169 | + | // behavior is platform specific. This may change in a future release. | |
| 146 | 170 | func NewInetAddressFromString(StringVar string) *InetAddress { | |
| 147 | 171 | var cls *InetAddress | |
| 148 | 172 | ||
| @@ -190,6 +214,15 @@ func (x *InetAddress) GetFamily() SocketFamily { | |||
| 190 | 214 | return cret | |
| 191 | 215 | } | |
| 192 | 216 | ||
| 217 | + | var xInetAddressGetFlowinfo func(uintptr) uint32 | |
| 218 | + | ||
| 219 | + | // Gets the value of [property@Gio.InetAddress:flowinfo]. | |
| 220 | + | func (x *InetAddress) GetFlowinfo() uint32 { | |
| 221 | + | ||
| 222 | + | cret := xInetAddressGetFlowinfo(x.GoPointer()) | |
| 223 | + | return cret | |
| 224 | + | } | |
| 225 | + | ||
| 193 | 226 | var xInetAddressGetIsAny func(uintptr) bool | |
| 194 | 227 | ||
| 195 | 228 | // Tests whether @address is the "any" address for its family. | |
| @@ -295,6 +328,15 @@ func (x *InetAddress) GetNativeSize() uint { | |||
| 295 | 328 | return cret | |
| 296 | 329 | } | |
| 297 | 330 | ||
| 331 | + | var xInetAddressGetScopeId func(uintptr) uint32 | |
| 332 | + | ||
| 333 | + | // Gets the value of [property@Gio.InetAddress:scope-id]. | |
| 334 | + | func (x *InetAddress) GetScopeId() uint32 { | |
| 335 | + | ||
| 336 | + | cret := xInetAddressGetScopeId(x.GoPointer()) | |
| 337 | + | return cret | |
| 338 | + | } | |
| 339 | + | ||
| 298 | 340 | var xInetAddressToBytes func(uintptr) byte | |
| 299 | 341 | ||
| 300 | 342 | // Gets the raw binary address data from @address. | |
| @@ -340,11 +382,13 @@ func init() { | |||
| 340 | 382 | ||
| 341 | 383 | core.PuregoSafeRegister(&xNewInetAddressAny, libs, "g_inet_address_new_any") | |
| 342 | 384 | core.PuregoSafeRegister(&xNewInetAddressFromBytes, libs, "g_inet_address_new_from_bytes") | |
| 385 | + | core.PuregoSafeRegister(&xNewInetAddressFromBytesWithIpv6Info, libs, "g_inet_address_new_from_bytes_with_ipv6_info") | |
| 343 | 386 | core.PuregoSafeRegister(&xNewInetAddressFromString, libs, "g_inet_address_new_from_string") | |
| 344 | 387 | core.PuregoSafeRegister(&xNewInetAddressLoopback, libs, "g_inet_address_new_loopback") | |
| 345 | 388 | ||
| 346 | 389 | core.PuregoSafeRegister(&xInetAddressEqual, libs, "g_inet_address_equal") | |
| 347 | 390 | core.PuregoSafeRegister(&xInetAddressGetFamily, libs, "g_inet_address_get_family") | |
| 391 | + | core.PuregoSafeRegister(&xInetAddressGetFlowinfo, libs, "g_inet_address_get_flowinfo") | |
| 348 | 392 | core.PuregoSafeRegister(&xInetAddressGetIsAny, libs, "g_inet_address_get_is_any") | |
| 349 | 393 | core.PuregoSafeRegister(&xInetAddressGetIsLinkLocal, libs, "g_inet_address_get_is_link_local") | |
| 350 | 394 | core.PuregoSafeRegister(&xInetAddressGetIsLoopback, libs, "g_inet_address_get_is_loopback") | |
| @@ -356,6 +400,7 @@ func init() { | |||
| 356 | 400 | core.PuregoSafeRegister(&xInetAddressGetIsMulticast, libs, "g_inet_address_get_is_multicast") | |
| 357 | 401 | core.PuregoSafeRegister(&xInetAddressGetIsSiteLocal, libs, "g_inet_address_get_is_site_local") | |
| 358 | 402 | core.PuregoSafeRegister(&xInetAddressGetNativeSize, libs, "g_inet_address_get_native_size") | |
| 403 | + | core.PuregoSafeRegister(&xInetAddressGetScopeId, libs, "g_inet_address_get_scope_id") | |
| 359 | 404 | core.PuregoSafeRegister(&xInetAddressToBytes, libs, "g_inet_address_to_bytes") | |
| 360 | 405 | core.PuregoSafeRegister(&xInetAddressToString, libs, "g_inet_address_to_string") | |
| 361 | 406 | ||
M v4/gio/ginetsocketaddress.go +6 -1
| @@ -71,7 +71,8 @@ var xNewInetSocketAddressFromString func(string, uint) uintptr | |||
| 71 | 71 | // Creates a new #GInetSocketAddress for @address and @port. | |
| 72 | 72 | // | |
| 73 | 73 | // If @address is an IPv6 address, it can also contain a scope ID | |
| 74 | - | // (separated from the address by a `%`). | |
| 74 | + | // (separated from the address by a `%`). Note that currently this | |
| 75 | + | // behavior is platform specific. This may change in a future release. | |
| 75 | 76 | func NewInetSocketAddressFromString(AddressVar string, PortVar uint) *InetSocketAddress { | |
| 76 | 77 | var cls *InetSocketAddress | |
| 77 | 78 | ||
| @@ -106,6 +107,8 @@ var xInetSocketAddressGetFlowinfo func(uintptr) uint32 | |||
| 106 | 107 | ||
| 107 | 108 | // Gets the `sin6_flowinfo` field from @address, | |
| 108 | 109 | // which must be an IPv6 address. | |
| 110 | + | // | |
| 111 | + | // If not overridden this value will be inherited from [property@Gio.InetSocketAddress:address]. | |
| 109 | 112 | func (x *InetSocketAddress) GetFlowinfo() uint32 { | |
| 110 | 113 | ||
| 111 | 114 | cret := xInetSocketAddressGetFlowinfo(x.GoPointer()) | |
| @@ -125,6 +128,8 @@ var xInetSocketAddressGetScopeId func(uintptr) uint32 | |||
| 125 | 128 | ||
| 126 | 129 | // Gets the `sin6_scope_id` field from @address, | |
| 127 | 130 | // which must be an IPv6 address. | |
| 131 | + | // | |
| 132 | + | // If not overridden this value will be inherited from [property@Gio.InetSocketAddress:address]. | |
| 128 | 133 | func (x *InetSocketAddress) GetScopeId() uint32 { | |
| 129 | 134 | ||
| 130 | 135 | cret := xInetSocketAddressGetScopeId(x.GoPointer()) | |
M v4/gio/gioenums.go +3 -2
| @@ -131,8 +131,9 @@ const ( | |||
| 131 | 131 | // If another message bus connection owns the name and have | |
| 132 | 132 | // specified %G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT, then take the name from the other connection. | |
| 133 | 133 | GBusNameOwnerFlagsReplaceValue BusNameOwnerFlags = 2 | |
| 134 | - | // If another message bus connection owns the name, immediately | |
| 135 | - | // return an error from g_bus_own_name() rather than entering the waiting queue for that name. (Since 2.54) | |
| 134 | + | // If another message bus connection owns the name, immediately return an error | |
| 135 | + | // from [func@Gio.bus_own_name] rather than entering the waiting queue for that | |
| 136 | + | // name. | |
| 136 | 137 | GBusNameOwnerFlagsDoNotQueueValue BusNameOwnerFlags = 4 | |
| 137 | 138 | ) | |
| 138 | 139 | ||
M v4/gio/gsettingsbackend.go +1 -1
| @@ -513,7 +513,7 @@ var xSettingsBackendKeysChanged func(uintptr, string, []string, uintptr) | |||
| 513 | 513 | // end with '/' and must not contain '//'). | |
| 514 | 514 | // | |
| 515 | 515 | // The meaning of this signal is that any of the key names resulting | |
| 516 | - | // from the contatenation of @path with each item in @items may have | |
| 516 | + | // from the concatenation of @path with each item in @items may have | |
| 517 | 517 | // changed. | |
| 518 | 518 | // | |
| 519 | 519 | // The same rules for when notifications must occur apply as per | |
M v4/gio/gsocketlistener.go +19 -0
| @@ -434,6 +434,14 @@ var xSocketListenerAddAnyInetPort func(uintptr, uintptr, **glib.Error) uint16 | |||
| 434 | 434 | // This is useful if you need to have a socket for incoming connections | |
| 435 | 435 | // but don't care about the specific port number. | |
| 436 | 436 | // | |
| 437 | + | // If possible, the [class@Gio.SocketListener] will listen on both IPv4 and | |
| 438 | + | // IPv6 (listening on the same port on both). If listening on one of the socket | |
| 439 | + | // families fails, the [class@Gio.SocketListener] will only listen on the other. | |
| 440 | + | // If listening on both fails, an error will be returned. | |
| 441 | + | // | |
| 442 | + | // If you need to distinguish whether listening on IPv4 or IPv6 or both was | |
| 443 | + | // successful, connect to [signal@Gio.SocketListener::event]. | |
| 444 | + | // | |
| 437 | 445 | // @source_object will be passed out in the various calls | |
| 438 | 446 | // to accept to identify this particular source, which is | |
| 439 | 447 | // useful if you're listening on multiple addresses and do | |
| @@ -455,6 +463,14 @@ var xSocketListenerAddInetPort func(uintptr, uint16, uintptr, **glib.Error) bool | |||
| 455 | 463 | // creates a TCP/IP socket listening on IPv4 and IPv6 (if | |
| 456 | 464 | // supported) on the specified port on all interfaces. | |
| 457 | 465 | // | |
| 466 | + | // If possible, the [class@Gio.SocketListener] will listen on both IPv4 and | |
| 467 | + | // IPv6 (listening on the same port on both). If listening on one of the socket | |
| 468 | + | // families fails, the [class@Gio.SocketListener] will only listen on the other. | |
| 469 | + | // If listening on both fails, an error will be returned. | |
| 470 | + | // | |
| 471 | + | // If you need to distinguish whether listening on IPv4 or IPv6 or both was | |
| 472 | + | // successful, connect to [signal@Gio.SocketListener::event]. | |
| 473 | + | // | |
| 458 | 474 | // @source_object will be passed out in the various calls | |
| 459 | 475 | // to accept to identify this particular source, which is | |
| 460 | 476 | // useful if you're listening on multiple addresses and do | |
| @@ -480,6 +496,9 @@ var xSocketListenerAddSocket func(uintptr, uintptr, uintptr, **glib.Error) bool | |||
| 480 | 496 | // new clients from. The socket must be bound to a local | |
| 481 | 497 | // address and listened to. | |
| 482 | 498 | // | |
| 499 | + | // For parallel calls to [class@Gio.SocketListener] methods to work, the socket | |
| 500 | + | // must be in non-blocking mode. (See [property@Gio.Socket:blocking].) | |
| 501 | + | // | |
| 483 | 502 | // @source_object will be passed out in the various calls | |
| 484 | 503 | // to accept to identify this particular source, which is | |
| 485 | 504 | // useful if you're listening on multiple addresses and do | |
D v4/gio/gunixfdmessage.go +0 -242
| @@ -1,242 +0,0 @@ | |||
| 1 | - | // Package gio was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT | |
| 2 | - | package gio | |
| 3 | - | ||
| 4 | - | import ( | |
| 5 | - | "structs" | |
| 6 | - | "unsafe" | |
| 7 | - | ||
| 8 | - | "github.com/jwijenbergh/purego" | |
| 9 | - | "github.com/jwijenbergh/puregotk/pkg/core" | |
| 10 | - | "github.com/jwijenbergh/puregotk/v4/glib" | |
| 11 | - | "github.com/jwijenbergh/puregotk/v4/gobject" | |
| 12 | - | "github.com/jwijenbergh/puregotk/v4/gobject/types" | |
| 13 | - | ) | |
| 14 | - | ||
| 15 | - | type UnixFDMessageClass struct { | |
| 16 | - | _ structs.HostLayout | |
| 17 | - | ||
| 18 | - | ParentClass SocketControlMessageClass | |
| 19 | - | ||
| 20 | - | xGReserved1 uintptr | |
| 21 | - | ||
| 22 | - | xGReserved2 uintptr | |
| 23 | - | } | |
| 24 | - | ||
| 25 | - | func (x *UnixFDMessageClass) GoPointer() uintptr { | |
| 26 | - | return uintptr(unsafe.Pointer(x)) | |
| 27 | - | } | |
| 28 | - | ||
| 29 | - | // OverrideGReserved1 sets the callback function. | |
| 30 | - | func (x *UnixFDMessageClass) OverrideGReserved1(cb func()) { | |
| 31 | - | if cb == nil { | |
| 32 | - | x.xGReserved1 = 0 | |
| 33 | - | } else { | |
| 34 | - | x.xGReserved1 = purego.NewCallback(func() { | |
| 35 | - | cb() | |
| 36 | - | }) | |
| 37 | - | } | |
| 38 | - | } | |
| 39 | - | ||
| 40 | - | // GetGReserved1 gets the callback function. | |
| 41 | - | func (x *UnixFDMessageClass) GetGReserved1() func() { | |
| 42 | - | if x.xGReserved1 == 0 { | |
| 43 | - | return nil | |
| 44 | - | } | |
| 45 | - | var rawCallback func() | |
| 46 | - | purego.RegisterFunc(&rawCallback, x.xGReserved1) | |
| 47 | - | return func() { | |
| 48 | - | rawCallback() | |
| 49 | - | } | |
| 50 | - | } | |
| 51 | - | ||
| 52 | - | // OverrideGReserved2 sets the callback function. | |
| 53 | - | func (x *UnixFDMessageClass) OverrideGReserved2(cb func()) { | |
| 54 | - | if cb == nil { | |
| 55 | - | x.xGReserved2 = 0 | |
| 56 | - | } else { | |
| 57 | - | x.xGReserved2 = purego.NewCallback(func() { | |
| 58 | - | cb() | |
| 59 | - | }) | |
| 60 | - | } | |
| 61 | - | } | |
| 62 | - | ||
| 63 | - | // GetGReserved2 gets the callback function. | |
| 64 | - | func (x *UnixFDMessageClass) GetGReserved2() func() { | |
| 65 | - | if x.xGReserved2 == 0 { | |
| 66 | - | return nil | |
| 67 | - | } | |
| 68 | - | var rawCallback func() | |
| 69 | - | purego.RegisterFunc(&rawCallback, x.xGReserved2) | |
| 70 | - | return func() { | |
| 71 | - | rawCallback() | |
| 72 | - | } | |
| 73 | - | } | |
| 74 | - | ||
| 75 | - | type UnixFDMessagePrivate struct { | |
| 76 | - | _ structs.HostLayout | |
| 77 | - | } | |
| 78 | - | ||
| 79 | - | func (x *UnixFDMessagePrivate) GoPointer() uintptr { | |
| 80 | - | return uintptr(unsafe.Pointer(x)) | |
| 81 | - | } | |
| 82 | - | ||
| 83 | - | // This [class@Gio.SocketControlMessage] contains a [class@Gio.UnixFDList]. | |
| 84 | - | // It may be sent using [method@Gio.Socket.send_message] and received using | |
| 85 | - | // [method@Gio.Socket.receive_message] over UNIX sockets (ie: sockets in the | |
| 86 | - | // `G_SOCKET_FAMILY_UNIX` family). The file descriptors are copied | |
| 87 | - | // between processes by the kernel. | |
| 88 | - | // | |
| 89 | - | // For an easier way to send and receive file descriptors over | |
| 90 | - | // stream-oriented UNIX sockets, see [method@Gio.UnixConnection.send_fd] and | |
| 91 | - | // [method@Gio.UnixConnection.receive_fd]. | |
| 92 | - | // | |
| 93 | - | // Note that `<gio/gunixfdmessage.h>` belongs to the UNIX-specific GIO | |
| 94 | - | // interfaces, thus you have to use the `gio-unix-2.0.pc` pkg-config | |
| 95 | - | // file or the `GioUnix-2.0` GIR namespace when using it. | |
| 96 | - | type UnixFDMessage struct { | |
| 97 | - | SocketControlMessage | |
| 98 | - | } | |
| 99 | - | ||
| 100 | - | var xUnixFDMessageGLibType func() types.GType | |
| 101 | - | ||
| 102 | - | func UnixFDMessageGLibType() types.GType { | |
| 103 | - | return xUnixFDMessageGLibType() | |
| 104 | - | } | |
| 105 | - | ||
| 106 | - | func UnixFDMessageNewFromInternalPtr(ptr uintptr) *UnixFDMessage { | |
| 107 | - | cls := &UnixFDMessage{} | |
| 108 | - | cls.Ptr = ptr | |
| 109 | - | return cls | |
| 110 | - | } | |
| 111 | - | ||
| 112 | - | var xNewUnixFDMessage func() uintptr | |
| 113 | - | ||
| 114 | - | // Creates a new #GUnixFDMessage containing an empty file descriptor | |
| 115 | - | // list. | |
| 116 | - | func NewUnixFDMessage() *UnixFDMessage { | |
| 117 | - | var cls *UnixFDMessage | |
| 118 | - | ||
| 119 | - | cret := xNewUnixFDMessage() | |
| 120 | - | ||
| 121 | - | if cret == 0 { | |
| 122 | - | return nil | |
| 123 | - | } | |
| 124 | - | cls = &UnixFDMessage{} | |
| 125 | - | cls.Ptr = cret | |
| 126 | - | return cls | |
| 127 | - | } | |
| 128 | - | ||
| 129 | - | var xNewUnixFDMessageWithFdList func(uintptr) uintptr | |
| 130 | - | ||
| 131 | - | // Creates a new #GUnixFDMessage containing @list. | |
| 132 | - | func NewUnixFDMessageWithFdList(FdListVar *UnixFDList) *UnixFDMessage { | |
| 133 | - | var cls *UnixFDMessage | |
| 134 | - | ||
| 135 | - | cret := xNewUnixFDMessageWithFdList(FdListVar.GoPointer()) | |
| 136 | - | ||
| 137 | - | if cret == 0 { | |
| 138 | - | return nil | |
| 139 | - | } | |
| 140 | - | cls = &UnixFDMessage{} | |
| 141 | - | cls.Ptr = cret | |
| 142 | - | return cls | |
| 143 | - | } | |
| 144 | - | ||
| 145 | - | var xUnixFDMessageAppendFd func(uintptr, int, **glib.Error) bool | |
| 146 | - | ||
| 147 | - | // Adds a file descriptor to @message. | |
| 148 | - | // | |
| 149 | - | // The file descriptor is duplicated using dup(). You keep your copy | |
| 150 | - | // of the descriptor and the copy contained in @message will be closed | |
| 151 | - | // when @message is finalized. | |
| 152 | - | // | |
| 153 | - | // A possible cause of failure is exceeding the per-process or | |
| 154 | - | // system-wide file descriptor limit. | |
| 155 | - | func (x *UnixFDMessage) AppendFd(FdVar int) (bool, error) { | |
| 156 | - | var cerr *glib.Error | |
| 157 | - | ||
| 158 | - | cret := xUnixFDMessageAppendFd(x.GoPointer(), FdVar, &cerr) | |
| 159 | - | if cerr == nil { | |
| 160 | - | return cret, nil | |
| 161 | - | } | |
| 162 | - | return cret, cerr | |
| 163 | - | ||
| 164 | - | } | |
| 165 | - | ||
| 166 | - | var xUnixFDMessageGetFdList func(uintptr) uintptr | |
| 167 | - | ||
| 168 | - | // Gets the #GUnixFDList contained in @message. This function does not | |
| 169 | - | // return a reference to the caller, but the returned list is valid for | |
| 170 | - | // the lifetime of @message. | |
| 171 | - | func (x *UnixFDMessage) GetFdList() *UnixFDList { | |
| 172 | - | var cls *UnixFDList | |
| 173 | - | ||
| 174 | - | cret := xUnixFDMessageGetFdList(x.GoPointer()) | |
| 175 | - | ||
| 176 | - | if cret == 0 { | |
| 177 | - | return nil | |
| 178 | - | } | |
| 179 | - | gobject.IncreaseRef(cret) | |
| 180 | - | cls = &UnixFDList{} | |
| 181 | - | cls.Ptr = cret | |
| 182 | - | return cls | |
| 183 | - | } | |
| 184 | - | ||
| 185 | - | var xUnixFDMessageStealFds func(uintptr, int) uintptr | |
| 186 | - | ||
| 187 | - | // Returns the array of file descriptors that is contained in this | |
| 188 | - | // object. | |
| 189 | - | // | |
| 190 | - | // After this call, the descriptors are no longer contained in | |
| 191 | - | // @message. Further calls will return an empty list (unless more | |
| 192 | - | // descriptors have been added). | |
| 193 | - | // | |
| 194 | - | // The return result of this function must be freed with g_free(). | |
| 195 | - | // The caller is also responsible for closing all of the file | |
| 196 | - | // descriptors. | |
| 197 | - | // | |
| 198 | - | // If @length is non-%NULL then it is set to the number of file | |
| 199 | - | // descriptors in the returned array. The returned array is also | |
| 200 | - | // terminated with -1. | |
| 201 | - | // | |
| 202 | - | // This function never returns %NULL. In case there are no file | |
| 203 | - | // descriptors contained in @message, an empty array is returned. | |
| 204 | - | func (x *UnixFDMessage) StealFds(LengthVar int) uintptr { | |
| 205 | - | ||
| 206 | - | cret := xUnixFDMessageStealFds(x.GoPointer(), LengthVar) | |
| 207 | - | return cret | |
| 208 | - | } | |
| 209 | - | ||
| 210 | - | func (c *UnixFDMessage) GoPointer() uintptr { | |
| 211 | - | if c == nil { | |
| 212 | - | return 0 | |
| 213 | - | } | |
| 214 | - | return c.Ptr | |
| 215 | - | } | |
| 216 | - | ||
| 217 | - | func (c *UnixFDMessage) SetGoPointer(ptr uintptr) { | |
| 218 | - | c.Ptr = ptr | |
| 219 | - | } | |
| 220 | - | ||
| 221 | - | func init() { | |
| 222 | - | core.SetPackageName("GIO", "gio-2.0") | |
| 223 | - | core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"}) | |
| 224 | - | var libs []uintptr | |
| 225 | - | for _, libPath := range core.GetPaths("GIO") { | |
| 226 | - | lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) | |
| 227 | - | if err != nil { | |
| 228 | - | panic(err) | |
| 229 | - | } | |
| 230 | - | libs = append(libs, lib) | |
| 231 | - | } | |
| 232 | - | ||
| 233 | - | core.PuregoSafeRegister(&xUnixFDMessageGLibType, libs, "g_unix_fd_message_get_type") | |
| 234 | - | ||
| 235 | - | core.PuregoSafeRegister(&xNewUnixFDMessage, libs, "g_unix_fd_message_new") | |
| 236 | - | core.PuregoSafeRegister(&xNewUnixFDMessageWithFdList, libs, "g_unix_fd_message_new_with_fd_list") | |
| 237 | - | ||
| 238 | - | core.PuregoSafeRegister(&xUnixFDMessageAppendFd, libs, "g_unix_fd_message_append_fd") | |
| 239 | - | core.PuregoSafeRegister(&xUnixFDMessageGetFdList, libs, "g_unix_fd_message_get_fd_list") | |
| 240 | - | core.PuregoSafeRegister(&xUnixFDMessageStealFds, libs, "g_unix_fd_message_steal_fds") | |
| 241 | - | ||
| 242 | - | } | |
D v4/gio/gunixinputstream.go +0 -333
| @@ -1,333 +0,0 @@ | |||
| 1 | - | // Package gio was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT | |
| 2 | - | package gio | |
| 3 | - | ||
| 4 | - | import ( | |
| 5 | - | "structs" | |
| 6 | - | "unsafe" | |
| 7 | - | ||
| 8 | - | "github.com/jwijenbergh/purego" | |
| 9 | - | "github.com/jwijenbergh/puregotk/pkg/core" | |
| 10 | - | "github.com/jwijenbergh/puregotk/v4/glib" | |
| 11 | - | "github.com/jwijenbergh/puregotk/v4/gobject/types" | |
| 12 | - | ) | |
| 13 | - | ||
| 14 | - | type UnixInputStreamClass struct { | |
| 15 | - | _ structs.HostLayout | |
| 16 | - | ||
| 17 | - | ParentClass InputStreamClass | |
| 18 | - | ||
| 19 | - | xGReserved1 uintptr | |
| 20 | - | ||
| 21 | - | xGReserved2 uintptr | |
| 22 | - | ||
| 23 | - | xGReserved3 uintptr | |
| 24 | - | ||
| 25 | - | xGReserved4 uintptr | |
| 26 | - | ||
| 27 | - | xGReserved5 uintptr | |
| 28 | - | } | |
| 29 | - | ||
| 30 | - | func (x *UnixInputStreamClass) GoPointer() uintptr { | |
| 31 | - | return uintptr(unsafe.Pointer(x)) | |
| 32 | - | } | |
| 33 | - | ||
| 34 | - | // OverrideGReserved1 sets the callback function. | |
| 35 | - | func (x *UnixInputStreamClass) OverrideGReserved1(cb func()) { | |
| 36 | - | if cb == nil { | |
| 37 | - | x.xGReserved1 = 0 | |
| 38 | - | } else { | |
| 39 | - | x.xGReserved1 = purego.NewCallback(func() { | |
| 40 | - | cb() | |
| 41 | - | }) | |
| 42 | - | } | |
| 43 | - | } | |
| 44 | - | ||
| 45 | - | // GetGReserved1 gets the callback function. | |
| 46 | - | func (x *UnixInputStreamClass) GetGReserved1() func() { | |
| 47 | - | if x.xGReserved1 == 0 { | |
| 48 | - | return nil | |
| 49 | - | } | |
| 50 | - | var rawCallback func() | |
| 51 | - | purego.RegisterFunc(&rawCallback, x.xGReserved1) | |
| 52 | - | return func() { | |
| 53 | - | rawCallback() | |
| 54 | - | } | |
| 55 | - | } | |
| 56 | - | ||
| 57 | - | // OverrideGReserved2 sets the callback function. | |
| 58 | - | func (x *UnixInputStreamClass) OverrideGReserved2(cb func()) { | |
| 59 | - | if cb == nil { | |
| 60 | - | x.xGReserved2 = 0 | |
| 61 | - | } else { | |
| 62 | - | x.xGReserved2 = purego.NewCallback(func() { | |
| 63 | - | cb() | |
| 64 | - | }) | |
| 65 | - | } | |
| 66 | - | } | |
| 67 | - | ||
| 68 | - | // GetGReserved2 gets the callback function. | |
| 69 | - | func (x *UnixInputStreamClass) GetGReserved2() func() { | |
| 70 | - | if x.xGReserved2 == 0 { | |
| 71 | - | return nil | |
| 72 | - | } | |
| 73 | - | var rawCallback func() | |
| 74 | - | purego.RegisterFunc(&rawCallback, x.xGReserved2) | |
| 75 | - | return func() { | |
| 76 | - | rawCallback() | |
| 77 | - | } | |
| 78 | - | } | |
| 79 | - | ||
| 80 | - | // OverrideGReserved3 sets the callback function. | |
| 81 | - | func (x *UnixInputStreamClass) OverrideGReserved3(cb func()) { | |
| 82 | - | if cb == nil { | |
| 83 | - | x.xGReserved3 = 0 | |
| 84 | - | } else { | |
| 85 | - | x.xGReserved3 = purego.NewCallback(func() { | |
| 86 | - | cb() | |
| 87 | - | }) | |
| 88 | - | } | |
| 89 | - | } | |
| 90 | - | ||
| 91 | - | // GetGReserved3 gets the callback function. | |
| 92 | - | func (x *UnixInputStreamClass) GetGReserved3() func() { | |
| 93 | - | if x.xGReserved3 == 0 { | |
| 94 | - | return nil | |
| 95 | - | } | |
| 96 | - | var rawCallback func() | |
| 97 | - | purego.RegisterFunc(&rawCallback, x.xGReserved3) | |
| 98 | - | return func() { | |
| 99 | - | rawCallback() | |
| 100 | - | } | |
| 101 | - | } | |
| 102 | - | ||
| 103 | - | // OverrideGReserved4 sets the callback function. | |
| 104 | - | func (x *UnixInputStreamClass) OverrideGReserved4(cb func()) { | |
| 105 | - | if cb == nil { | |
| 106 | - | x.xGReserved4 = 0 | |
| 107 | - | } else { | |
| 108 | - | x.xGReserved4 = purego.NewCallback(func() { | |
| 109 | - | cb() | |
| 110 | - | }) | |
| 111 | - | } | |
| 112 | - | } | |
| 113 | - | ||
| 114 | - | // GetGReserved4 gets the callback function. | |
| 115 | - | func (x *UnixInputStreamClass) GetGReserved4() func() { | |
| 116 | - | if x.xGReserved4 == 0 { | |
| 117 | - | return nil | |
| 118 | - | } | |
| 119 | - | var rawCallback func() | |
| 120 | - | purego.RegisterFunc(&rawCallback, x.xGReserved4) | |
| 121 | - | return func() { | |
| 122 | - | rawCallback() | |
| 123 | - | } | |
| 124 | - | } | |
| 125 | - | ||
| 126 | - | // OverrideGReserved5 sets the callback function. | |
| 127 | - | func (x *UnixInputStreamClass) OverrideGReserved5(cb func()) { | |
| 128 | - | if cb == nil { | |
| 129 | - | x.xGReserved5 = 0 | |
| 130 | - | } else { | |
| 131 | - | x.xGReserved5 = purego.NewCallback(func() { | |
| 132 | - | cb() | |
| 133 | - | }) | |
| 134 | - | } | |
| 135 | - | } | |
| 136 | - | ||
| 137 | - | // GetGReserved5 gets the callback function. | |
| 138 | - | func (x *UnixInputStreamClass) GetGReserved5() func() { | |
| 139 | - | if x.xGReserved5 == 0 { | |
| 140 | - | return nil | |
| 141 | - | } | |
| 142 | - | var rawCallback func() | |
| 143 | - | purego.RegisterFunc(&rawCallback, x.xGReserved5) | |
| 144 | - | return func() { | |
| 145 | - | rawCallback() | |
| 146 | - | } | |
| 147 | - | } | |
| 148 | - | ||
| 149 | - | type UnixInputStreamPrivate struct { | |
| 150 | - | _ structs.HostLayout | |
| 151 | - | } | |
| 152 | - | ||
| 153 | - | func (x *UnixInputStreamPrivate) GoPointer() uintptr { | |
| 154 | - | return uintptr(unsafe.Pointer(x)) | |
| 155 | - | } | |
| 156 | - | ||
| 157 | - | // `GUnixInputStream` implements [class@Gio.InputStream] for reading from a UNIX | |
| 158 | - | // file descriptor, including asynchronous operations. (If the file | |
| 159 | - | // descriptor refers to a socket or pipe, this will use `poll()` to do | |
| 160 | - | // asynchronous I/O. If it refers to a regular file, it will fall back | |
| 161 | - | // to doing asynchronous I/O in another thread.) | |
| 162 | - | // | |
| 163 | - | // Note that `<gio/gunixinputstream.h>` belongs to the UNIX-specific GIO | |
| 164 | - | // interfaces, thus you have to use the `gio-unix-2.0.pc` pkg-config | |
| 165 | - | // file or the `GioUnix-2.0` GIR namespace when using it. | |
| 166 | - | type UnixInputStream struct { | |
| 167 | - | InputStream | |
| 168 | - | } | |
| 169 | - | ||
| 170 | - | var xUnixInputStreamGLibType func() types.GType | |
| 171 | - | ||
| 172 | - | func UnixInputStreamGLibType() types.GType { | |
| 173 | - | return xUnixInputStreamGLibType() | |
| 174 | - | } | |
| 175 | - | ||
| 176 | - | func UnixInputStreamNewFromInternalPtr(ptr uintptr) *UnixInputStream { | |
| 177 | - | cls := &UnixInputStream{} | |
| 178 | - | cls.Ptr = ptr | |
| 179 | - | return cls | |
| 180 | - | } | |
| 181 | - | ||
| 182 | - | var xNewUnixInputStream func(int, bool) uintptr | |
| 183 | - | ||
| 184 | - | // Creates a new #GUnixInputStream for the given @fd. | |
| 185 | - | // | |
| 186 | - | // If @close_fd is %TRUE, the file descriptor will be closed | |
| 187 | - | // when the stream is closed. | |
| 188 | - | func NewUnixInputStream(FdVar int, CloseFdVar bool) *UnixInputStream { | |
| 189 | - | var cls *UnixInputStream | |
| 190 | - | ||
| 191 | - | cret := xNewUnixInputStream(FdVar, CloseFdVar) | |
| 192 | - | ||
| 193 | - | if cret == 0 { | |
| 194 | - | return nil | |
| 195 | - | } | |
| 196 | - | cls = &UnixInputStream{} | |
| 197 | - | cls.Ptr = cret | |
| 198 | - | return cls | |
| 199 | - | } | |
| 200 | - | ||
| 201 | - | var xUnixInputStreamGetCloseFd func(uintptr) bool | |
| 202 | - | ||
| 203 | - | // Returns whether the file descriptor of @stream will be | |
| 204 | - | // closed when the stream is closed. | |
| 205 | - | func (x *UnixInputStream) GetCloseFd() bool { | |
| 206 | - | ||
| 207 | - | cret := xUnixInputStreamGetCloseFd(x.GoPointer()) | |
| 208 | - | return cret | |
| 209 | - | } | |
| 210 | - | ||
| 211 | - | var xUnixInputStreamGetFd func(uintptr) int | |
| 212 | - | ||
| 213 | - | // Return the UNIX file descriptor that the stream reads from. | |
| 214 | - | func (x *UnixInputStream) GetFd() int { | |
| 215 | - | ||
| 216 | - | cret := xUnixInputStreamGetFd(x.GoPointer()) | |
| 217 | - | return cret | |
| 218 | - | } | |
| 219 | - | ||
| 220 | - | var xUnixInputStreamSetCloseFd func(uintptr, bool) | |
| 221 | - | ||
| 222 | - | // Sets whether the file descriptor of @stream shall be closed | |
| 223 | - | // when the stream is closed. | |
| 224 | - | func (x *UnixInputStream) SetCloseFd(CloseFdVar bool) { | |
| 225 | - | ||
| 226 | - | xUnixInputStreamSetCloseFd(x.GoPointer(), CloseFdVar) | |
| 227 | - | ||
| 228 | - | } | |
| 229 | - | ||
| 230 | - | func (c *UnixInputStream) GoPointer() uintptr { | |
| 231 | - | if c == nil { | |
| 232 | - | return 0 | |
| 233 | - | } | |
| 234 | - | return c.Ptr | |
| 235 | - | } | |
| 236 | - | ||
| 237 | - | func (c *UnixInputStream) SetGoPointer(ptr uintptr) { | |
| 238 | - | c.Ptr = ptr | |
| 239 | - | } | |
| 240 | - | ||
| 241 | - | // Checks if @stream is actually pollable. Some classes may implement | |
| 242 | - | // #GPollableInputStream but have only certain instances of that class | |
| 243 | - | // be pollable. If this method returns %FALSE, then the behavior of | |
| 244 | - | // other #GPollableInputStream methods is undefined. | |
| 245 | - | // | |
| 246 | - | // For any given stream, the value returned by this method is constant; | |
| 247 | - | // a stream cannot switch from pollable to non-pollable or vice versa. | |
| 248 | - | func (x *UnixInputStream) CanPoll() bool { | |
| 249 | - | ||
| 250 | - | cret := XGPollableInputStreamCanPoll(x.GoPointer()) | |
| 251 | - | return cret | |
| 252 | - | } | |
| 253 | - | ||
| 254 | - | // Creates a #GSource that triggers when @stream can be read, or | |
| 255 | - | // @cancellable is triggered or an error occurs. The callback on the | |
| 256 | - | // source is of the #GPollableSourceFunc type. | |
| 257 | - | // | |
| 258 | - | // As with g_pollable_input_stream_is_readable(), it is possible that | |
| 259 | - | // the stream may not actually be readable even after the source | |
| 260 | - | // triggers, so you should use g_pollable_input_stream_read_nonblocking() | |
| 261 | - | // rather than g_input_stream_read() from the callback. | |
| 262 | - | // | |
| 263 | - | // The behaviour of this method is undefined if | |
| 264 | - | // g_pollable_input_stream_can_poll() returns %FALSE for @stream. | |
| 265 | - | func (x *UnixInputStream) CreateSource(CancellableVar *Cancellable) *glib.Source { | |
| 266 | - | ||
| 267 | - | cret := XGPollableInputStreamCreateSource(x.GoPointer(), CancellableVar.GoPointer()) | |
| 268 | - | return cret | |
| 269 | - | } | |
| 270 | - | ||
| 271 | - | // Checks if @stream can be read. | |
| 272 | - | // | |
| 273 | - | // Note that some stream types may not be able to implement this 100% | |
| 274 | - | // reliably, and it is possible that a call to g_input_stream_read() | |
| 275 | - | // after this returns %TRUE would still block. To guarantee | |
| 276 | - | // non-blocking behavior, you should always use | |
| 277 | - | // g_pollable_input_stream_read_nonblocking(), which will return a | |
| 278 | - | // %G_IO_ERROR_WOULD_BLOCK error rather than blocking. | |
| 279 | - | // | |
| 280 | - | // The behaviour of this method is undefined if | |
| 281 | - | // g_pollable_input_stream_can_poll() returns %FALSE for @stream. | |
| 282 | - | func (x *UnixInputStream) IsReadable() bool { | |
| 283 | - | ||
| 284 | - | cret := XGPollableInputStreamIsReadable(x.GoPointer()) | |
| 285 | - | return cret | |
| 286 | - | } | |
| 287 | - | ||
| 288 | - | // Attempts to read up to @count bytes from @stream into @buffer, as | |
| 289 | - | // with g_input_stream_read(). If @stream is not currently readable, | |
| 290 | - | // this will immediately return %G_IO_ERROR_WOULD_BLOCK, and you can | |
| 291 | - | // use g_pollable_input_stream_create_source() to create a #GSource | |
| 292 | - | // that will be triggered when @stream is readable. | |
| 293 | - | // | |
| 294 | - | // Note that since this method never blocks, you cannot actually | |
| 295 | - | // use @cancellable to cancel it. However, it will return an error | |
| 296 | - | // if @cancellable has already been cancelled when you call, which | |
| 297 | - | // may happen if you call this method after a source triggers due | |
| 298 | - | // to having been cancelled. | |
| 299 | - | // | |
| 300 | - | // The behaviour of this method is undefined if | |
| 301 | - | // g_pollable_input_stream_can_poll() returns %FALSE for @stream. | |
| 302 | - | func (x *UnixInputStream) ReadNonblocking(BufferVar []byte, CountVar uint, CancellableVar *Cancellable) (int, error) { | |
| 303 | - | var cerr *glib.Error | |
| 304 | - | ||
| 305 | - | cret := XGPollableInputStreamReadNonblocking(x.GoPointer(), BufferVar, CountVar, CancellableVar.GoPointer(), &cerr) | |
| 306 | - | if cerr == nil { | |
| 307 | - | return cret, nil | |
| 308 | - | } | |
| 309 | - | return cret, cerr | |
| 310 | - | ||
| 311 | - | } | |
| 312 | - | ||
| 313 | - | func init() { | |
| 314 | - | core.SetPackageName("GIO", "gio-2.0") | |
| 315 | - | core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"}) | |
| 316 | - | var libs []uintptr | |
| 317 | - | for _, libPath := range core.GetPaths("GIO") { | |
| 318 | - | lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) | |
| 319 | - | if err != nil { | |
| 320 | - | panic(err) | |
| 321 | - | } | |
| 322 | - | libs = append(libs, lib) | |
| 323 | - | } | |
| 324 | - | ||
| 325 | - | core.PuregoSafeRegister(&xUnixInputStreamGLibType, libs, "g_unix_input_stream_get_type") | |
| 326 | - | ||
| 327 | - | core.PuregoSafeRegister(&xNewUnixInputStream, libs, "g_unix_input_stream_new") | |
| 328 | - | ||
| 329 | - | core.PuregoSafeRegister(&xUnixInputStreamGetCloseFd, libs, "g_unix_input_stream_get_close_fd") | |
| 330 | - | core.PuregoSafeRegister(&xUnixInputStreamGetFd, libs, "g_unix_input_stream_get_fd") | |
| 331 | - | core.PuregoSafeRegister(&xUnixInputStreamSetCloseFd, libs, "g_unix_input_stream_set_close_fd") | |
| 332 | - | ||
| 333 | - | } | |
D v4/gio/gunixmounts.go +0 -1035
| @@ -1,1035 +0,0 @@ | |||
| 1 | - | // Package gio was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT | |
| 2 | - | package gio | |
| 3 | - | ||
| 4 | - | import ( | |
| 5 | - | "structs" | |
| 6 | - | "unsafe" | |
| 7 | - | ||
| 8 | - | "github.com/jwijenbergh/purego" | |
| 9 | - | "github.com/jwijenbergh/puregotk/pkg/core" | |
| 10 | - | "github.com/jwijenbergh/puregotk/v4/glib" | |
| 11 | - | "github.com/jwijenbergh/puregotk/v4/gobject" | |
| 12 | - | "github.com/jwijenbergh/puregotk/v4/gobject/types" | |
| 13 | - | ) | |
| 14 | - | ||
| 15 | - | // Defines a Unix mount entry (e.g. `/media/cdrom`). | |
| 16 | - | // This corresponds roughly to a mtab entry. | |
| 17 | - | type UnixMountEntry struct { | |
| 18 | - | _ structs.HostLayout | |
| 19 | - | } | |
| 20 | - | ||
| 21 | - | var xUnixMountEntryGLibType func() types.GType | |
| 22 | - | ||
| 23 | - | func UnixMountEntryGLibType() types.GType { | |
| 24 | - | return xUnixMountEntryGLibType() | |
| 25 | - | } | |
| 26 | - | ||
| 27 | - | func (x *UnixMountEntry) GoPointer() uintptr { | |
| 28 | - | return uintptr(unsafe.Pointer(x)) | |
| 29 | - | } | |
| 30 | - | ||
| 31 | - | var xUnixMountEntryCompare func(uintptr, *UnixMountEntry) int | |
| 32 | - | ||
| 33 | - | // Compares two Unix mounts. | |
| 34 | - | func (x *UnixMountEntry) Compare(Mount2Var *UnixMountEntry) int { | |
| 35 | - | ||
| 36 | - | cret := xUnixMountEntryCompare(x.GoPointer(), Mount2Var) | |
| 37 | - | return cret | |
| 38 | - | } | |
| 39 | - | ||
| 40 | - | var xUnixMountEntryCopy func(uintptr) *UnixMountEntry | |
| 41 | - | ||
| 42 | - | // Makes a copy of @mount_entry. | |
| 43 | - | func (x *UnixMountEntry) Copy() *UnixMountEntry { | |
| 44 | - | ||
| 45 | - | cret := xUnixMountEntryCopy(x.GoPointer()) | |
| 46 | - | return cret | |
| 47 | - | } | |
| 48 | - | ||
| 49 | - | var xUnixMountEntryFree func(uintptr) | |
| 50 | - | ||
| 51 | - | // Frees a Unix mount. | |
| 52 | - | func (x *UnixMountEntry) Free() { | |
| 53 | - | ||
| 54 | - | xUnixMountEntryFree(x.GoPointer()) | |
| 55 | - | ||
| 56 | - | } | |
| 57 | - | ||
| 58 | - | var xUnixMountEntryGetDevicePath func(uintptr) string | |
| 59 | - | ||
| 60 | - | // Gets the device path for a Unix mount. | |
| 61 | - | func (x *UnixMountEntry) GetDevicePath() string { | |
| 62 | - | ||
| 63 | - | cret := xUnixMountEntryGetDevicePath(x.GoPointer()) | |
| 64 | - | return cret | |
| 65 | - | } | |
| 66 | - | ||
| 67 | - | var xUnixMountEntryGetFsType func(uintptr) string | |
| 68 | - | ||
| 69 | - | // Gets the filesystem type for the Unix mount. | |
| 70 | - | func (x *UnixMountEntry) GetFsType() string { | |
| 71 | - | ||
| 72 | - | cret := xUnixMountEntryGetFsType(x.GoPointer()) | |
| 73 | - | return cret | |
| 74 | - | } | |
| 75 | - | ||
| 76 | - | var xUnixMountEntryGetMountPath func(uintptr) string | |
| 77 | - | ||
| 78 | - | // Gets the mount path for a Unix mount. | |
| 79 | - | func (x *UnixMountEntry) GetMountPath() string { | |
| 80 | - | ||
| 81 | - | cret := xUnixMountEntryGetMountPath(x.GoPointer()) | |
| 82 | - | return cret | |
| 83 | - | } | |
| 84 | - | ||
| 85 | - | var xUnixMountEntryGetOptions func(uintptr) string | |
| 86 | - | ||
| 87 | - | // Gets a comma separated list of mount options for the Unix mount. | |
| 88 | - | // | |
| 89 | - | // For example: `rw,relatime,seclabel,data=ordered`. | |
| 90 | - | // | |
| 91 | - | // This is similar to [func@GioUnix.MountPoint.get_options], but it takes | |
| 92 | - | // a [struct@GioUnix.MountEntry] as an argument. | |
| 93 | - | func (x *UnixMountEntry) GetOptions() string { | |
| 94 | - | ||
| 95 | - | cret := xUnixMountEntryGetOptions(x.GoPointer()) | |
| 96 | - | return cret | |
| 97 | - | } | |
| 98 | - | ||
| 99 | - | var xUnixMountEntryGetRootPath func(uintptr) string | |
| 100 | - | ||
| 101 | - | // Gets the root of the mount within the filesystem. This is useful e.g. for | |
| 102 | - | // mounts created by bind operation, or btrfs subvolumes. | |
| 103 | - | // | |
| 104 | - | // For example, the root path is equal to `/` for a mount created by | |
| 105 | - | // `mount /dev/sda1 /mnt/foo` and `/bar` for | |
| 106 | - | // `mount --bind /mnt/foo/bar /mnt/bar`. | |
| 107 | - | func (x *UnixMountEntry) GetRootPath() string { | |
| 108 | - | ||
| 109 | - | cret := xUnixMountEntryGetRootPath(x.GoPointer()) | |
| 110 | - | return cret | |
| 111 | - | } | |
| 112 | - | ||
| 113 | - | var xUnixMountEntryGuessCanEject func(uintptr) bool | |
| 114 | - | ||
| 115 | - | // Guesses whether a Unix mount entry can be ejected. | |
| 116 | - | func (x *UnixMountEntry) GuessCanEject() bool { | |
| 117 | - | ||
| 118 | - | cret := xUnixMountEntryGuessCanEject(x.GoPointer()) | |
| 119 | - | return cret | |
| 120 | - | } | |
| 121 | - | ||
| 122 | - | var xUnixMountEntryGuessIcon func(uintptr) uintptr | |
| 123 | - | ||
| 124 | - | // Guesses the icon of a Unix mount entry. | |
| 125 | - | func (x *UnixMountEntry) GuessIcon() *IconBase { | |
| 126 | - | var cls *IconBase | |
| 127 | - | ||
| 128 | - | cret := xUnixMountEntryGuessIcon(x.GoPointer()) | |
| 129 | - | ||
| 130 | - | if cret == 0 { | |
| 131 | - | return nil | |
| 132 | - | } | |
| 133 | - | cls = &IconBase{} | |
| 134 | - | cls.Ptr = cret | |
| 135 | - | return cls | |
| 136 | - | } | |
| 137 | - | ||
| 138 | - | var xUnixMountEntryGuessName func(uintptr) string | |
| 139 | - | ||
| 140 | - | // Guesses the name of a Unix mount entry. | |
| 141 | - | // | |
| 142 | - | // The result is a translated string. | |
| 143 | - | func (x *UnixMountEntry) GuessName() string { | |
| 144 | - | ||
| 145 | - | cret := xUnixMountEntryGuessName(x.GoPointer()) | |
| 146 | - | return cret | |
| 147 | - | } | |
| 148 | - | ||
| 149 | - | var xUnixMountEntryGuessShouldDisplay func(uintptr) bool | |
| 150 | - | ||
| 151 | - | // Guesses whether a Unix mount entry should be displayed in the UI. | |
| 152 | - | func (x *UnixMountEntry) GuessShouldDisplay() bool { | |
| 153 | - | ||
| 154 | - | cret := xUnixMountEntryGuessShouldDisplay(x.GoPointer()) | |
| 155 | - | return cret | |
| 156 | - | } | |
| 157 | - | ||
| 158 | - | var xUnixMountEntryGuessSymbolicIcon func(uintptr) uintptr | |
| 159 | - | ||
| 160 | - | // Guesses the symbolic icon of a Unix mount entry. | |
| 161 | - | func (x *UnixMountEntry) GuessSymbolicIcon() *IconBase { | |
| 162 | - | var cls *IconBase | |
| 163 | - | ||
| 164 | - | cret := xUnixMountEntryGuessSymbolicIcon(x.GoPointer()) | |
| 165 | - | ||
| 166 | - | if cret == 0 { | |
| 167 | - | return nil | |
| 168 | - | } | |
| 169 | - | cls = &IconBase{} | |
| 170 | - | cls.Ptr = cret | |
| 171 | - | return cls | |
| 172 | - | } | |
| 173 | - | ||
| 174 | - | var xUnixMountEntryIsReadonly func(uintptr) bool | |
| 175 | - | ||
| 176 | - | // Checks if a Unix mount is mounted read only. | |
| 177 | - | func (x *UnixMountEntry) IsReadonly() bool { | |
| 178 | - | ||
| 179 | - | cret := xUnixMountEntryIsReadonly(x.GoPointer()) | |
| 180 | - | return cret | |
| 181 | - | } | |
| 182 | - | ||
| 183 | - | var xUnixMountEntryIsSystemInternal func(uintptr) bool | |
| 184 | - | ||
| 185 | - | // Checks if a Unix mount is a system mount. | |
| 186 | - | // | |
| 187 | - | // This is the Boolean OR of | |
| 188 | - | // [func@GioUnix.is_system_fs_type], [func@GioUnix.is_system_device_path] and | |
| 189 | - | // [func@GioUnix.is_mount_path_system_internal] on @mount_entry’s properties. | |
| 190 | - | // | |
| 191 | - | // The definition of what a ‘system’ mount entry is may change over time as new | |
| 192 | - | // file system types and device paths are ignored. | |
| 193 | - | func (x *UnixMountEntry) IsSystemInternal() bool { | |
| 194 | - | ||
| 195 | - | cret := xUnixMountEntryIsSystemInternal(x.GoPointer()) | |
| 196 | - | return cret | |
| 197 | - | } | |
| 198 | - | ||
| 199 | - | type UnixMountMonitorClass struct { | |
| 200 | - | _ structs.HostLayout | |
| 201 | - | } | |
| 202 | - | ||
| 203 | - | func (x *UnixMountMonitorClass) GoPointer() uintptr { | |
| 204 | - | return uintptr(unsafe.Pointer(x)) | |
| 205 | - | } | |
| 206 | - | ||
| 207 | - | // Defines a Unix mount point (e.g. `/dev`). | |
| 208 | - | // This corresponds roughly to a fstab entry. | |
| 209 | - | type UnixMountPoint struct { | |
| 210 | - | _ structs.HostLayout | |
| 211 | - | } | |
| 212 | - | ||
| 213 | - | var xUnixMountPointGLibType func() types.GType | |
| 214 | - | ||
| 215 | - | func UnixMountPointGLibType() types.GType { | |
| 216 | - | return xUnixMountPointGLibType() | |
| 217 | - | } | |
| 218 | - | ||
| 219 | - | func (x *UnixMountPoint) GoPointer() uintptr { | |
| 220 | - | return uintptr(unsafe.Pointer(x)) | |
| 221 | - | } | |
| 222 | - | ||
| 223 | - | var xUnixMountPointCompare func(uintptr, *UnixMountPoint) int | |
| 224 | - | ||
| 225 | - | // Compares two Unix mount points. | |
| 226 | - | func (x *UnixMountPoint) Compare(Mount2Var *UnixMountPoint) int { | |
| 227 | - | ||
| 228 | - | cret := xUnixMountPointCompare(x.GoPointer(), Mount2Var) | |
| 229 | - | return cret | |
| 230 | - | } | |
| 231 | - | ||
| 232 | - | var xUnixMountPointCopy func(uintptr) *UnixMountPoint | |
| 233 | - | ||
| 234 | - | // Makes a copy of @mount_point. | |
| 235 | - | func (x *UnixMountPoint) Copy() *UnixMountPoint { | |
| 236 | - | ||
| 237 | - | cret := xUnixMountPointCopy(x.GoPointer()) | |
| 238 | - | return cret | |
| 239 | - | } | |
| 240 | - | ||
| 241 | - | var xUnixMountPointFree func(uintptr) | |
| 242 | - | ||
| 243 | - | // Frees a Unix mount point. | |
| 244 | - | func (x *UnixMountPoint) Free() { | |
| 245 | - | ||
| 246 | - | xUnixMountPointFree(x.GoPointer()) | |
| 247 | - | ||
| 248 | - | } | |
| 249 | - | ||
| 250 | - | var xUnixMountPointGetDevicePath func(uintptr) string | |
| 251 | - | ||
| 252 | - | // Gets the device path for a Unix mount point. | |
| 253 | - | func (x *UnixMountPoint) GetDevicePath() string { | |
| 254 | - | ||
| 255 | - | cret := xUnixMountPointGetDevicePath(x.GoPointer()) | |
| 256 | - | return cret | |
| 257 | - | } | |
| 258 | - | ||
| 259 | - | var xUnixMountPointGetFsType func(uintptr) string | |
| 260 | - | ||
| 261 | - | // Gets the file system type for the mount point. | |
| 262 | - | func (x *UnixMountPoint) GetFsType() string { | |
| 263 | - | ||
| 264 | - | cret := xUnixMountPointGetFsType(x.GoPointer()) | |
| 265 | - | return cret | |
| 266 | - | } | |
| 267 | - | ||
| 268 | - | var xUnixMountPointGetMountPath func(uintptr) string | |
| 269 | - | ||
| 270 | - | // Gets the mount path for a Unix mount point. | |
| 271 | - | func (x *UnixMountPoint) GetMountPath() string { | |
| 272 | - | ||
| 273 | - | cret := xUnixMountPointGetMountPath(x.GoPointer()) | |
| 274 | - | return cret | |
| 275 | - | } | |
| 276 | - | ||
| 277 | - | var xUnixMountPointGetOptions func(uintptr) string | |
| 278 | - | ||
| 279 | - | // Gets the options for the mount point. | |
| 280 | - | func (x *UnixMountPoint) GetOptions() string { | |
| 281 | - | ||
| 282 | - | cret := xUnixMountPointGetOptions(x.GoPointer()) | |
| 283 | - | return cret | |
| 284 | - | } | |
| 285 | - | ||
| 286 | - | var xUnixMountPointGuessCanEject func(uintptr) bool | |
| 287 | - | ||
| 288 | - | // Guesses whether a Unix mount point can be ejected. | |
| 289 | - | func (x *UnixMountPoint) GuessCanEject() bool { | |
| 290 | - | ||
| 291 | - | cret := xUnixMountPointGuessCanEject(x.GoPointer()) | |
| 292 | - | return cret | |
| 293 | - | } | |
| 294 | - | ||
| 295 | - | var xUnixMountPointGuessIcon func(uintptr) uintptr | |
| 296 | - | ||
| 297 | - | // Guesses the icon of a Unix mount point. | |
| 298 | - | func (x *UnixMountPoint) GuessIcon() *IconBase { | |
| 299 | - | var cls *IconBase | |
| 300 | - | ||
| 301 | - | cret := xUnixMountPointGuessIcon(x.GoPointer()) | |
| 302 | - | ||
| 303 | - | if cret == 0 { | |
| 304 | - | return nil | |
| 305 | - | } | |
| 306 | - | cls = &IconBase{} | |
| 307 | - | cls.Ptr = cret | |
| 308 | - | return cls | |
| 309 | - | } | |
| 310 | - | ||
| 311 | - | var xUnixMountPointGuessName func(uintptr) string | |
| 312 | - | ||
| 313 | - | // Guesses the name of a Unix mount point. | |
| 314 | - | // | |
| 315 | - | // The result is a translated string. | |
| 316 | - | func (x *UnixMountPoint) GuessName() string { | |
| 317 | - | ||
| 318 | - | cret := xUnixMountPointGuessName(x.GoPointer()) | |
| 319 | - | return cret | |
| 320 | - | } | |
| 321 | - | ||
| 322 | - | var xUnixMountPointGuessSymbolicIcon func(uintptr) uintptr | |
| 323 | - | ||
| 324 | - | // Guesses the symbolic icon of a Unix mount point. | |
| 325 | - | func (x *UnixMountPoint) GuessSymbolicIcon() *IconBase { | |
| 326 | - | var cls *IconBase | |
| 327 | - | ||
| 328 | - | cret := xUnixMountPointGuessSymbolicIcon(x.GoPointer()) | |
| 329 | - | ||
| 330 | - | if cret == 0 { | |
| 331 | - | return nil | |
| 332 | - | } | |
| 333 | - | cls = &IconBase{} | |
| 334 | - | cls.Ptr = cret | |
| 335 | - | return cls | |
| 336 | - | } | |
| 337 | - | ||
| 338 | - | var xUnixMountPointIsLoopback func(uintptr) bool | |
| 339 | - | ||
| 340 | - | // Checks if a Unix mount point is a loopback device. | |
| 341 | - | func (x *UnixMountPoint) IsLoopback() bool { | |
| 342 | - | ||
| 343 | - | cret := xUnixMountPointIsLoopback(x.GoPointer()) | |
| 344 | - | return cret | |
| 345 | - | } | |
| 346 | - | ||
| 347 | - | var xUnixMountPointIsReadonly func(uintptr) bool | |
| 348 | - | ||
| 349 | - | // Checks if a Unix mount point is read only. | |
| 350 | - | func (x *UnixMountPoint) IsReadonly() bool { | |
| 351 | - | ||
| 352 | - | cret := xUnixMountPointIsReadonly(x.GoPointer()) | |
| 353 | - | return cret | |
| 354 | - | } | |
| 355 | - | ||
| 356 | - | var xUnixMountPointIsUserMountable func(uintptr) bool | |
| 357 | - | ||
| 358 | - | // Checks if a Unix mount point is mountable by the user. | |
| 359 | - | func (x *UnixMountPoint) IsUserMountable() bool { | |
| 360 | - | ||
| 361 | - | cret := xUnixMountPointIsUserMountable(x.GoPointer()) | |
| 362 | - | return cret | |
| 363 | - | } | |
| 364 | - | ||
| 365 | - | var xUnixIsMountPathSystemInternal func(string) bool | |
| 366 | - | ||
| 367 | - | // Determines if @mount_path is considered an implementation of the | |
| 368 | - | // OS. | |
| 369 | - | // | |
| 370 | - | // This is primarily used for hiding mountable and mounted volumes | |
| 371 | - | // that only are used in the OS and has little to no relevance to the | |
| 372 | - | // casual user. | |
| 373 | - | func UnixIsMountPathSystemInternal(MountPathVar string) bool { | |
| 374 | - | ||
| 375 | - | cret := xUnixIsMountPathSystemInternal(MountPathVar) | |
| 376 | - | return cret | |
| 377 | - | } | |
| 378 | - | ||
| 379 | - | var xUnixIsSystemDevicePath func(string) bool | |
| 380 | - | ||
| 381 | - | // Determines if @device_path is considered a block device path which is only | |
| 382 | - | // used in implementation of the OS. | |
| 383 | - | // | |
| 384 | - | // This is primarily used for hiding mounted volumes that are intended as APIs | |
| 385 | - | // for programs to read, and system administrators at a shell; rather than | |
| 386 | - | // something that should, for example, appear in a GUI. For example, the Linux | |
| 387 | - | // `/proc` filesystem. | |
| 388 | - | // | |
| 389 | - | // The list of device paths considered ‘system’ ones may change over time. | |
| 390 | - | func UnixIsSystemDevicePath(DevicePathVar string) bool { | |
| 391 | - | ||
| 392 | - | cret := xUnixIsSystemDevicePath(DevicePathVar) | |
| 393 | - | return cret | |
| 394 | - | } | |
| 395 | - | ||
| 396 | - | var xUnixIsSystemFsType func(string) bool | |
| 397 | - | ||
| 398 | - | // Determines if @fs_type is considered a type of file system which is only | |
| 399 | - | // used in implementation of the OS. | |
| 400 | - | // | |
| 401 | - | // This is primarily used for hiding mounted volumes that are intended as APIs | |
| 402 | - | // for programs to read, and system administrators at a shell; rather than | |
| 403 | - | // something that should, for example, appear in a GUI. For example, the Linux | |
| 404 | - | // `/proc` filesystem. | |
| 405 | - | // | |
| 406 | - | // The list of file system types considered ‘system’ ones may change over time. | |
| 407 | - | func UnixIsSystemFsType(FsTypeVar string) bool { | |
| 408 | - | ||
| 409 | - | cret := xUnixIsSystemFsType(FsTypeVar) | |
| 410 | - | return cret | |
| 411 | - | } | |
| 412 | - | ||
| 413 | - | var xUnixMountAt func(string, uint64) *UnixMountEntry | |
| 414 | - | ||
| 415 | - | // Gets a [struct@GioUnix.MountEntry] for a given mount path. | |
| 416 | - | // | |
| 417 | - | // If @time_read is set, it will be filled with a Unix timestamp for checking | |
| 418 | - | // if the mounts have changed since with | |
| 419 | - | // [func@GioUnix.mount_entries_changed_since]. | |
| 420 | - | // | |
| 421 | - | // If more mounts have the same mount path, the last matching mount | |
| 422 | - | // is returned. | |
| 423 | - | // | |
| 424 | - | // This will return `NULL` if there is no mount point at @mount_path. | |
| 425 | - | func UnixMountAt(MountPathVar string, TimeReadVar uint64) *UnixMountEntry { | |
| 426 | - | ||
| 427 | - | cret := xUnixMountAt(MountPathVar, TimeReadVar) | |
| 428 | - | return cret | |
| 429 | - | } | |
| 430 | - | ||
| 431 | - | var xUnixMountCompare func(*UnixMountEntry, *UnixMountEntry) int | |
| 432 | - | ||
| 433 | - | // Compares two Unix mounts. | |
| 434 | - | func UnixMountCompare(Mount1Var *UnixMountEntry, Mount2Var *UnixMountEntry) int { | |
| 435 | - | ||
| 436 | - | cret := xUnixMountCompare(Mount1Var, Mount2Var) | |
| 437 | - | return cret | |
| 438 | - | } | |
| 439 | - | ||
| 440 | - | var xUnixMountCopy func(*UnixMountEntry) *UnixMountEntry | |
| 441 | - | ||
| 442 | - | // Makes a copy of @mount_entry. | |
| 443 | - | func UnixMountCopy(MountEntryVar *UnixMountEntry) *UnixMountEntry { | |
| 444 | - | ||
| 445 | - | cret := xUnixMountCopy(MountEntryVar) | |
| 446 | - | return cret | |
| 447 | - | } | |
| 448 | - | ||
| 449 | - | var xUnixMountEntriesChangedSince func(uint64) bool | |
| 450 | - | ||
| 451 | - | // Checks if the Unix mounts have changed since a given Unix time. | |
| 452 | - | // | |
| 453 | - | // This can only work reliably if a [class@GioUnix.MountMonitor] is running in | |
| 454 | - | // the process, otherwise changes in the mount entries file (such as | |
| 455 | - | // `/proc/self/mountinfo` on Linux) cannot be detected and, as a result, this | |
| 456 | - | // function has to conservatively always return `TRUE`. | |
| 457 | - | // | |
| 458 | - | // It is more efficient to use [signal@GioUnix.MountMonitor::mounts-changed] to | |
| 459 | - | // be signalled of changes to the mount entries, rather than polling using this | |
| 460 | - | // function. This function is more appropriate for infrequently determining | |
| 461 | - | // cache validity. | |
| 462 | - | func UnixMountEntriesChangedSince(TimeVar uint64) bool { | |
| 463 | - | ||
| 464 | - | cret := xUnixMountEntriesChangedSince(TimeVar) | |
| 465 | - | return cret | |
| 466 | - | } | |
| 467 | - | ||
| 468 | - | var xUnixMountEntriesGet func(uint64) *glib.List | |
| 469 | - | ||
| 470 | - | // Gets a list of [struct@GioUnix.MountEntry] instances representing the Unix | |
| 471 | - | // mounts. | |
| 472 | - | // | |
| 473 | - | // If @time_read is set, it will be filled with the mount timestamp, allowing | |
| 474 | - | // for checking if the mounts have changed with | |
| 475 | - | // [func@GioUnix.mount_entries_changed_since]. | |
| 476 | - | func UnixMountEntriesGet(TimeReadVar uint64) *glib.List { | |
| 477 | - | ||
| 478 | - | cret := xUnixMountEntriesGet(TimeReadVar) | |
| 479 | - | return cret | |
| 480 | - | } | |
| 481 | - | ||
| 482 | - | var xUnixMountEntriesGetFromFile func(string, uint64, uint) uintptr | |
| 483 | - | ||
| 484 | - | // Gets an array of [struct@Gio.UnixMountEntry]s containing the Unix mounts | |
| 485 | - | // listed in @table_path. | |
| 486 | - | // | |
| 487 | - | // This is a generalized version of [func@GioUnix.mount_entries_get], mainly | |
| 488 | - | // intended for internal testing use. Note that [func@GioUnix.mount_entries_get] | |
| 489 | - | // may parse multiple hierarchical table files, so this function is not a direct | |
| 490 | - | // superset of its functionality. | |
| 491 | - | // | |
| 492 | - | // If there is an error reading or parsing the file, `NULL` will be returned | |
| 493 | - | // and both out parameters will be set to `0`. | |
| 494 | - | func UnixMountEntriesGetFromFile(TablePathVar string, TimeReadOutVar uint64, NEntriesOutVar uint) uintptr { | |
| 495 | - | ||
| 496 | - | cret := xUnixMountEntriesGetFromFile(TablePathVar, TimeReadOutVar, NEntriesOutVar) | |
| 497 | - | return cret | |
| 498 | - | } | |
| 499 | - | ||
| 500 | - | var xUnixMountEntryAt func(string, uint64) *UnixMountEntry | |
| 501 | - | ||
| 502 | - | // Gets a [struct@GioUnix.MountEntry] for a given mount path. | |
| 503 | - | // | |
| 504 | - | // If @time_read is set, it will be filled with a Unix timestamp for checking | |
| 505 | - | // if the mounts have changed since with | |
| 506 | - | // [func@GioUnix.mount_entries_changed_since]. | |
| 507 | - | // | |
| 508 | - | // If more mounts have the same mount path, the last matching mount | |
| 509 | - | // is returned. | |
| 510 | - | // | |
| 511 | - | // This will return `NULL` if there is no mount point at @mount_path. | |
| 512 | - | func UnixMountEntryAt(MountPathVar string, TimeReadVar uint64) *UnixMountEntry { | |
| 513 | - | ||
| 514 | - | cret := xUnixMountEntryAt(MountPathVar, TimeReadVar) | |
| 515 | - | return cret | |
| 516 | - | } | |
| 517 | - | ||
| 518 | - | var xUnixMountEntryFor func(string, uint64) *UnixMountEntry | |
| 519 | - | ||
| 520 | - | // Gets a [struct@GioUnix.MountEntry] for a given file path. | |
| 521 | - | // | |
| 522 | - | // If @time_read is set, it will be filled with a Unix timestamp for checking | |
| 523 | - | // if the mounts have changed since with | |
| 524 | - | // [func@GioUnix.mount_entries_changed_since]. | |
| 525 | - | // | |
| 526 | - | // If more mounts have the same mount path, the last matching mount | |
| 527 | - | // is returned. | |
| 528 | - | // | |
| 529 | - | // This will return `NULL` if looking up the mount entry fails, if | |
| 530 | - | // @file_path doesn’t exist or there is an I/O error. | |
| 531 | - | func UnixMountEntryFor(FilePathVar string, TimeReadVar uint64) *UnixMountEntry { | |
| 532 | - | ||
| 533 | - | cret := xUnixMountEntryFor(FilePathVar, TimeReadVar) | |
| 534 | - | return cret | |
| 535 | - | } | |
| 536 | - | ||
| 537 | - | var xUnixMountFor func(string, uint64) *UnixMountEntry | |
| 538 | - | ||
| 539 | - | // Gets a [struct@GioUnix.MountEntry] for a given file path. | |
| 540 | - | // | |
| 541 | - | // If @time_read is set, it will be filled with a Unix timestamp for checking | |
| 542 | - | // if the mounts have changed since with | |
| 543 | - | // [func@GioUnix.mount_entries_changed_since]. | |
| 544 | - | // | |
| 545 | - | // If more mounts have the same mount path, the last matching mount | |
| 546 | - | // is returned. | |
| 547 | - | // | |
| 548 | - | // This will return `NULL` if looking up the mount entry fails, if | |
| 549 | - | // @file_path doesn’t exist or there is an I/O error. | |
| 550 | - | func UnixMountFor(FilePathVar string, TimeReadVar uint64) *UnixMountEntry { | |
| 551 | - | ||
| 552 | - | cret := xUnixMountFor(FilePathVar, TimeReadVar) | |
| 553 | - | return cret | |
| 554 | - | } | |
| 555 | - | ||
| 556 | - | var xUnixMountFree func(*UnixMountEntry) | |
| 557 | - | ||
| 558 | - | // Frees a Unix mount. | |
| 559 | - | func UnixMountFree(MountEntryVar *UnixMountEntry) { | |
| 560 | - | ||
| 561 | - | xUnixMountFree(MountEntryVar) | |
| 562 | - | ||
| 563 | - | } | |
| 564 | - | ||
| 565 | - | var xUnixMountGetDevicePath func(*UnixMountEntry) string | |
| 566 | - | ||
| 567 | - | // Gets the device path for a Unix mount. | |
| 568 | - | func UnixMountGetDevicePath(MountEntryVar *UnixMountEntry) string { | |
| 569 | - | ||
| 570 | - | cret := xUnixMountGetDevicePath(MountEntryVar) | |
| 571 | - | return cret | |
| 572 | - | } | |
| 573 | - | ||
| 574 | - | var xUnixMountGetFsType func(*UnixMountEntry) string | |
| 575 | - | ||
| 576 | - | // Gets the filesystem type for the Unix mount. | |
| 577 | - | func UnixMountGetFsType(MountEntryVar *UnixMountEntry) string { | |
| 578 | - | ||
| 579 | - | cret := xUnixMountGetFsType(MountEntryVar) | |
| 580 | - | return cret | |
| 581 | - | } | |
| 582 | - | ||
| 583 | - | var xUnixMountGetMountPath func(*UnixMountEntry) string | |
| 584 | - | ||
| 585 | - | // Gets the mount path for a Unix mount. | |
| 586 | - | func UnixMountGetMountPath(MountEntryVar *UnixMountEntry) string { | |
| 587 | - | ||
| 588 | - | cret := xUnixMountGetMountPath(MountEntryVar) | |
| 589 | - | return cret | |
| 590 | - | } | |
| 591 | - | ||
| 592 | - | var xUnixMountGetOptions func(*UnixMountEntry) string | |
| 593 | - | ||
| 594 | - | // Gets a comma separated list of mount options for the Unix mount. | |
| 595 | - | // | |
| 596 | - | // For example: `rw,relatime,seclabel,data=ordered`. | |
| 597 | - | // | |
| 598 | - | // This is similar to [func@GioUnix.MountPoint.get_options], but it takes | |
| 599 | - | // a [struct@GioUnix.MountEntry] as an argument. | |
| 600 | - | func UnixMountGetOptions(MountEntryVar *UnixMountEntry) string { | |
| 601 | - | ||
| 602 | - | cret := xUnixMountGetOptions(MountEntryVar) | |
| 603 | - | return cret | |
| 604 | - | } | |
| 605 | - | ||
| 606 | - | var xUnixMountGetRootPath func(*UnixMountEntry) string | |
| 607 | - | ||
| 608 | - | // Gets the root of the mount within the filesystem. This is useful e.g. for | |
| 609 | - | // mounts created by bind operation, or btrfs subvolumes. | |
| 610 | - | // | |
| 611 | - | // For example, the root path is equal to `/` for a mount created by | |
| 612 | - | // `mount /dev/sda1 /mnt/foo` and `/bar` for | |
| 613 | - | // `mount --bind /mnt/foo/bar /mnt/bar`. | |
| 614 | - | func UnixMountGetRootPath(MountEntryVar *UnixMountEntry) string { | |
| 615 | - | ||
| 616 | - | cret := xUnixMountGetRootPath(MountEntryVar) | |
| 617 | - | return cret | |
| 618 | - | } | |
| 619 | - | ||
| 620 | - | var xUnixMountGuessCanEject func(*UnixMountEntry) bool | |
| 621 | - | ||
| 622 | - | // Guesses whether a Unix mount entry can be ejected. | |
| 623 | - | func UnixMountGuessCanEject(MountEntryVar *UnixMountEntry) bool { | |
| 624 | - | ||
| 625 | - | cret := xUnixMountGuessCanEject(MountEntryVar) | |
| 626 | - | return cret | |
| 627 | - | } | |
| 628 | - | ||
| 629 | - | var xUnixMountGuessIcon func(*UnixMountEntry) uintptr | |
| 630 | - | ||
| 631 | - | // Guesses the icon of a Unix mount entry. | |
| 632 | - | func UnixMountGuessIcon(MountEntryVar *UnixMountEntry) *IconBase { | |
| 633 | - | var cls *IconBase | |
| 634 | - | ||
| 635 | - | cret := xUnixMountGuessIcon(MountEntryVar) | |
| 636 | - | ||
| 637 | - | if cret == 0 { | |
| 638 | - | return nil | |
| 639 | - | } | |
| 640 | - | cls = &IconBase{} | |
| 641 | - | cls.Ptr = cret | |
| 642 | - | return cls | |
| 643 | - | } | |
| 644 | - | ||
| 645 | - | var xUnixMountGuessName func(*UnixMountEntry) string | |
| 646 | - | ||
| 647 | - | // Guesses the name of a Unix mount entry. | |
| 648 | - | // | |
| 649 | - | // The result is a translated string. | |
| 650 | - | func UnixMountGuessName(MountEntryVar *UnixMountEntry) string { | |
| 651 | - | ||
| 652 | - | cret := xUnixMountGuessName(MountEntryVar) | |
| 653 | - | return cret | |
| 654 | - | } | |
| 655 | - | ||
| 656 | - | var xUnixMountGuessShouldDisplay func(*UnixMountEntry) bool | |
| 657 | - | ||
| 658 | - | // Guesses whether a Unix mount entry should be displayed in the UI. | |
| 659 | - | func UnixMountGuessShouldDisplay(MountEntryVar *UnixMountEntry) bool { | |
| 660 | - | ||
| 661 | - | cret := xUnixMountGuessShouldDisplay(MountEntryVar) | |
| 662 | - | return cret | |
| 663 | - | } | |
| 664 | - | ||
| 665 | - | var xUnixMountGuessSymbolicIcon func(*UnixMountEntry) uintptr | |
| 666 | - | ||
| 667 | - | // Guesses the symbolic icon of a Unix mount entry. | |
| 668 | - | func UnixMountGuessSymbolicIcon(MountEntryVar *UnixMountEntry) *IconBase { | |
| 669 | - | var cls *IconBase | |
| 670 | - | ||
| 671 | - | cret := xUnixMountGuessSymbolicIcon(MountEntryVar) | |
| 672 | - | ||
| 673 | - | if cret == 0 { | |
| 674 | - | return nil | |
| 675 | - | } | |
| 676 | - | cls = &IconBase{} | |
| 677 | - | cls.Ptr = cret | |
| 678 | - | return cls | |
| 679 | - | } | |
| 680 | - | ||
| 681 | - | var xUnixMountIsReadonly func(*UnixMountEntry) bool | |
| 682 | - | ||
| 683 | - | // Checks if a Unix mount is mounted read only. | |
| 684 | - | func UnixMountIsReadonly(MountEntryVar *UnixMountEntry) bool { | |
| 685 | - | ||
| 686 | - | cret := xUnixMountIsReadonly(MountEntryVar) | |
| 687 | - | return cret | |
| 688 | - | } | |
| 689 | - | ||
| 690 | - | var xUnixMountIsSystemInternal func(*UnixMountEntry) bool | |
| 691 | - | ||
| 692 | - | // Checks if a Unix mount is a system mount. | |
| 693 | - | // | |
| 694 | - | // This is the Boolean OR of | |
| 695 | - | // [func@GioUnix.is_system_fs_type], [func@GioUnix.is_system_device_path] and | |
| 696 | - | // [func@GioUnix.is_mount_path_system_internal] on @mount_entry’s properties. | |
| 697 | - | // | |
| 698 | - | // The definition of what a ‘system’ mount entry is may change over time as new | |
| 699 | - | // file system types and device paths are ignored. | |
| 700 | - | func UnixMountIsSystemInternal(MountEntryVar *UnixMountEntry) bool { | |
| 701 | - | ||
| 702 | - | cret := xUnixMountIsSystemInternal(MountEntryVar) | |
| 703 | - | return cret | |
| 704 | - | } | |
| 705 | - | ||
| 706 | - | var xUnixMountPointAt func(string, uint64) *UnixMountPoint | |
| 707 | - | ||
| 708 | - | // Gets a [struct@GioUnix.MountPoint] for a given mount path. | |
| 709 | - | // | |
| 710 | - | // If @time_read is set, it will be filled with a Unix timestamp for checking if | |
| 711 | - | // the mount points have changed since with | |
| 712 | - | // [func@GioUnix.mount_points_changed_since]. | |
| 713 | - | // | |
| 714 | - | // If more mount points have the same mount path, the last matching mount point | |
| 715 | - | // is returned. | |
| 716 | - | func UnixMountPointAt(MountPathVar string, TimeReadVar uint64) *UnixMountPoint { | |
| 717 | - | ||
| 718 | - | cret := xUnixMountPointAt(MountPathVar, TimeReadVar) | |
| 719 | - | return cret | |
| 720 | - | } | |
| 721 | - | ||
| 722 | - | var xUnixMountPointsChangedSince func(uint64) bool | |
| 723 | - | ||
| 724 | - | // Checks if the Unix mount points have changed since a given Unix time. | |
| 725 | - | // | |
| 726 | - | // Unlike [func@GioUnix.mount_entries_changed_since], this function can work | |
| 727 | - | // reliably without a [class@GioUnix.MountMonitor] running, as it accesses the | |
| 728 | - | // static mount point information (such as `/etc/fstab` on Linux), which has a | |
| 729 | - | // valid modification time. | |
| 730 | - | // | |
| 731 | - | // It is more efficient to use [signal@GioUnix.MountMonitor::mountpoints-changed] | |
| 732 | - | // to be signalled of changes to the mount points, rather than polling using | |
| 733 | - | // this function. This function is more appropriate for infrequently determining | |
| 734 | - | // cache validity. | |
| 735 | - | func UnixMountPointsChangedSince(TimeVar uint64) bool { | |
| 736 | - | ||
| 737 | - | cret := xUnixMountPointsChangedSince(TimeVar) | |
| 738 | - | return cret | |
| 739 | - | } | |
| 740 | - | ||
| 741 | - | var xUnixMountPointsGet func(uint64) *glib.List | |
| 742 | - | ||
| 743 | - | // Gets a list of [struct@GioUnix.MountPoint] instances representing the Unix | |
| 744 | - | // mount points. | |
| 745 | - | // | |
| 746 | - | // If @time_read is set, it will be filled with the mount timestamp, allowing | |
| 747 | - | // for checking if the mounts have changed with | |
| 748 | - | // [func@GioUnix.mount_points_changed_since]. | |
| 749 | - | func UnixMountPointsGet(TimeReadVar uint64) *glib.List { | |
| 750 | - | ||
| 751 | - | cret := xUnixMountPointsGet(TimeReadVar) | |
| 752 | - | return cret | |
| 753 | - | } | |
| 754 | - | ||
| 755 | - | var xUnixMountPointsGetFromFile func(string, uint64, uint) uintptr | |
| 756 | - | ||
| 757 | - | // Gets an array of [struct@Gio.UnixMountPoint]s containing the Unix mount | |
| 758 | - | // points listed in @table_path. | |
| 759 | - | // | |
| 760 | - | // This is a generalized version of [func@GioUnix.mount_points_get], mainly | |
| 761 | - | // intended for internal testing use. Note that [func@GioUnix.mount_points_get] | |
| 762 | - | // may parse multiple hierarchical table files, so this function is not a direct | |
| 763 | - | // superset of its functionality. | |
| 764 | - | // | |
| 765 | - | // If there is an error reading or parsing the file, `NULL` will be returned | |
| 766 | - | // and both out parameters will be set to `0`. | |
| 767 | - | func UnixMountPointsGetFromFile(TablePathVar string, TimeReadOutVar uint64, NPointsOutVar uint) uintptr { | |
| 768 | - | ||
| 769 | - | cret := xUnixMountPointsGetFromFile(TablePathVar, TimeReadOutVar, NPointsOutVar) | |
| 770 | - | return cret | |
| 771 | - | } | |
| 772 | - | ||
| 773 | - | var xUnixMountsChangedSince func(uint64) bool | |
| 774 | - | ||
| 775 | - | // Checks if the Unix mounts have changed since a given Unix time. | |
| 776 | - | func UnixMountsChangedSince(TimeVar uint64) bool { | |
| 777 | - | ||
| 778 | - | cret := xUnixMountsChangedSince(TimeVar) | |
| 779 | - | return cret | |
| 780 | - | } | |
| 781 | - | ||
| 782 | - | var xUnixMountsGet func(uint64) *glib.List | |
| 783 | - | ||
| 784 | - | // Gets a list of [struct@GioUnix.MountEntry] instances representing the Unix | |
| 785 | - | // mounts. | |
| 786 | - | // | |
| 787 | - | // If @time_read is set, it will be filled with the mount timestamp, allowing | |
| 788 | - | // for checking if the mounts have changed with | |
| 789 | - | // [func@GioUnix.mount_entries_changed_since]. | |
| 790 | - | func UnixMountsGet(TimeReadVar uint64) *glib.List { | |
| 791 | - | ||
| 792 | - | cret := xUnixMountsGet(TimeReadVar) | |
| 793 | - | return cret | |
| 794 | - | } | |
| 795 | - | ||
| 796 | - | var xUnixMountsGetFromFile func(string, uint64, uint) uintptr | |
| 797 | - | ||
| 798 | - | // Gets an array of [struct@Gio.UnixMountEntry]s containing the Unix mounts | |
| 799 | - | // listed in @table_path. | |
| 800 | - | // | |
| 801 | - | // This is a generalized version of [func@GioUnix.mount_entries_get], mainly | |
| 802 | - | // intended for internal testing use. Note that [func@GioUnix.mount_entries_get] | |
| 803 | - | // may parse multiple hierarchical table files, so this function is not a direct | |
| 804 | - | // superset of its functionality. | |
| 805 | - | // | |
| 806 | - | // If there is an error reading or parsing the file, `NULL` will be returned | |
| 807 | - | // and both out parameters will be set to `0`. | |
| 808 | - | func UnixMountsGetFromFile(TablePathVar string, TimeReadOutVar uint64, NEntriesOutVar uint) uintptr { | |
| 809 | - | ||
| 810 | - | cret := xUnixMountsGetFromFile(TablePathVar, TimeReadOutVar, NEntriesOutVar) | |
| 811 | - | return cret | |
| 812 | - | } | |
| 813 | - | ||
| 814 | - | // Watches for changes to the set of mount entries and mount points in the | |
| 815 | - | // system. | |
| 816 | - | // | |
| 817 | - | // Connect to the [signal@GioUnix.MountMonitor::mounts-changed] signal to be | |
| 818 | - | // notified of changes to the [struct@GioUnix.MountEntry] list. | |
| 819 | - | // | |
| 820 | - | // Connect to the [signal@GioUnix.MountMonitor::mountpoints-changed] signal to | |
| 821 | - | // be notified of changes to the [struct@GioUnix.MountPoint] list. | |
| 822 | - | type UnixMountMonitor struct { | |
| 823 | - | gobject.Object | |
| 824 | - | } | |
| 825 | - | ||
| 826 | - | var xUnixMountMonitorGLibType func() types.GType | |
| 827 | - | ||
| 828 | - | func UnixMountMonitorGLibType() types.GType { | |
| 829 | - | return xUnixMountMonitorGLibType() | |
| 830 | - | } | |
| 831 | - | ||
| 832 | - | func UnixMountMonitorNewFromInternalPtr(ptr uintptr) *UnixMountMonitor { | |
| 833 | - | cls := &UnixMountMonitor{} | |
| 834 | - | cls.Ptr = ptr | |
| 835 | - | return cls | |
| 836 | - | } | |
| 837 | - | ||
| 838 | - | var xNewUnixMountMonitor func() uintptr | |
| 839 | - | ||
| 840 | - | // Deprecated alias for [func@GioUnix.MountMonitor.get]. | |
| 841 | - | // | |
| 842 | - | // This function was never a true constructor, which is why it was | |
| 843 | - | // renamed. | |
| 844 | - | func NewUnixMountMonitor() *UnixMountMonitor { | |
| 845 | - | var cls *UnixMountMonitor | |
| 846 | - | ||
| 847 | - | cret := xNewUnixMountMonitor() | |
| 848 | - | ||
| 849 | - | if cret == 0 { | |
| 850 | - | return nil | |
| 851 | - | } | |
| 852 | - | cls = &UnixMountMonitor{} | |
| 853 | - | cls.Ptr = cret | |
| 854 | - | return cls | |
| 855 | - | } | |
| 856 | - | ||
| 857 | - | var xUnixMountMonitorSetRateLimit func(uintptr, int) | |
| 858 | - | ||
| 859 | - | // This function does nothing. | |
| 860 | - | // | |
| 861 | - | // Before 2.44, this was a partially-effective way of controlling the | |
| 862 | - | // rate at which events would be reported under some uncommon | |
| 863 | - | // circumstances. Since @mount_monitor is a singleton, it also meant | |
| 864 | - | // that calling this function would have side effects for other users of | |
| 865 | - | // the monitor. | |
| 866 | - | func (x *UnixMountMonitor) SetRateLimit(LimitMsecVar int) { | |
| 867 | - | ||
| 868 | - | xUnixMountMonitorSetRateLimit(x.GoPointer(), LimitMsecVar) | |
| 869 | - | ||
| 870 | - | } | |
| 871 | - | ||
| 872 | - | func (c *UnixMountMonitor) GoPointer() uintptr { | |
| 873 | - | if c == nil { | |
| 874 | - | return 0 | |
| 875 | - | } | |
| 876 | - | return c.Ptr | |
| 877 | - | } | |
| 878 | - | ||
| 879 | - | func (c *UnixMountMonitor) SetGoPointer(ptr uintptr) { | |
| 880 | - | c.Ptr = ptr | |
| 881 | - | } | |
| 882 | - | ||
| 883 | - | // Emitted when the Unix mount points have changed. | |
| 884 | - | func (x *UnixMountMonitor) ConnectMountpointsChanged(cb *func(UnixMountMonitor)) uint32 { | |
| 885 | - | cbPtr := uintptr(unsafe.Pointer(cb)) | |
| 886 | - | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |
| 887 | - | return gobject.SignalConnect(x.GoPointer(), "mountpoints-changed", cbRefPtr) | |
| 888 | - | } | |
| 889 | - | ||
| 890 | - | fcb := func(clsPtr uintptr) { | |
| 891 | - | fa := UnixMountMonitor{} | |
| 892 | - | fa.Ptr = clsPtr | |
| 893 | - | cbFn := *cb | |
| 894 | - | ||
| 895 | - | cbFn(fa) | |
| 896 | - | ||
| 897 | - | } | |
| 898 | - | cbRefPtr := purego.NewCallback(fcb) | |
| 899 | - | glib.SaveCallback(cbPtr, cbRefPtr) | |
| 900 | - | return gobject.SignalConnect(x.GoPointer(), "mountpoints-changed", cbRefPtr) | |
| 901 | - | } | |
| 902 | - | ||
| 903 | - | // Emitted when the Unix mount entries have changed. | |
| 904 | - | func (x *UnixMountMonitor) ConnectMountsChanged(cb *func(UnixMountMonitor)) uint32 { | |
| 905 | - | cbPtr := uintptr(unsafe.Pointer(cb)) | |
| 906 | - | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |
| 907 | - | return gobject.SignalConnect(x.GoPointer(), "mounts-changed", cbRefPtr) | |
| 908 | - | } | |
| 909 | - | ||
| 910 | - | fcb := func(clsPtr uintptr) { | |
| 911 | - | fa := UnixMountMonitor{} | |
| 912 | - | fa.Ptr = clsPtr | |
| 913 | - | cbFn := *cb | |
| 914 | - | ||
| 915 | - | cbFn(fa) | |
| 916 | - | ||
| 917 | - | } | |
| 918 | - | cbRefPtr := purego.NewCallback(fcb) | |
| 919 | - | glib.SaveCallback(cbPtr, cbRefPtr) | |
| 920 | - | return gobject.SignalConnect(x.GoPointer(), "mounts-changed", cbRefPtr) | |
| 921 | - | } | |
| 922 | - | ||
| 923 | - | var xUnixMountMonitorGet func() uintptr | |
| 924 | - | ||
| 925 | - | // Gets the [class@GioUnix.MountMonitor] for the current thread-default main | |
| 926 | - | // context. | |
| 927 | - | // | |
| 928 | - | // The mount monitor can be used to monitor for changes to the list of | |
| 929 | - | // mounted filesystems as well as the list of mount points (ie: fstab | |
| 930 | - | // entries). | |
| 931 | - | // | |
| 932 | - | // You must only call [method@GObject.Object.unref] on the return value from | |
| 933 | - | // under the same main context as you called this function. | |
| 934 | - | func UnixMountMonitorGet() *UnixMountMonitor { | |
| 935 | - | var cls *UnixMountMonitor | |
| 936 | - | ||
| 937 | - | cret := xUnixMountMonitorGet() | |
| 938 | - | ||
| 939 | - | if cret == 0 { | |
| 940 | - | return nil | |
| 941 | - | } | |
| 942 | - | cls = &UnixMountMonitor{} | |
| 943 | - | cls.Ptr = cret | |
| 944 | - | return cls | |
| 945 | - | } | |
| 946 | - | ||
| 947 | - | func init() { | |
| 948 | - | core.SetPackageName("GIO", "gio-2.0") | |
| 949 | - | core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"}) | |
| 950 | - | var libs []uintptr | |
| 951 | - | for _, libPath := range core.GetPaths("GIO") { | |
| 952 | - | lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) | |
| 953 | - | if err != nil { | |
| 954 | - | panic(err) | |
| 955 | - | } | |
| 956 | - | libs = append(libs, lib) | |
| 957 | - | } | |
| 958 | - | ||
| 959 | - | core.PuregoSafeRegister(&xUnixIsMountPathSystemInternal, libs, "g_unix_is_mount_path_system_internal") | |
| 960 | - | core.PuregoSafeRegister(&xUnixIsSystemDevicePath, libs, "g_unix_is_system_device_path") | |
| 961 | - | core.PuregoSafeRegister(&xUnixIsSystemFsType, libs, "g_unix_is_system_fs_type") | |
| 962 | - | core.PuregoSafeRegister(&xUnixMountAt, libs, "g_unix_mount_at") | |
| 963 | - | core.PuregoSafeRegister(&xUnixMountCompare, libs, "g_unix_mount_compare") | |
| 964 | - | core.PuregoSafeRegister(&xUnixMountCopy, libs, "g_unix_mount_copy") | |
| 965 | - | core.PuregoSafeRegister(&xUnixMountEntriesChangedSince, libs, "g_unix_mount_entries_changed_since") | |
| 966 | - | core.PuregoSafeRegister(&xUnixMountEntriesGet, libs, "g_unix_mount_entries_get") | |
| 967 | - | core.PuregoSafeRegister(&xUnixMountEntriesGetFromFile, libs, "g_unix_mount_entries_get_from_file") | |
| 968 | - | core.PuregoSafeRegister(&xUnixMountEntryAt, libs, "g_unix_mount_entry_at") | |
| 969 | - | core.PuregoSafeRegister(&xUnixMountEntryFor, libs, "g_unix_mount_entry_for") | |
| 970 | - | core.PuregoSafeRegister(&xUnixMountFor, libs, "g_unix_mount_for") | |
| 971 | - | core.PuregoSafeRegister(&xUnixMountFree, libs, "g_unix_mount_free") | |
| 972 | - | core.PuregoSafeRegister(&xUnixMountGetDevicePath, libs, "g_unix_mount_get_device_path") | |
| 973 | - | core.PuregoSafeRegister(&xUnixMountGetFsType, libs, "g_unix_mount_get_fs_type") | |
| 974 | - | core.PuregoSafeRegister(&xUnixMountGetMountPath, libs, "g_unix_mount_get_mount_path") | |
| 975 | - | core.PuregoSafeRegister(&xUnixMountGetOptions, libs, "g_unix_mount_get_options") | |
| 976 | - | core.PuregoSafeRegister(&xUnixMountGetRootPath, libs, "g_unix_mount_get_root_path") | |
| 977 | - | core.PuregoSafeRegister(&xUnixMountGuessCanEject, libs, "g_unix_mount_guess_can_eject") | |
| 978 | - | core.PuregoSafeRegister(&xUnixMountGuessIcon, libs, "g_unix_mount_guess_icon") | |
| 979 | - | core.PuregoSafeRegister(&xUnixMountGuessName, libs, "g_unix_mount_guess_name") | |
| 980 | - | core.PuregoSafeRegister(&xUnixMountGuessShouldDisplay, libs, "g_unix_mount_guess_should_display") | |
| 981 | - | core.PuregoSafeRegister(&xUnixMountGuessSymbolicIcon, libs, "g_unix_mount_guess_symbolic_icon") | |
| 982 | - | core.PuregoSafeRegister(&xUnixMountIsReadonly, libs, "g_unix_mount_is_readonly") | |
| 983 | - | core.PuregoSafeRegister(&xUnixMountIsSystemInternal, libs, "g_unix_mount_is_system_internal") | |
| 984 | - | core.PuregoSafeRegister(&xUnixMountPointAt, libs, "g_unix_mount_point_at") | |
| 985 | - | core.PuregoSafeRegister(&xUnixMountPointsChangedSince, libs, "g_unix_mount_points_changed_since") | |
| 986 | - | core.PuregoSafeRegister(&xUnixMountPointsGet, libs, "g_unix_mount_points_get") | |
| 987 | - | core.PuregoSafeRegister(&xUnixMountPointsGetFromFile, libs, "g_unix_mount_points_get_from_file") | |
| 988 | - | core.PuregoSafeRegister(&xUnixMountsChangedSince, libs, "g_unix_mounts_changed_since") | |
| 989 | - | core.PuregoSafeRegister(&xUnixMountsGet, libs, "g_unix_mounts_get") | |
| 990 | - | core.PuregoSafeRegister(&xUnixMountsGetFromFile, libs, "g_unix_mounts_get_from_file") | |
| 991 | - | ||
| 992 | - | core.PuregoSafeRegister(&xUnixMountEntryGLibType, libs, "g_unix_mount_entry_get_type") | |
| 993 | - | ||
| 994 | - | core.PuregoSafeRegister(&xUnixMountEntryCompare, libs, "g_unix_mount_entry_compare") | |
| 995 | - | core.PuregoSafeRegister(&xUnixMountEntryCopy, libs, "g_unix_mount_entry_copy") | |
| 996 | - | core.PuregoSafeRegister(&xUnixMountEntryFree, libs, "g_unix_mount_entry_free") | |
| 997 | - | core.PuregoSafeRegister(&xUnixMountEntryGetDevicePath, libs, "g_unix_mount_entry_get_device_path") | |
| 998 | - | core.PuregoSafeRegister(&xUnixMountEntryGetFsType, libs, "g_unix_mount_entry_get_fs_type") | |
| 999 | - | core.PuregoSafeRegister(&xUnixMountEntryGetMountPath, libs, "g_unix_mount_entry_get_mount_path") | |
| 1000 | - | core.PuregoSafeRegister(&xUnixMountEntryGetOptions, libs, "g_unix_mount_entry_get_options") | |
| 1001 | - | core.PuregoSafeRegister(&xUnixMountEntryGetRootPath, libs, "g_unix_mount_entry_get_root_path") | |
| 1002 | - | core.PuregoSafeRegister(&xUnixMountEntryGuessCanEject, libs, "g_unix_mount_entry_guess_can_eject") | |
| 1003 | - | core.PuregoSafeRegister(&xUnixMountEntryGuessIcon, libs, "g_unix_mount_entry_guess_icon") | |
| 1004 | - | core.PuregoSafeRegister(&xUnixMountEntryGuessName, libs, "g_unix_mount_entry_guess_name") | |
| 1005 | - | core.PuregoSafeRegister(&xUnixMountEntryGuessShouldDisplay, libs, "g_unix_mount_entry_guess_should_display") | |
| 1006 | - | core.PuregoSafeRegister(&xUnixMountEntryGuessSymbolicIcon, libs, "g_unix_mount_entry_guess_symbolic_icon") | |
| 1007 | - | core.PuregoSafeRegister(&xUnixMountEntryIsReadonly, libs, "g_unix_mount_entry_is_readonly") | |
| 1008 | - | core.PuregoSafeRegister(&xUnixMountEntryIsSystemInternal, libs, "g_unix_mount_entry_is_system_internal") | |
| 1009 | - | ||
| 1010 | - | core.PuregoSafeRegister(&xUnixMountPointGLibType, libs, "g_unix_mount_point_get_type") | |
| 1011 | - | ||
| 1012 | - | core.PuregoSafeRegister(&xUnixMountPointCompare, libs, "g_unix_mount_point_compare") | |
| 1013 | - | core.PuregoSafeRegister(&xUnixMountPointCopy, libs, "g_unix_mount_point_copy") | |
| 1014 | - | core.PuregoSafeRegister(&xUnixMountPointFree, libs, "g_unix_mount_point_free") | |
| 1015 | - | core.PuregoSafeRegister(&xUnixMountPointGetDevicePath, libs, "g_unix_mount_point_get_device_path") | |
| 1016 | - | core.PuregoSafeRegister(&xUnixMountPointGetFsType, libs, "g_unix_mount_point_get_fs_type") | |
| 1017 | - | core.PuregoSafeRegister(&xUnixMountPointGetMountPath, libs, "g_unix_mount_point_get_mount_path") | |
| 1018 | - | core.PuregoSafeRegister(&xUnixMountPointGetOptions, libs, "g_unix_mount_point_get_options") | |
| 1019 | - | core.PuregoSafeRegister(&xUnixMountPointGuessCanEject, libs, "g_unix_mount_point_guess_can_eject") | |
| 1020 | - | core.PuregoSafeRegister(&xUnixMountPointGuessIcon, libs, "g_unix_mount_point_guess_icon") | |
| 1021 | - | core.PuregoSafeRegister(&xUnixMountPointGuessName, libs, "g_unix_mount_point_guess_name") | |
| 1022 | - | core.PuregoSafeRegister(&xUnixMountPointGuessSymbolicIcon, libs, "g_unix_mount_point_guess_symbolic_icon") | |
| 1023 | - | core.PuregoSafeRegister(&xUnixMountPointIsLoopback, libs, "g_unix_mount_point_is_loopback") | |
| 1024 | - | core.PuregoSafeRegister(&xUnixMountPointIsReadonly, libs, "g_unix_mount_point_is_readonly") | |
| 1025 | - | core.PuregoSafeRegister(&xUnixMountPointIsUserMountable, libs, "g_unix_mount_point_is_user_mountable") | |
| 1026 | - | ||
| 1027 | - | core.PuregoSafeRegister(&xUnixMountMonitorGLibType, libs, "g_unix_mount_monitor_get_type") | |
| 1028 | - | ||
| 1029 | - | core.PuregoSafeRegister(&xNewUnixMountMonitor, libs, "g_unix_mount_monitor_new") | |
| 1030 | - | ||
| 1031 | - | core.PuregoSafeRegister(&xUnixMountMonitorSetRateLimit, libs, "g_unix_mount_monitor_set_rate_limit") | |
| 1032 | - | ||
| 1033 | - | core.PuregoSafeRegister(&xUnixMountMonitorGet, libs, "g_unix_mount_monitor_get") | |
| 1034 | - | ||
| 1035 | - | } | |
D v4/gio/gunixoutputstream.go +0 -367
| @@ -1,367 +0,0 @@ | |||
| 1 | - | // Package gio was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT | |
| 2 | - | package gio | |
| 3 | - | ||
| 4 | - | import ( | |
| 5 | - | "structs" | |
| 6 | - | "unsafe" | |
| 7 | - | ||
| 8 | - | "github.com/jwijenbergh/purego" | |
| 9 | - | "github.com/jwijenbergh/puregotk/pkg/core" | |
| 10 | - | "github.com/jwijenbergh/puregotk/v4/glib" | |
| 11 | - | "github.com/jwijenbergh/puregotk/v4/gobject/types" | |
| 12 | - | ) | |
| 13 | - | ||
| 14 | - | type UnixOutputStreamClass struct { | |
| 15 | - | _ structs.HostLayout | |
| 16 | - | ||
| 17 | - | ParentClass OutputStreamClass | |
| 18 | - | ||
| 19 | - | xGReserved1 uintptr | |
| 20 | - | ||
| 21 | - | xGReserved2 uintptr | |
| 22 | - | ||
| 23 | - | xGReserved3 uintptr | |
| 24 | - | ||
| 25 | - | xGReserved4 uintptr | |
| 26 | - | ||
| 27 | - | xGReserved5 uintptr | |
| 28 | - | } | |
| 29 | - | ||
| 30 | - | func (x *UnixOutputStreamClass) GoPointer() uintptr { | |
| 31 | - | return uintptr(unsafe.Pointer(x)) | |
| 32 | - | } | |
| 33 | - | ||
| 34 | - | // OverrideGReserved1 sets the callback function. | |
| 35 | - | func (x *UnixOutputStreamClass) OverrideGReserved1(cb func()) { | |
| 36 | - | if cb == nil { | |
| 37 | - | x.xGReserved1 = 0 | |
| 38 | - | } else { | |
| 39 | - | x.xGReserved1 = purego.NewCallback(func() { | |
| 40 | - | cb() | |
| 41 | - | }) | |
| 42 | - | } | |
| 43 | - | } | |
| 44 | - | ||
| 45 | - | // GetGReserved1 gets the callback function. | |
| 46 | - | func (x *UnixOutputStreamClass) GetGReserved1() func() { | |
| 47 | - | if x.xGReserved1 == 0 { | |
| 48 | - | return nil | |
| 49 | - | } | |
| 50 | - | var rawCallback func() | |
| 51 | - | purego.RegisterFunc(&rawCallback, x.xGReserved1) | |
| 52 | - | return func() { | |
| 53 | - | rawCallback() | |
| 54 | - | } | |
| 55 | - | } | |
| 56 | - | ||
| 57 | - | // OverrideGReserved2 sets the callback function. | |
| 58 | - | func (x *UnixOutputStreamClass) OverrideGReserved2(cb func()) { | |
| 59 | - | if cb == nil { | |
| 60 | - | x.xGReserved2 = 0 | |
| 61 | - | } else { | |
| 62 | - | x.xGReserved2 = purego.NewCallback(func() { | |
| 63 | - | cb() | |
| 64 | - | }) | |
| 65 | - | } | |
| 66 | - | } | |
| 67 | - | ||
| 68 | - | // GetGReserved2 gets the callback function. | |
| 69 | - | func (x *UnixOutputStreamClass) GetGReserved2() func() { | |
| 70 | - | if x.xGReserved2 == 0 { | |
| 71 | - | return nil | |
| 72 | - | } | |
| 73 | - | var rawCallback func() | |
| 74 | - | purego.RegisterFunc(&rawCallback, x.xGReserved2) | |
| 75 | - | return func() { | |
| 76 | - | rawCallback() | |
| 77 | - | } | |
| 78 | - | } | |
| 79 | - | ||
| 80 | - | // OverrideGReserved3 sets the callback function. | |
| 81 | - | func (x *UnixOutputStreamClass) OverrideGReserved3(cb func()) { | |
| 82 | - | if cb == nil { | |
| 83 | - | x.xGReserved3 = 0 | |
| 84 | - | } else { | |
| 85 | - | x.xGReserved3 = purego.NewCallback(func() { | |
| 86 | - | cb() | |
| 87 | - | }) | |
| 88 | - | } | |
| 89 | - | } | |
| 90 | - | ||
| 91 | - | // GetGReserved3 gets the callback function. | |
| 92 | - | func (x *UnixOutputStreamClass) GetGReserved3() func() { | |
| 93 | - | if x.xGReserved3 == 0 { | |
| 94 | - | return nil | |
| 95 | - | } | |
| 96 | - | var rawCallback func() | |
| 97 | - | purego.RegisterFunc(&rawCallback, x.xGReserved3) | |
| 98 | - | return func() { | |
| 99 | - | rawCallback() | |
| 100 | - | } | |
| 101 | - | } | |
| 102 | - | ||
| 103 | - | // OverrideGReserved4 sets the callback function. | |
| 104 | - | func (x *UnixOutputStreamClass) OverrideGReserved4(cb func()) { | |
| 105 | - | if cb == nil { | |
| 106 | - | x.xGReserved4 = 0 | |
| 107 | - | } else { | |
| 108 | - | x.xGReserved4 = purego.NewCallback(func() { | |
| 109 | - | cb() | |
| 110 | - | }) | |
| 111 | - | } | |
| 112 | - | } | |
| 113 | - | ||
| 114 | - | // GetGReserved4 gets the callback function. | |
| 115 | - | func (x *UnixOutputStreamClass) GetGReserved4() func() { | |
| 116 | - | if x.xGReserved4 == 0 { | |
| 117 | - | return nil | |
| 118 | - | } | |
| 119 | - | var rawCallback func() | |
| 120 | - | purego.RegisterFunc(&rawCallback, x.xGReserved4) | |
| 121 | - | return func() { | |
| 122 | - | rawCallback() | |
| 123 | - | } | |
| 124 | - | } | |
| 125 | - | ||
| 126 | - | // OverrideGReserved5 sets the callback function. | |
| 127 | - | func (x *UnixOutputStreamClass) OverrideGReserved5(cb func()) { | |
| 128 | - | if cb == nil { | |
| 129 | - | x.xGReserved5 = 0 | |
| 130 | - | } else { | |
| 131 | - | x.xGReserved5 = purego.NewCallback(func() { | |
| 132 | - | cb() | |
| 133 | - | }) | |
| 134 | - | } | |
| 135 | - | } | |
| 136 | - | ||
| 137 | - | // GetGReserved5 gets the callback function. | |
| 138 | - | func (x *UnixOutputStreamClass) GetGReserved5() func() { | |
| 139 | - | if x.xGReserved5 == 0 { | |
| 140 | - | return nil | |
| 141 | - | } | |
| 142 | - | var rawCallback func() | |
| 143 | - | purego.RegisterFunc(&rawCallback, x.xGReserved5) | |
| 144 | - | return func() { | |
| 145 | - | rawCallback() | |
| 146 | - | } | |
| 147 | - | } | |
| 148 | - | ||
| 149 | - | type UnixOutputStreamPrivate struct { | |
| 150 | - | _ structs.HostLayout | |
| 151 | - | } | |
| 152 | - | ||
| 153 | - | func (x *UnixOutputStreamPrivate) GoPointer() uintptr { | |
| 154 | - | return uintptr(unsafe.Pointer(x)) | |
| 155 | - | } | |
| 156 | - | ||
| 157 | - | // `GUnixOutputStream` implements [class@Gio.OutputStream] for writing to a UNIX | |
| 158 | - | // file descriptor, including asynchronous operations. (If the file | |
| 159 | - | // descriptor refers to a socket or pipe, this will use `poll()` to do | |
| 160 | - | // asynchronous I/O. If it refers to a regular file, it will fall back | |
| 161 | - | // to doing asynchronous I/O in another thread.) | |
| 162 | - | // | |
| 163 | - | // Note that `<gio/gunixoutputstream.h>` belongs to the UNIX-specific GIO | |
| 164 | - | // interfaces, thus you have to use the `gio-unix-2.0.pc` pkg-config file | |
| 165 | - | // file or the `GioUnix-2.0` GIR namespace when using it. | |
| 166 | - | type UnixOutputStream struct { | |
| 167 | - | OutputStream | |
| 168 | - | } | |
| 169 | - | ||
| 170 | - | var xUnixOutputStreamGLibType func() types.GType | |
| 171 | - | ||
| 172 | - | func UnixOutputStreamGLibType() types.GType { | |
| 173 | - | return xUnixOutputStreamGLibType() | |
| 174 | - | } | |
| 175 | - | ||
| 176 | - | func UnixOutputStreamNewFromInternalPtr(ptr uintptr) *UnixOutputStream { | |
| 177 | - | cls := &UnixOutputStream{} | |
| 178 | - | cls.Ptr = ptr | |
| 179 | - | return cls | |
| 180 | - | } | |
| 181 | - | ||
| 182 | - | var xNewUnixOutputStream func(int, bool) uintptr | |
| 183 | - | ||
| 184 | - | // Creates a new #GUnixOutputStream for the given @fd. | |
| 185 | - | // | |
| 186 | - | // If @close_fd, is %TRUE, the file descriptor will be closed when | |
| 187 | - | // the output stream is destroyed. | |
| 188 | - | func NewUnixOutputStream(FdVar int, CloseFdVar bool) *UnixOutputStream { | |
| 189 | - | var cls *UnixOutputStream | |
| 190 | - | ||
| 191 | - | cret := xNewUnixOutputStream(FdVar, CloseFdVar) | |
| 192 | - | ||
| 193 | - | if cret == 0 { | |
| 194 | - | return nil | |
| 195 | - | } | |
| 196 | - | cls = &UnixOutputStream{} | |
| 197 | - | cls.Ptr = cret | |
| 198 | - | return cls | |
| 199 | - | } | |
| 200 | - | ||
| 201 | - | var xUnixOutputStreamGetCloseFd func(uintptr) bool | |
| 202 | - | ||
| 203 | - | // Returns whether the file descriptor of @stream will be | |
| 204 | - | // closed when the stream is closed. | |
| 205 | - | func (x *UnixOutputStream) GetCloseFd() bool { | |
| 206 | - | ||
| 207 | - | cret := xUnixOutputStreamGetCloseFd(x.GoPointer()) | |
| 208 | - | return cret | |
| 209 | - | } | |
| 210 | - | ||
| 211 | - | var xUnixOutputStreamGetFd func(uintptr) int | |
| 212 | - | ||
| 213 | - | // Return the UNIX file descriptor that the stream writes to. | |
| 214 | - | func (x *UnixOutputStream) GetFd() int { | |
| 215 | - | ||
| 216 | - | cret := xUnixOutputStreamGetFd(x.GoPointer()) | |
| 217 | - | return cret | |
| 218 | - | } | |
| 219 | - | ||
| 220 | - | var xUnixOutputStreamSetCloseFd func(uintptr, bool) | |
| 221 | - | ||
| 222 | - | // Sets whether the file descriptor of @stream shall be closed | |
| 223 | - | // when the stream is closed. | |
| 224 | - | func (x *UnixOutputStream) SetCloseFd(CloseFdVar bool) { | |
| 225 | - | ||
| 226 | - | xUnixOutputStreamSetCloseFd(x.GoPointer(), CloseFdVar) | |
| 227 | - | ||
| 228 | - | } | |
| 229 | - | ||
| 230 | - | func (c *UnixOutputStream) GoPointer() uintptr { | |
| 231 | - | if c == nil { | |
| 232 | - | return 0 | |
| 233 | - | } | |
| 234 | - | return c.Ptr | |
| 235 | - | } | |
| 236 | - | ||
| 237 | - | func (c *UnixOutputStream) SetGoPointer(ptr uintptr) { | |
| 238 | - | c.Ptr = ptr | |
| 239 | - | } | |
| 240 | - | ||
| 241 | - | // Checks if @stream is actually pollable. Some classes may implement | |
| 242 | - | // #GPollableOutputStream but have only certain instances of that | |
| 243 | - | // class be pollable. If this method returns %FALSE, then the behavior | |
| 244 | - | // of other #GPollableOutputStream methods is undefined. | |
| 245 | - | // | |
| 246 | - | // For any given stream, the value returned by this method is constant; | |
| 247 | - | // a stream cannot switch from pollable to non-pollable or vice versa. | |
| 248 | - | func (x *UnixOutputStream) CanPoll() bool { | |
| 249 | - | ||
| 250 | - | cret := XGPollableOutputStreamCanPoll(x.GoPointer()) | |
| 251 | - | return cret | |
| 252 | - | } | |
| 253 | - | ||
| 254 | - | // Creates a #GSource that triggers when @stream can be written, or | |
| 255 | - | // @cancellable is triggered or an error occurs. The callback on the | |
| 256 | - | // source is of the #GPollableSourceFunc type. | |
| 257 | - | // | |
| 258 | - | // As with g_pollable_output_stream_is_writable(), it is possible that | |
| 259 | - | // the stream may not actually be writable even after the source | |
| 260 | - | // triggers, so you should use g_pollable_output_stream_write_nonblocking() | |
| 261 | - | // rather than g_output_stream_write() from the callback. | |
| 262 | - | // | |
| 263 | - | // The behaviour of this method is undefined if | |
| 264 | - | // g_pollable_output_stream_can_poll() returns %FALSE for @stream. | |
| 265 | - | func (x *UnixOutputStream) CreateSource(CancellableVar *Cancellable) *glib.Source { | |
| 266 | - | ||
| 267 | - | cret := XGPollableOutputStreamCreateSource(x.GoPointer(), CancellableVar.GoPointer()) | |
| 268 | - | return cret | |
| 269 | - | } | |
| 270 | - | ||
| 271 | - | // Checks if @stream can be written. | |
| 272 | - | // | |
| 273 | - | // Note that some stream types may not be able to implement this 100% | |
| 274 | - | // reliably, and it is possible that a call to g_output_stream_write() | |
| 275 | - | // after this returns %TRUE would still block. To guarantee | |
| 276 | - | // non-blocking behavior, you should always use | |
| 277 | - | // g_pollable_output_stream_write_nonblocking(), which will return a | |
| 278 | - | // %G_IO_ERROR_WOULD_BLOCK error rather than blocking. | |
| 279 | - | // | |
| 280 | - | // The behaviour of this method is undefined if | |
| 281 | - | // g_pollable_output_stream_can_poll() returns %FALSE for @stream. | |
| 282 | - | func (x *UnixOutputStream) IsWritable() bool { | |
| 283 | - | ||
| 284 | - | cret := XGPollableOutputStreamIsWritable(x.GoPointer()) | |
| 285 | - | return cret | |
| 286 | - | } | |
| 287 | - | ||
| 288 | - | // Attempts to write up to @count bytes from @buffer to @stream, as | |
| 289 | - | // with g_output_stream_write(). If @stream is not currently writable, | |
| 290 | - | // this will immediately return %G_IO_ERROR_WOULD_BLOCK, and you can | |
| 291 | - | // use g_pollable_output_stream_create_source() to create a #GSource | |
| 292 | - | // that will be triggered when @stream is writable. | |
| 293 | - | // | |
| 294 | - | // Note that since this method never blocks, you cannot actually | |
| 295 | - | // use @cancellable to cancel it. However, it will return an error | |
| 296 | - | // if @cancellable has already been cancelled when you call, which | |
| 297 | - | // may happen if you call this method after a source triggers due | |
| 298 | - | // to having been cancelled. | |
| 299 | - | // | |
| 300 | - | // Also note that if %G_IO_ERROR_WOULD_BLOCK is returned some underlying | |
| 301 | - | // transports like D/TLS require that you re-send the same @buffer and | |
| 302 | - | // @count in the next write call. | |
| 303 | - | // | |
| 304 | - | // The behaviour of this method is undefined if | |
| 305 | - | // g_pollable_output_stream_can_poll() returns %FALSE for @stream. | |
| 306 | - | func (x *UnixOutputStream) WriteNonblocking(BufferVar []byte, CountVar uint, CancellableVar *Cancellable) (int, error) { | |
| 307 | - | var cerr *glib.Error | |
| 308 | - | ||
| 309 | - | cret := XGPollableOutputStreamWriteNonblocking(x.GoPointer(), BufferVar, CountVar, CancellableVar.GoPointer(), &cerr) | |
| 310 | - | if cerr == nil { | |
| 311 | - | return cret, nil | |
| 312 | - | } | |
| 313 | - | return cret, cerr | |
| 314 | - | ||
| 315 | - | } | |
| 316 | - | ||
| 317 | - | // Attempts to write the bytes contained in the @n_vectors @vectors to @stream, | |
| 318 | - | // as with g_output_stream_writev(). If @stream is not currently writable, | |
| 319 | - | // this will immediately return %@G_POLLABLE_RETURN_WOULD_BLOCK, and you can | |
| 320 | - | // use g_pollable_output_stream_create_source() to create a #GSource | |
| 321 | - | // that will be triggered when @stream is writable. @error will *not* be | |
| 322 | - | // set in that case. | |
| 323 | - | // | |
| 324 | - | // Note that since this method never blocks, you cannot actually | |
| 325 | - | // use @cancellable to cancel it. However, it will return an error | |
| 326 | - | // if @cancellable has already been cancelled when you call, which | |
| 327 | - | // may happen if you call this method after a source triggers due | |
| 328 | - | // to having been cancelled. | |
| 329 | - | // | |
| 330 | - | // Also note that if %G_POLLABLE_RETURN_WOULD_BLOCK is returned some underlying | |
| 331 | - | // transports like D/TLS require that you re-send the same @vectors and | |
| 332 | - | // @n_vectors in the next write call. | |
| 333 | - | // | |
| 334 | - | // The behaviour of this method is undefined if | |
| 335 | - | // g_pollable_output_stream_can_poll() returns %FALSE for @stream. | |
| 336 | - | func (x *UnixOutputStream) WritevNonblocking(VectorsVar []OutputVector, NVectorsVar uint, BytesWrittenVar uint, CancellableVar *Cancellable) (PollableReturn, error) { | |
| 337 | - | var cerr *glib.Error | |
| 338 | - | ||
| 339 | - | cret := XGPollableOutputStreamWritevNonblocking(x.GoPointer(), VectorsVar, NVectorsVar, BytesWrittenVar, CancellableVar.GoPointer(), &cerr) | |
| 340 | - | if cerr == nil { | |
| 341 | - | return cret, nil | |
| 342 | - | } | |
| 343 | - | return cret, cerr | |
| 344 | - | ||
| 345 | - | } | |
| 346 | - | ||
| 347 | - | func init() { | |
| 348 | - | core.SetPackageName("GIO", "gio-2.0") | |
| 349 | - | core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"}) | |
| 350 | - | var libs []uintptr | |
| 351 | - | for _, libPath := range core.GetPaths("GIO") { | |
| 352 | - | lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) | |
| 353 | - | if err != nil { | |
| 354 | - | panic(err) | |
| 355 | - | } | |
| 356 | - | libs = append(libs, lib) | |
| 357 | - | } | |
| 358 | - | ||
| 359 | - | core.PuregoSafeRegister(&xUnixOutputStreamGLibType, libs, "g_unix_output_stream_get_type") | |
| 360 | - | ||
| 361 | - | core.PuregoSafeRegister(&xNewUnixOutputStream, libs, "g_unix_output_stream_new") | |
| 362 | - | ||
| 363 | - | core.PuregoSafeRegister(&xUnixOutputStreamGetCloseFd, libs, "g_unix_output_stream_get_close_fd") | |
| 364 | - | core.PuregoSafeRegister(&xUnixOutputStreamGetFd, libs, "g_unix_output_stream_get_fd") | |
| 365 | - | core.PuregoSafeRegister(&xUnixOutputStreamSetCloseFd, libs, "g_unix_output_stream_set_close_fd") | |
| 366 | - | ||
| 367 | - | } | |
M v4/gio/gzlibcompressor.go +28 -7
| @@ -42,7 +42,7 @@ func ZlibCompressorNewFromInternalPtr(ptr uintptr) *ZlibCompressor { | |||
| 42 | 42 | ||
| 43 | 43 | var xNewZlibCompressor func(ZlibCompressorFormat, int) uintptr | |
| 44 | 44 | ||
| 45 | - | // Creates a new #GZlibCompressor. | |
| 45 | + | // Creates a compressor. | |
| 46 | 46 | func NewZlibCompressor(FormatVar ZlibCompressorFormat, LevelVar int) *ZlibCompressor { | |
| 47 | 47 | var cls *ZlibCompressor | |
| 48 | 48 | ||
| @@ -58,7 +58,7 @@ func NewZlibCompressor(FormatVar ZlibCompressorFormat, LevelVar int) *ZlibCompre | |||
| 58 | 58 | ||
| 59 | 59 | var xZlibCompressorGetFileInfo func(uintptr) uintptr | |
| 60 | 60 | ||
| 61 | - | // Returns the #GZlibCompressor:file-info property. | |
| 61 | + | // Gets the [property@Gio.ZlibCompressor:file-info] property. | |
| 62 | 62 | func (x *ZlibCompressor) GetFileInfo() *FileInfo { | |
| 63 | 63 | var cls *FileInfo | |
| 64 | 64 | ||
| @@ -73,22 +73,41 @@ func (x *ZlibCompressor) GetFileInfo() *FileInfo { | |||
| 73 | 73 | return cls | |
| 74 | 74 | } | |
| 75 | 75 | ||
| 76 | + | var xZlibCompressorGetOs func(uintptr) int | |
| 77 | + | ||
| 78 | + | // Gets the [property@Gio.ZlibCompressor:os] property. | |
| 79 | + | func (x *ZlibCompressor) GetOs() int { | |
| 80 | + | ||
| 81 | + | cret := xZlibCompressorGetOs(x.GoPointer()) | |
| 82 | + | return cret | |
| 83 | + | } | |
| 84 | + | ||
| 76 | 85 | var xZlibCompressorSetFileInfo func(uintptr, uintptr) | |
| 77 | 86 | ||
| 78 | - | // Sets @file_info in @compressor. If non-%NULL, and @compressor's | |
| 79 | - | // #GZlibCompressor:format property is %G_ZLIB_COMPRESSOR_FORMAT_GZIP, | |
| 80 | - | // it will be used to set the file name and modification time in | |
| 81 | - | // the GZIP header of the compressed data. | |
| 87 | + | // Sets the [property@Gio.ZlibCompressor:file-info] property. | |
| 82 | 88 | // | |
| 83 | 89 | // Note: it is an error to call this function while a compression is in | |
| 84 | 90 | // progress; it may only be called immediately after creation of @compressor, | |
| 85 | - | // or after resetting it with g_converter_reset(). | |
| 91 | + | // or after resetting it with [method@Gio.Converter.reset]. | |
| 86 | 92 | func (x *ZlibCompressor) SetFileInfo(FileInfoVar *FileInfo) { | |
| 87 | 93 | ||
| 88 | 94 | xZlibCompressorSetFileInfo(x.GoPointer(), FileInfoVar.GoPointer()) | |
| 89 | 95 | ||
| 90 | 96 | } | |
| 91 | 97 | ||
| 98 | + | var xZlibCompressorSetOs func(uintptr, int) | |
| 99 | + | ||
| 100 | + | // Sets the [property@Gio.ZlibCompressor:os] property. | |
| 101 | + | // | |
| 102 | + | // Note: it is an error to call this function while a compression is in | |
| 103 | + | // progress; it may only be called immediately after creation of @compressor, | |
| 104 | + | // or after resetting it with [method@Gio.Converter.reset]. | |
| 105 | + | func (x *ZlibCompressor) SetOs(OsVar int) { | |
| 106 | + | ||
| 107 | + | xZlibCompressorSetOs(x.GoPointer(), OsVar) | |
| 108 | + | ||
| 109 | + | } | |
| 110 | + | ||
| 92 | 111 | func (c *ZlibCompressor) GoPointer() uintptr { | |
| 93 | 112 | if c == nil { | |
| 94 | 113 | return 0 | |
| @@ -231,6 +250,8 @@ func init() { | |||
| 231 | 250 | core.PuregoSafeRegister(&xNewZlibCompressor, libs, "g_zlib_compressor_new") | |
| 232 | 251 | ||
| 233 | 252 | core.PuregoSafeRegister(&xZlibCompressorGetFileInfo, libs, "g_zlib_compressor_get_file_info") | |
| 253 | + | core.PuregoSafeRegister(&xZlibCompressorGetOs, libs, "g_zlib_compressor_get_os") | |
| 234 | 254 | core.PuregoSafeRegister(&xZlibCompressorSetFileInfo, libs, "g_zlib_compressor_set_file_info") | |
| 255 | + | core.PuregoSafeRegister(&xZlibCompressorSetOs, libs, "g_zlib_compressor_set_os") | |
| 235 | 256 | ||
| 236 | 257 | } | |
M v4/gio/gzlibdecompressor.go +2 -6
| @@ -42,7 +42,7 @@ func ZlibDecompressorNewFromInternalPtr(ptr uintptr) *ZlibDecompressor { | |||
| 42 | 42 | ||
| 43 | 43 | var xNewZlibDecompressor func(ZlibCompressorFormat) uintptr | |
| 44 | 44 | ||
| 45 | - | // Creates a new #GZlibDecompressor. | |
| 45 | + | // Creates a new decompressor. | |
| 46 | 46 | func NewZlibDecompressor(FormatVar ZlibCompressorFormat) *ZlibDecompressor { | |
| 47 | 47 | var cls *ZlibDecompressor | |
| 48 | 48 | ||
| @@ -58,11 +58,7 @@ func NewZlibDecompressor(FormatVar ZlibCompressorFormat) *ZlibDecompressor { | |||
| 58 | 58 | ||
| 59 | 59 | var xZlibDecompressorGetFileInfo func(uintptr) uintptr | |
| 60 | 60 | ||
| 61 | - | // Retrieves the #GFileInfo constructed from the GZIP header data | |
| 62 | - | // of compressed data processed by @compressor, or %NULL if @decompressor's | |
| 63 | - | // #GZlibDecompressor:format property is not %G_ZLIB_COMPRESSOR_FORMAT_GZIP, | |
| 64 | - | // or the header data was not fully processed yet, or it not present in the | |
| 65 | - | // data stream at all. | |
| 61 | + | // Gets the [property@Gio.ZlibDecompressor:file-info] property. | |
| 66 | 62 | func (x *ZlibDecompressor) GetFileInfo() *FileInfo { | |
| 67 | 63 | var cls *FileInfo | |
| 68 | 64 | ||
M v4/glib/garray.go +99 -92
| @@ -10,7 +10,7 @@ import ( | |||
| 10 | 10 | "github.com/jwijenbergh/puregotk/v4/gobject/types" | |
| 11 | 11 | ) | |
| 12 | 12 | ||
| 13 | - | // Contains the public fields of a GArray. | |
| 13 | + | // Contains the public fields of a `GArray`. | |
| 14 | 14 | type Array struct { | |
| 15 | 15 | _ structs.HostLayout | |
| 16 | 16 | ||
| @@ -29,7 +29,7 @@ func (x *Array) GoPointer() uintptr { | |||
| 29 | 29 | return uintptr(unsafe.Pointer(x)) | |
| 30 | 30 | } | |
| 31 | 31 | ||
| 32 | - | // Contains the public fields of a GByteArray. | |
| 32 | + | // Contains the public fields of a `GByteArray`. | |
| 33 | 33 | type ByteArray struct { | |
| 34 | 34 | _ structs.HostLayout | |
| 35 | 35 | ||
| @@ -331,7 +331,7 @@ func (x *Bytes) UnrefToData(SizeVar uint) uintptr { | |||
| 331 | 331 | return cret | |
| 332 | 332 | } | |
| 333 | 333 | ||
| 334 | - | // Contains the public fields of a pointer array. | |
| 334 | + | // Contains the public fields of a `GPtrArray`. | |
| 335 | 335 | type PtrArray struct { | |
| 336 | 336 | _ structs.HostLayout | |
| 337 | 337 | ||
| @@ -352,22 +352,23 @@ func (x *PtrArray) GoPointer() uintptr { | |||
| 352 | 352 | ||
| 353 | 353 | var xArrayNewTake func(uintptr, uint, bool, uint) uintptr | |
| 354 | 354 | ||
| 355 | - | // Creates a new #GArray with @data as array data, @len as length and a | |
| 355 | + | // Creates a new `GArray` with @data as array data, @len as length and a | |
| 356 | 356 | // reference count of 1. | |
| 357 | 357 | // | |
| 358 | 358 | // This avoids having to copy the data manually, when it can just be | |
| 359 | 359 | // inherited. | |
| 360 | - | // After this call, @data belongs to the #GArray and may no longer be | |
| 360 | + | // After this call, @data belongs to the `GArray` and may no longer be | |
| 361 | 361 | // modified by the caller. The memory of @data has to be dynamically | |
| 362 | - | // allocated and will eventually be freed with g_free(). | |
| 362 | + | // allocated and will eventually be freed with [func@GLib.free]. | |
| 363 | 363 | // | |
| 364 | 364 | // In case the elements need to be cleared when the array is freed, use | |
| 365 | - | // g_array_set_clear_func() to set a #GDestroyNotify function to perform | |
| 366 | - | // such task. | |
| 365 | + | // [func@GLib.Array.set_clear_func] to set a [callback@GLib.DestroyNotify] | |
| 366 | + | // function to perform such task. | |
| 367 | + | // | |
| 368 | + | // Do not use it if @len or @element_size are greater than | |
| 367 | 369 | // | |
| 368 | - | // Do not use it if @len or @element_size are greater than %G_MAXUINT. | |
| 369 | - | // #GArray stores the length of its data in #guint, which may be shorter | |
| 370 | - | // than #gsize. | |
| 370 | + | // [`G_MAXUINT`](types.html#guint). `GArray` stores the length of its data in | |
| 371 | + | // `guint`, which may be shorter than `gsize`. | |
| 371 | 372 | func ArrayNewTake(DataVar uintptr, LenVar uint, ClearVar bool, ElementSizeVar uint) uintptr { | |
| 372 | 373 | ||
| 373 | 374 | cret := xArrayNewTake(DataVar, LenVar, ClearVar, ElementSizeVar) | |
| @@ -376,48 +377,48 @@ func ArrayNewTake(DataVar uintptr, LenVar uint, ClearVar bool, ElementSizeVar ui | |||
| 376 | 377 | ||
| 377 | 378 | var xArrayNewTakeZeroTerminated func(uintptr, bool, uint) uintptr | |
| 378 | 379 | ||
| 379 | - | // Creates a new #GArray with @data as array data, computing the length of it | |
| 380 | + | // Creates a new `GArray` with @data as array data, computing the length of it | |
| 380 | 381 | // and setting the reference count to 1. | |
| 381 | 382 | // | |
| 382 | 383 | // This avoids having to copy the data manually, when it can just be | |
| 383 | 384 | // inherited. | |
| 384 | - | // After this call, @data belongs to the #GArray and may no longer be | |
| 385 | + | // After this call, @data belongs to the `GArray` and may no longer be | |
| 385 | 386 | // modified by the caller. The memory of @data has to be dynamically | |
| 386 | - | // allocated and will eventually be freed with g_free(). | |
| 387 | + | // allocated and will eventually be freed with [func@GLib.free]. | |
| 387 | 388 | // | |
| 388 | - | // The length is calculated by iterating through @data until the first %NULL | |
| 389 | + | // The length is calculated by iterating through @data until the first `NULL` | |
| 389 | 390 | // element is found. | |
| 390 | 391 | // | |
| 391 | 392 | // In case the elements need to be cleared when the array is freed, use | |
| 392 | - | // g_array_set_clear_func() to set a #GDestroyNotify function to perform | |
| 393 | - | // such task. | |
| 393 | + | // [func@GLib.Array.set_clear_func] to set a [callback@GLib.DestroyNotify] | |
| 394 | + | // function to perform such task. | |
| 394 | 395 | // | |
| 395 | - | // Do not use it if @data length or @element_size are greater than %G_MAXUINT. | |
| 396 | - | // #GArray stores the length of its data in #guint, which may be shorter | |
| 397 | - | // than #gsize. | |
| 396 | + | // Do not use it if @data length or @element_size are greater than | |
| 397 | + | // [`G_MAXUINT`](types.html#guint). `GArray` stores the length of its data in | |
| 398 | + | // `guint`, which may be shorter than `gsize`. | |
| 398 | 399 | func ArrayNewTakeZeroTerminated(DataVar uintptr, ClearVar bool, ElementSizeVar uint) uintptr { | |
| 399 | 400 | ||
| 400 | 401 | cret := xArrayNewTakeZeroTerminated(DataVar, ClearVar, ElementSizeVar) | |
| 401 | 402 | return cret | |
| 402 | 403 | } | |
| 403 | 404 | ||
| 404 | - | var xByteArrayAppend func([]byte, byte, uint) uintptr | |
| 405 | + | var xByteArrayAppend func([]byte, []byte, uint) uintptr | |
| 405 | 406 | ||
| 406 | - | // Adds the given bytes to the end of the #GByteArray. | |
| 407 | + | // Adds the given bytes to the end of the `GByteArray`. | |
| 407 | 408 | // The array will grow in size automatically if necessary. | |
| 408 | - | func ByteArrayAppend(ArrayVar []byte, DataVar byte, LenVar uint) uintptr { | |
| 409 | + | func ByteArrayAppend(ArrayVar []byte, DataVar []byte, LenVar uint) uintptr { | |
| 409 | 410 | ||
| 410 | 411 | cret := xByteArrayAppend(ArrayVar, DataVar, LenVar) | |
| 411 | 412 | return cret | |
| 412 | 413 | } | |
| 413 | 414 | ||
| 414 | - | var xByteArrayFree func([]byte, bool) byte | |
| 415 | + | var xByteArrayFree func([]byte, bool) uintptr | |
| 415 | 416 | ||
| 416 | - | // Frees the memory allocated by the #GByteArray. If @free_segment is | |
| 417 | - | // %TRUE it frees the actual byte data. If the reference count of | |
| 418 | - | // @array is greater than one, the #GByteArray wrapper is preserved but | |
| 417 | + | // Frees the memory allocated by the `GByteArray`. If @free_segment is | |
| 418 | + | // true it frees the actual byte data. If the reference count of | |
| 419 | + | // @array is greater than one, the `GByteArray` wrapper is preserved but | |
| 419 | 420 | // the size of @array will be set to zero. | |
| 420 | - | func ByteArrayFree(ArrayVar []byte, FreeSegmentVar bool) byte { | |
| 421 | + | func ByteArrayFree(ArrayVar []byte, FreeSegmentVar bool) uintptr { | |
| 421 | 422 | ||
| 422 | 423 | cret := xByteArrayFree(ArrayVar, FreeSegmentVar) | |
| 423 | 424 | return cret | |
| @@ -425,14 +426,15 @@ func ByteArrayFree(ArrayVar []byte, FreeSegmentVar bool) byte { | |||
| 425 | 426 | ||
| 426 | 427 | var xByteArrayFreeToBytes func([]byte) *Bytes | |
| 427 | 428 | ||
| 428 | - | // Transfers the data from the #GByteArray into a new immutable #GBytes. | |
| 429 | + | // Transfers the data from the `GByteArray` into a new immutable | |
| 430 | + | // [struct@GLib.Bytes]. | |
| 429 | 431 | // | |
| 430 | - | // The #GByteArray is freed unless the reference count of @array is greater | |
| 431 | - | // than one, the #GByteArray wrapper is preserved but the size of @array | |
| 432 | - | // will be set to zero. | |
| 432 | + | // The `GByteArray` is freed unless the reference count of @array is greater | |
| 433 | + | // than one, in which the `GByteArray` wrapper is preserved but the size of | |
| 434 | + | // @array will be set to zero. | |
| 433 | 435 | // | |
| 434 | - | // This is identical to using g_bytes_new_take() and g_byte_array_free() | |
| 435 | - | // together. | |
| 436 | + | // This is identical to using [ctor@GLib.Bytes.new_take] and | |
| 437 | + | // [func@GLib.ByteArray.free] together. | |
| 436 | 438 | func ByteArrayFreeToBytes(ArrayVar []byte) *Bytes { | |
| 437 | 439 | ||
| 438 | 440 | cret := xByteArrayFreeToBytes(ArrayVar) | |
| @@ -441,7 +443,7 @@ func ByteArrayFreeToBytes(ArrayVar []byte) *Bytes { | |||
| 441 | 443 | ||
| 442 | 444 | var xByteArrayNew func() uintptr | |
| 443 | 445 | ||
| 444 | - | // Creates a new #GByteArray with a reference count of 1. | |
| 446 | + | // Creates a new `GByteArray` with a reference count of 1. | |
| 445 | 447 | func ByteArrayNew() uintptr { | |
| 446 | 448 | ||
| 447 | 449 | cret := xByteArrayNew() | |
| @@ -451,24 +453,24 @@ func ByteArrayNew() uintptr { | |||
| 451 | 453 | var xByteArrayNewTake func([]byte, uint) uintptr | |
| 452 | 454 | ||
| 453 | 455 | // Creates a byte array containing the @data. | |
| 454 | - | // After this call, @data belongs to the #GByteArray and may no longer be | |
| 456 | + | // After this call, @data belongs to the `GByteArray` and may no longer be | |
| 455 | 457 | // modified by the caller. The memory of @data has to be dynamically | |
| 456 | - | // allocated and will eventually be freed with g_free(). | |
| 458 | + | // allocated and will eventually be freed with [func@GLib.free]. | |
| 457 | 459 | // | |
| 458 | - | // Do not use it if @len is greater than %G_MAXUINT. #GByteArray | |
| 459 | - | // stores the length of its data in #guint, which may be shorter than | |
| 460 | - | // #gsize. | |
| 460 | + | // Do not use it if @len is greater than [`G_MAXUINT`](types.html#guint). | |
| 461 | + | // `GByteArray` stores the length of its data in `guint`, which may be shorter | |
| 462 | + | // than `gsize`. | |
| 461 | 463 | func ByteArrayNewTake(DataVar []byte, LenVar uint) uintptr { | |
| 462 | 464 | ||
| 463 | 465 | cret := xByteArrayNewTake(DataVar, LenVar) | |
| 464 | 466 | return cret | |
| 465 | 467 | } | |
| 466 | 468 | ||
| 467 | - | var xByteArrayPrepend func([]byte, byte, uint) uintptr | |
| 469 | + | var xByteArrayPrepend func([]byte, []byte, uint) uintptr | |
| 468 | 470 | ||
| 469 | - | // Adds the given data to the start of the #GByteArray. | |
| 471 | + | // Adds the given data to the start of the `GByteArray`. | |
| 470 | 472 | // The array will grow in size automatically if necessary. | |
| 471 | - | func ByteArrayPrepend(ArrayVar []byte, DataVar byte, LenVar uint) uintptr { | |
| 473 | + | func ByteArrayPrepend(ArrayVar []byte, DataVar []byte, LenVar uint) uintptr { | |
| 472 | 474 | ||
| 473 | 475 | cret := xByteArrayPrepend(ArrayVar, DataVar, LenVar) | |
| 474 | 476 | return cret | |
| @@ -486,7 +488,7 @@ func ByteArrayRef(ArrayVar []byte) uintptr { | |||
| 486 | 488 | ||
| 487 | 489 | var xByteArrayRemoveIndex func([]byte, uint) uintptr | |
| 488 | 490 | ||
| 489 | - | // Removes the byte at the given index from a #GByteArray. | |
| 491 | + | // Removes the byte at the given index from a `GByteArray`. | |
| 490 | 492 | // The following bytes are moved down one place. | |
| 491 | 493 | func ByteArrayRemoveIndex(ArrayVar []byte, IndexVar uint) uintptr { | |
| 492 | 494 | ||
| @@ -496,10 +498,10 @@ func ByteArrayRemoveIndex(ArrayVar []byte, IndexVar uint) uintptr { | |||
| 496 | 498 | ||
| 497 | 499 | var xByteArrayRemoveIndexFast func([]byte, uint) uintptr | |
| 498 | 500 | ||
| 499 | - | // Removes the byte at the given index from a #GByteArray. The last | |
| 501 | + | // Removes the byte at the given index from a `GByteArray`. The last | |
| 500 | 502 | // element in the array is used to fill in the space, so this function | |
| 501 | - | // does not preserve the order of the #GByteArray. But it is faster | |
| 502 | - | // than g_byte_array_remove_index(). | |
| 503 | + | // does not preserve the order of the `GByteArray`. But it is faster | |
| 504 | + | // than [func@GLib.ByteArray.remove_index]. | |
| 503 | 505 | func ByteArrayRemoveIndexFast(ArrayVar []byte, IndexVar uint) uintptr { | |
| 504 | 506 | ||
| 505 | 507 | cret := xByteArrayRemoveIndexFast(ArrayVar, IndexVar) | |
| @@ -509,7 +511,7 @@ func ByteArrayRemoveIndexFast(ArrayVar []byte, IndexVar uint) uintptr { | |||
| 509 | 511 | var xByteArrayRemoveRange func([]byte, uint, uint) uintptr | |
| 510 | 512 | ||
| 511 | 513 | // Removes the given number of bytes starting at the given index from a | |
| 512 | - | // #GByteArray. The following elements are moved to close the gap. | |
| 514 | + | // `GByteArray`. The following elements are moved to close the gap. | |
| 513 | 515 | func ByteArrayRemoveRange(ArrayVar []byte, IndexVar uint, LengthVar uint) uintptr { | |
| 514 | 516 | ||
| 515 | 517 | cret := xByteArrayRemoveRange(ArrayVar, IndexVar, LengthVar) | |
| @@ -518,7 +520,7 @@ func ByteArrayRemoveRange(ArrayVar []byte, IndexVar uint, LengthVar uint) uintpt | |||
| 518 | 520 | ||
| 519 | 521 | var xByteArraySetSize func([]byte, uint) uintptr | |
| 520 | 522 | ||
| 521 | - | // Sets the size of the #GByteArray, expanding it if necessary. | |
| 523 | + | // Sets the size of the `GByteArray`, expanding it if necessary. | |
| 522 | 524 | func ByteArraySetSize(ArrayVar []byte, LengthVar uint) uintptr { | |
| 523 | 525 | ||
| 524 | 526 | cret := xByteArraySetSize(ArrayVar, LengthVar) | |
| @@ -527,7 +529,7 @@ func ByteArraySetSize(ArrayVar []byte, LengthVar uint) uintptr { | |||
| 527 | 529 | ||
| 528 | 530 | var xByteArraySizedNew func(uint) uintptr | |
| 529 | 531 | ||
| 530 | - | // Creates a new #GByteArray with @reserved_size bytes preallocated. | |
| 532 | + | // Creates a new `GByteArray` with @reserved_size bytes preallocated. | |
| 531 | 533 | // This avoids frequent reallocation, if you are going to add many | |
| 532 | 534 | // bytes to the array. Note however that the size of the array is still | |
| 533 | 535 | // 0. | |
| @@ -540,7 +542,7 @@ func ByteArraySizedNew(ReservedSizeVar uint) uintptr { | |||
| 540 | 542 | var xByteArraySort func([]byte, uintptr) | |
| 541 | 543 | ||
| 542 | 544 | // Sorts a byte array, using @compare_func which should be a | |
| 543 | - | // qsort()-style comparison function (returns less than zero for first | |
| 545 | + | // `qsort()`-style comparison function (returns less than zero for first | |
| 544 | 546 | // arg is less than second arg, zero for equal, greater than zero if | |
| 545 | 547 | // first arg is greater than second arg). | |
| 546 | 548 | // | |
| @@ -557,7 +559,7 @@ func ByteArraySort(ArrayVar []byte, CompareFuncVar *CompareFunc) { | |||
| 557 | 559 | ||
| 558 | 560 | var xByteArraySortWithData func([]byte, uintptr, uintptr) | |
| 559 | 561 | ||
| 560 | - | // Like g_byte_array_sort(), but the comparison function takes an extra | |
| 562 | + | // Like [func@GLib.ByteArray.sort], but the comparison function takes an extra | |
| 561 | 563 | // user data argument. | |
| 562 | 564 | func ByteArraySortWithData(ArrayVar []byte, CompareFuncVar *CompareDataFunc, UserDataVar uintptr) { | |
| 563 | 565 | ||
| @@ -565,12 +567,12 @@ func ByteArraySortWithData(ArrayVar []byte, CompareFuncVar *CompareDataFunc, Use | |||
| 565 | 567 | ||
| 566 | 568 | } | |
| 567 | 569 | ||
| 568 | - | var xByteArraySteal func([]byte, uint) byte | |
| 570 | + | var xByteArraySteal func([]byte, uint) uintptr | |
| 569 | 571 | ||
| 570 | 572 | // Frees the data in the array and resets the size to zero, while | |
| 571 | 573 | // the underlying array is preserved for use elsewhere and returned | |
| 572 | 574 | // to the caller. | |
| 573 | - | func ByteArraySteal(ArrayVar []byte, LenVar uint) byte { | |
| 575 | + | func ByteArraySteal(ArrayVar []byte, LenVar uint) uintptr { | |
| 574 | 576 | ||
| 575 | 577 | cret := xByteArraySteal(ArrayVar, LenVar) | |
| 576 | 578 | return cret | |
| @@ -590,13 +592,14 @@ func ByteArrayUnref(ArrayVar []byte) { | |||
| 590 | 592 | ||
| 591 | 593 | var xPtrArrayFind func([]uintptr, uintptr, uint) bool | |
| 592 | 594 | ||
| 593 | - | // Checks whether @needle exists in @haystack. If the element is found, %TRUE is | |
| 594 | - | // returned and the element’s index is returned in @index_ (if non-%NULL). | |
| 595 | - | // Otherwise, %FALSE is returned and @index_ is undefined. If @needle exists | |
| 595 | + | // Checks whether @needle exists in @haystack. If the element is found, true | |
| 596 | + | // is returned and the element’s index is returned in @index_ (if non-`NULL`). | |
| 597 | + | // Otherwise, false is returned and @index_ is undefined. If @needle exists | |
| 596 | 598 | // multiple times in @haystack, the index of the first instance is returned. | |
| 597 | 599 | // | |
| 598 | 600 | // This does pointer comparisons only. If you want to use more complex equality | |
| 599 | - | // checks, such as string comparisons, use g_ptr_array_find_with_equal_func(). | |
| 601 | + | // checks, such as string comparisons, use | |
| 602 | + | // [func@GLib.PtrArray.find_with_equal_func]. | |
| 600 | 603 | func PtrArrayFind(HaystackVar []uintptr, NeedleVar uintptr, IndexVar uint) bool { | |
| 601 | 604 | ||
| 602 | 605 | cret := xPtrArrayFind(HaystackVar, NeedleVar, IndexVar) | |
| @@ -606,13 +609,13 @@ func PtrArrayFind(HaystackVar []uintptr, NeedleVar uintptr, IndexVar uint) bool | |||
| 606 | 609 | var xPtrArrayFindWithEqualFunc func([]uintptr, uintptr, uintptr, uint) bool | |
| 607 | 610 | ||
| 608 | 611 | // Checks whether @needle exists in @haystack, using the given @equal_func. | |
| 609 | - | // If the element is found, %TRUE is returned and the element’s index is | |
| 610 | - | // returned in @index_ (if non-%NULL). Otherwise, %FALSE is returned and @index_ | |
| 612 | + | // If the element is found, true is returned and the element’s index is | |
| 613 | + | // returned in @index_ (if non-`NULL`). Otherwise, false is returned and @index_ | |
| 611 | 614 | // is undefined. If @needle exists multiple times in @haystack, the index of | |
| 612 | 615 | // the first instance is returned. | |
| 613 | 616 | // | |
| 614 | 617 | // @equal_func is called with the element from the array as its first parameter, | |
| 615 | - | // and @needle as its second parameter. If @equal_func is %NULL, pointer | |
| 618 | + | // and @needle as its second parameter. If @equal_func is `NULL`, pointer | |
| 616 | 619 | // equality is used. | |
| 617 | 620 | func PtrArrayFindWithEqualFunc(HaystackVar []uintptr, NeedleVar uintptr, EqualFuncVar *EqualFunc, IndexVar uint) bool { | |
| 618 | 621 | ||
| @@ -622,22 +625,23 @@ func PtrArrayFindWithEqualFunc(HaystackVar []uintptr, NeedleVar uintptr, EqualFu | |||
| 622 | 625 | ||
| 623 | 626 | var xPtrArrayNewFromArray func([]uintptr, uint, uintptr, uintptr, uintptr) uintptr | |
| 624 | 627 | ||
| 625 | - | // Creates a new #GPtrArray, copying @len pointers from @data, and setting | |
| 628 | + | // Creates a new `GPtrArray`, copying @len pointers from @data, and setting | |
| 626 | 629 | // the array’s reference count to 1. | |
| 627 | 630 | // | |
| 628 | 631 | // This avoids having to manually add each element one by one. | |
| 629 | 632 | // | |
| 630 | 633 | // If @copy_func is provided, then it is used to copy each element before | |
| 631 | - | // adding them to the new array. If it is %NULL then the pointers are copied | |
| 634 | + | // adding them to the new array. If it is `NULL` then the pointers are copied | |
| 632 | 635 | // directly. | |
| 633 | 636 | // | |
| 634 | 637 | // It also sets @element_free_func for freeing each element when the array is | |
| 635 | - | // destroyed either via g_ptr_array_unref(), when g_ptr_array_free() is called | |
| 636 | - | // with @free_segment set to %TRUE or when removing elements. | |
| 638 | + | // destroyed either via [func@GLib.PtrArray.unref], when | |
| 639 | + | // [func@GLib.PtrArray.free] is called with @free_segment set to true or when | |
| 640 | + | // removing elements. | |
| 637 | 641 | // | |
| 638 | - | // Do not use it if @len is greater than %G_MAXUINT. #GPtrArray | |
| 639 | - | // stores the length of its data in #guint, which may be shorter than | |
| 640 | - | // #gsize. | |
| 642 | + | // Do not use it if @len is greater than [`G_MAXUINT`](types.html#guint). | |
| 643 | + | // `GPtrArray` stores the length of its data in `guint`, which may be shorter | |
| 644 | + | // than `gsize`. | |
| 641 | 645 | func PtrArrayNewFromArray(DataVar []uintptr, LenVar uint, CopyFuncVar *CopyFunc, CopyFuncUserDataVar uintptr, ElementFreeFuncVar *DestroyNotify) uintptr { | |
| 642 | 646 | ||
| 643 | 647 | cret := xPtrArrayNewFromArray(DataVar, LenVar, NewCallbackNullable(CopyFuncVar), CopyFuncUserDataVar, NewCallbackNullable(ElementFreeFuncVar)) | |
| @@ -646,18 +650,19 @@ func PtrArrayNewFromArray(DataVar []uintptr, LenVar uint, CopyFuncVar *CopyFunc, | |||
| 646 | 650 | ||
| 647 | 651 | var xPtrArrayNewFromNullTerminatedArray func([]uintptr, uintptr, uintptr, uintptr) uintptr | |
| 648 | 652 | ||
| 649 | - | // Creates a new #GPtrArray copying the pointers from @data after having | |
| 653 | + | // Creates a new `GPtrArray` copying the pointers from @data after having | |
| 650 | 654 | // computed the length of it and with a reference count of 1. | |
| 651 | 655 | // This avoids having to manually add each element one by one. | |
| 652 | 656 | // If @copy_func is provided, then it is used to copy the data in the new | |
| 653 | 657 | // array. | |
| 654 | - | // It also set @element_free_func for freeing each element when the array is | |
| 655 | - | // destroyed either via g_ptr_array_unref(), when g_ptr_array_free() is called | |
| 656 | - | // with @free_segment set to %TRUE or when removing elements. | |
| 658 | + | // It also sets @element_free_func for freeing each element when the array is | |
| 659 | + | // destroyed either via [func@GLib.PtrArray.unref], when | |
| 660 | + | // [func@GLib.PtrArray.free] is called with @free_segment set to true or when | |
| 661 | + | // removing elements. | |
| 657 | 662 | // | |
| 658 | - | // Do not use it if the @data has more than %G_MAXUINT elements. #GPtrArray | |
| 659 | - | // stores the length of its data in #guint, which may be shorter than | |
| 660 | - | // #gsize. | |
| 663 | + | // Do not use it if the @data has more than [`G_MAXUINT`](types.html#guint) | |
| 664 | + | // elements. `GPtrArray` stores the length of its data in `guint`, which may be | |
| 665 | + | // shorter than `gsize`. | |
| 661 | 666 | func PtrArrayNewFromNullTerminatedArray(DataVar []uintptr, CopyFuncVar *CopyFunc, CopyFuncUserDataVar uintptr, ElementFreeFuncVar *DestroyNotify) uintptr { | |
| 662 | 667 | ||
| 663 | 668 | cret := xPtrArrayNewFromNullTerminatedArray(DataVar, NewCallbackNullable(CopyFuncVar), CopyFuncUserDataVar, NewCallbackNullable(ElementFreeFuncVar)) | |
| @@ -666,21 +671,22 @@ func PtrArrayNewFromNullTerminatedArray(DataVar []uintptr, CopyFuncVar *CopyFunc | |||
| 666 | 671 | ||
| 667 | 672 | var xPtrArrayNewTake func([]uintptr, uint, uintptr) uintptr | |
| 668 | 673 | ||
| 669 | - | // Creates a new #GPtrArray with @data as pointers, @len as length and a | |
| 674 | + | // Creates a new `GPtrArray` with @data as pointers, @len as length and a | |
| 670 | 675 | // reference count of 1. | |
| 671 | 676 | // | |
| 672 | 677 | // This avoids having to copy such data manually. | |
| 673 | - | // After this call, @data belongs to the #GPtrArray and may no longer be | |
| 678 | + | // After this call, @data belongs to the `GPtrArray` and may no longer be | |
| 674 | 679 | // modified by the caller. The memory of @data has to be dynamically | |
| 675 | - | // allocated and will eventually be freed with g_free(). | |
| 680 | + | // allocated and will eventually be freed with [func@GLib.free]. | |
| 676 | 681 | // | |
| 677 | 682 | // It also sets @element_free_func for freeing each element when the array is | |
| 678 | - | // destroyed either via g_ptr_array_unref(), when g_ptr_array_free() is called | |
| 679 | - | // with @free_segment set to %TRUE or when removing elements. | |
| 683 | + | // destroyed either via [func@GLib.PtrArray.unref], when | |
| 684 | + | // [func@GLib.PtrArray.free] is called with @free_segment set to true or when | |
| 685 | + | // removing elements. | |
| 680 | 686 | // | |
| 681 | - | // Do not use it if @len is greater than %G_MAXUINT. #GPtrArray | |
| 682 | - | // stores the length of its data in #guint, which may be shorter than | |
| 683 | - | // #gsize. | |
| 687 | + | // Do not use it if @len is greater than [`G_MAXUINT`](types.html#guint). | |
| 688 | + | // `GPtrArray` stores the length of its data in `guint`, which may be shorter | |
| 689 | + | // than `gsize`. | |
| 684 | 690 | func PtrArrayNewTake(DataVar []uintptr, LenVar uint, ElementFreeFuncVar *DestroyNotify) uintptr { | |
| 685 | 691 | ||
| 686 | 692 | cret := xPtrArrayNewTake(DataVar, LenVar, NewCallbackNullable(ElementFreeFuncVar)) | |
| @@ -689,24 +695,25 @@ func PtrArrayNewTake(DataVar []uintptr, LenVar uint, ElementFreeFuncVar *Destroy | |||
| 689 | 695 | ||
| 690 | 696 | var xPtrArrayNewTakeNullTerminated func([]uintptr, uintptr) uintptr | |
| 691 | 697 | ||
| 692 | - | // Creates a new #GPtrArray with @data as pointers, computing the length of it | |
| 698 | + | // Creates a new `GPtrArray` with @data as pointers, computing the length of it | |
| 693 | 699 | // and setting the reference count to 1. | |
| 694 | 700 | // | |
| 695 | 701 | // This avoids having to copy such data manually. | |
| 696 | - | // After this call, @data belongs to the #GPtrArray and may no longer be | |
| 702 | + | // After this call, @data belongs to the `GPtrArray` and may no longer be | |
| 697 | 703 | // modified by the caller. The memory of @data has to be dynamically | |
| 698 | - | // allocated and will eventually be freed with g_free(). | |
| 704 | + | // allocated and will eventually be freed with [func@GLib.free]. | |
| 699 | 705 | // | |
| 700 | - | // The length is calculated by iterating through @data until the first %NULL | |
| 706 | + | // The length is calculated by iterating through @data until the first `NULL` | |
| 701 | 707 | // element is found. | |
| 702 | 708 | // | |
| 703 | 709 | // It also sets @element_free_func for freeing each element when the array is | |
| 704 | - | // destroyed either via g_ptr_array_unref(), when g_ptr_array_free() is called | |
| 705 | - | // with @free_segment set to %TRUE or when removing elements. | |
| 710 | + | // destroyed either via [func@GLib.PtrArray.unref], when | |
| 711 | + | // [func@GLib.PtrArray.free] is called with @free_segment set to true or when | |
| 712 | + | // removing elements. | |
| 706 | 713 | // | |
| 707 | - | // Do not use it if the @data length is greater than %G_MAXUINT. #GPtrArray | |
| 708 | - | // stores the length of its data in #guint, which may be shorter than | |
| 709 | - | // #gsize. | |
| 714 | + | // Do not use it if the @data length is greater than | |
| 715 | + | // [`G_MAXUINT`](types.html#guint). `GPtrArray` stores the length of its data | |
| 716 | + | // in `guint`, which may be shorter than `gsize`. | |
| 710 | 717 | func PtrArrayNewTakeNullTerminated(DataVar []uintptr, ElementFreeFuncVar *DestroyNotify) uintptr { | |
| 711 | 718 | ||
| 712 | 719 | cret := xPtrArrayNewTakeNullTerminated(DataVar, NewCallbackNullable(ElementFreeFuncVar)) | |
M v4/glib/gatomic.go +24 -24
| @@ -6,7 +6,7 @@ import ( | |||
| 6 | 6 | "github.com/jwijenbergh/puregotk/pkg/core" | |
| 7 | 7 | ) | |
| 8 | 8 | ||
| 9 | - | var xAtomicIntAdd func(int, int) int | |
| 9 | + | var xAtomicIntAdd func(uintptr, int) int | |
| 10 | 10 | ||
| 11 | 11 | // Atomically adds @val to the value of @atomic. | |
| 12 | 12 | // | |
| @@ -20,13 +20,13 @@ var xAtomicIntAdd func(int, int) int | |||
| 20 | 20 | // | |
| 21 | 21 | // While @atomic has a `volatile` qualifier, this is a historical artifact and | |
| 22 | 22 | // the pointer passed to it should not be `volatile`. | |
| 23 | - | func AtomicIntAdd(AtomicVar int, ValVar int) int { | |
| 23 | + | func AtomicIntAdd(AtomicVar uintptr, ValVar int) int { | |
| 24 | 24 | ||
| 25 | 25 | cret := xAtomicIntAdd(AtomicVar, ValVar) | |
| 26 | 26 | return cret | |
| 27 | 27 | } | |
| 28 | 28 | ||
| 29 | - | var xAtomicIntAnd func(uint, uint) uint | |
| 29 | + | var xAtomicIntAnd func(uintptr, uint) uint | |
| 30 | 30 | ||
| 31 | 31 | // Performs an atomic bitwise 'and' of the value of @atomic and @val, | |
| 32 | 32 | // storing the result back in @atomic. | |
| @@ -38,13 +38,13 @@ var xAtomicIntAnd func(uint, uint) uint | |||
| 38 | 38 | // | |
| 39 | 39 | // While @atomic has a `volatile` qualifier, this is a historical artifact and | |
| 40 | 40 | // the pointer passed to it should not be `volatile`. | |
| 41 | - | func AtomicIntAnd(AtomicVar uint, ValVar uint) uint { | |
| 41 | + | func AtomicIntAnd(AtomicVar uintptr, ValVar uint) uint { | |
| 42 | 42 | ||
| 43 | 43 | cret := xAtomicIntAnd(AtomicVar, ValVar) | |
| 44 | 44 | return cret | |
| 45 | 45 | } | |
| 46 | 46 | ||
| 47 | - | var xAtomicIntCompareAndExchange func(int, int, int) bool | |
| 47 | + | var xAtomicIntCompareAndExchange func(uintptr, int, int) bool | |
| 48 | 48 | ||
| 49 | 49 | // Compares @atomic to @oldval and, if equal, sets it to @newval. | |
| 50 | 50 | // If @atomic was not equal to @oldval then no change occurs. | |
| @@ -58,13 +58,13 @@ var xAtomicIntCompareAndExchange func(int, int, int) bool | |||
| 58 | 58 | // | |
| 59 | 59 | // While @atomic has a `volatile` qualifier, this is a historical artifact and | |
| 60 | 60 | // the pointer passed to it should not be `volatile`. | |
| 61 | - | func AtomicIntCompareAndExchange(AtomicVar int, OldvalVar int, NewvalVar int) bool { | |
| 61 | + | func AtomicIntCompareAndExchange(AtomicVar uintptr, OldvalVar int, NewvalVar int) bool { | |
| 62 | 62 | ||
| 63 | 63 | cret := xAtomicIntCompareAndExchange(AtomicVar, OldvalVar, NewvalVar) | |
| 64 | 64 | return cret | |
| 65 | 65 | } | |
| 66 | 66 | ||
| 67 | - | var xAtomicIntCompareAndExchangeFull func(int, int, int, int) bool | |
| 67 | + | var xAtomicIntCompareAndExchangeFull func(uintptr, int, int, int) bool | |
| 68 | 68 | ||
| 69 | 69 | // Compares @atomic to @oldval and, if equal, sets it to @newval. | |
| 70 | 70 | // If @atomic was not equal to @oldval then no change occurs. | |
| @@ -78,13 +78,13 @@ var xAtomicIntCompareAndExchangeFull func(int, int, int, int) bool | |||
| 78 | 78 | // This call acts as a full compiler and hardware memory barrier. | |
| 79 | 79 | // | |
| 80 | 80 | // See also g_atomic_int_compare_and_exchange() | |
| 81 | - | func AtomicIntCompareAndExchangeFull(AtomicVar int, OldvalVar int, NewvalVar int, PrevalVar int) bool { | |
| 81 | + | func AtomicIntCompareAndExchangeFull(AtomicVar uintptr, OldvalVar int, NewvalVar int, PrevalVar int) bool { | |
| 82 | 82 | ||
| 83 | 83 | cret := xAtomicIntCompareAndExchangeFull(AtomicVar, OldvalVar, NewvalVar, PrevalVar) | |
| 84 | 84 | return cret | |
| 85 | 85 | } | |
| 86 | 86 | ||
| 87 | - | var xAtomicIntDecAndTest func(int) bool | |
| 87 | + | var xAtomicIntDecAndTest func(uintptr) bool | |
| 88 | 88 | ||
| 89 | 89 | // Decrements the value of @atomic by 1. | |
| 90 | 90 | // | |
| @@ -95,13 +95,13 @@ var xAtomicIntDecAndTest func(int) bool | |||
| 95 | 95 | // | |
| 96 | 96 | // While @atomic has a `volatile` qualifier, this is a historical artifact and | |
| 97 | 97 | // the pointer passed to it should not be `volatile`. | |
| 98 | - | func AtomicIntDecAndTest(AtomicVar int) bool { | |
| 98 | + | func AtomicIntDecAndTest(AtomicVar uintptr) bool { | |
| 99 | 99 | ||
| 100 | 100 | cret := xAtomicIntDecAndTest(AtomicVar) | |
| 101 | 101 | return cret | |
| 102 | 102 | } | |
| 103 | 103 | ||
| 104 | - | var xAtomicIntExchange func(int, int) int | |
| 104 | + | var xAtomicIntExchange func(uintptr, int) int | |
| 105 | 105 | ||
| 106 | 106 | // Sets the @atomic to @newval and returns the old value from @atomic. | |
| 107 | 107 | // | |
| @@ -111,24 +111,24 @@ var xAtomicIntExchange func(int, int) int | |||
| 111 | 111 | // `{ tmp = *atomic; *atomic = val; return tmp; }`. | |
| 112 | 112 | // | |
| 113 | 113 | // This call acts as a full compiler and hardware memory barrier. | |
| 114 | - | func AtomicIntExchange(AtomicVar int, NewvalVar int) int { | |
| 114 | + | func AtomicIntExchange(AtomicVar uintptr, NewvalVar int) int { | |
| 115 | 115 | ||
| 116 | 116 | cret := xAtomicIntExchange(AtomicVar, NewvalVar) | |
| 117 | 117 | return cret | |
| 118 | 118 | } | |
| 119 | 119 | ||
| 120 | - | var xAtomicIntExchangeAndAdd func(int, int) int | |
| 120 | + | var xAtomicIntExchangeAndAdd func(uintptr, int) int | |
| 121 | 121 | ||
| 122 | 122 | // This function existed before g_atomic_int_add() returned the prior | |
| 123 | 123 | // value of the integer (which it now does). It is retained only for | |
| 124 | 124 | // compatibility reasons. Don't use this function in new code. | |
| 125 | - | func AtomicIntExchangeAndAdd(AtomicVar int, ValVar int) int { | |
| 125 | + | func AtomicIntExchangeAndAdd(AtomicVar uintptr, ValVar int) int { | |
| 126 | 126 | ||
| 127 | 127 | cret := xAtomicIntExchangeAndAdd(AtomicVar, ValVar) | |
| 128 | 128 | return cret | |
| 129 | 129 | } | |
| 130 | 130 | ||
| 131 | - | var xAtomicIntGet func(int) int | |
| 131 | + | var xAtomicIntGet func(uintptr) int | |
| 132 | 132 | ||
| 133 | 133 | // Gets the current value of @atomic. | |
| 134 | 134 | // | |
| @@ -137,13 +137,13 @@ var xAtomicIntGet func(int) int | |||
| 137 | 137 | // | |
| 138 | 138 | // While @atomic has a `volatile` qualifier, this is a historical artifact and | |
| 139 | 139 | // the pointer passed to it should not be `volatile`. | |
| 140 | - | func AtomicIntGet(AtomicVar int) int { | |
| 140 | + | func AtomicIntGet(AtomicVar uintptr) int { | |
| 141 | 141 | ||
| 142 | 142 | cret := xAtomicIntGet(AtomicVar) | |
| 143 | 143 | return cret | |
| 144 | 144 | } | |
| 145 | 145 | ||
| 146 | - | var xAtomicIntInc func(int) | |
| 146 | + | var xAtomicIntInc func(uintptr) | |
| 147 | 147 | ||
| 148 | 148 | // Increments the value of @atomic by 1. | |
| 149 | 149 | // | |
| @@ -153,13 +153,13 @@ var xAtomicIntInc func(int) | |||
| 153 | 153 | // | |
| 154 | 154 | // While @atomic has a `volatile` qualifier, this is a historical artifact and | |
| 155 | 155 | // the pointer passed to it should not be `volatile`. | |
| 156 | - | func AtomicIntInc(AtomicVar int) { | |
| 156 | + | func AtomicIntInc(AtomicVar uintptr) { | |
| 157 | 157 | ||
| 158 | 158 | xAtomicIntInc(AtomicVar) | |
| 159 | 159 | ||
| 160 | 160 | } | |
| 161 | 161 | ||
| 162 | - | var xAtomicIntOr func(uint, uint) uint | |
| 162 | + | var xAtomicIntOr func(uintptr, uint) uint | |
| 163 | 163 | ||
| 164 | 164 | // Performs an atomic bitwise 'or' of the value of @atomic and @val, | |
| 165 | 165 | // storing the result back in @atomic. | |
| @@ -171,13 +171,13 @@ var xAtomicIntOr func(uint, uint) uint | |||
| 171 | 171 | // | |
| 172 | 172 | // While @atomic has a `volatile` qualifier, this is a historical artifact and | |
| 173 | 173 | // the pointer passed to it should not be `volatile`. | |
| 174 | - | func AtomicIntOr(AtomicVar uint, ValVar uint) uint { | |
| 174 | + | func AtomicIntOr(AtomicVar uintptr, ValVar uint) uint { | |
| 175 | 175 | ||
| 176 | 176 | cret := xAtomicIntOr(AtomicVar, ValVar) | |
| 177 | 177 | return cret | |
| 178 | 178 | } | |
| 179 | 179 | ||
| 180 | - | var xAtomicIntSet func(int, int) | |
| 180 | + | var xAtomicIntSet func(uintptr, int) | |
| 181 | 181 | ||
| 182 | 182 | // Sets the value of @atomic to @newval. | |
| 183 | 183 | // | |
| @@ -186,13 +186,13 @@ var xAtomicIntSet func(int, int) | |||
| 186 | 186 | // | |
| 187 | 187 | // While @atomic has a `volatile` qualifier, this is a historical artifact and | |
| 188 | 188 | // the pointer passed to it should not be `volatile`. | |
| 189 | - | func AtomicIntSet(AtomicVar int, NewvalVar int) { | |
| 189 | + | func AtomicIntSet(AtomicVar uintptr, NewvalVar int) { | |
| 190 | 190 | ||
| 191 | 191 | xAtomicIntSet(AtomicVar, NewvalVar) | |
| 192 | 192 | ||
| 193 | 193 | } | |
| 194 | 194 | ||
| 195 | - | var xAtomicIntXor func(uint, uint) uint | |
| 195 | + | var xAtomicIntXor func(uintptr, uint) uint | |
| 196 | 196 | ||
| 197 | 197 | // Performs an atomic bitwise 'xor' of the value of @atomic and @val, | |
| 198 | 198 | // storing the result back in @atomic. | |
| @@ -204,7 +204,7 @@ var xAtomicIntXor func(uint, uint) uint | |||
| 204 | 204 | // | |
| 205 | 205 | // While @atomic has a `volatile` qualifier, this is a historical artifact and | |
| 206 | 206 | // the pointer passed to it should not be `volatile`. | |
| 207 | - | func AtomicIntXor(AtomicVar uint, ValVar uint) uint { | |
| 207 | + | func AtomicIntXor(AtomicVar uintptr, ValVar uint) uint { | |
| 208 | 208 | ||
| 209 | 209 | cret := xAtomicIntXor(AtomicVar, ValVar) | |
| 210 | 210 | return cret | |
M v4/glib/gbacktrace.go +2 -2
| @@ -56,7 +56,7 @@ var xOnErrorQuery func(string) | |||
| 56 | 56 | // This function may cause different actions on non-UNIX platforms. | |
| 57 | 57 | // | |
| 58 | 58 | // On Windows consider using the `G_DEBUGGER` environment | |
| 59 | - | // variable (see [Running GLib Applications](glib-running.html)) and | |
| 59 | + | // variable (see [Running GLib Applications](running.html)) and | |
| 60 | 60 | // calling g_on_error_stack_trace() instead. | |
| 61 | 61 | func OnErrorQuery(PrgNameVar string) { | |
| 62 | 62 | ||
| @@ -78,7 +78,7 @@ var xOnErrorStackTrace func(string) | |||
| 78 | 78 | // g_on_error_query(). If called directly, it will raise an | |
| 79 | 79 | // exception, which will crash the program. If the `G_DEBUGGER` environment | |
| 80 | 80 | // variable is set, a debugger will be invoked to attach and | |
| 81 | - | // handle that exception (see [Running GLib Applications](glib-running.html)). | |
| 81 | + | // handle that exception (see [Running GLib Applications](running.html)). | |
| 82 | 82 | func OnErrorStackTrace(PrgNameVar string) { | |
| 83 | 83 | ||
| 84 | 84 | xOnErrorStackTrace(PrgNameVar) | |
M v4/glib/gbitlock.go +37 -6
| @@ -6,7 +6,7 @@ import ( | |||
| 6 | 6 | "github.com/jwijenbergh/puregotk/pkg/core" | |
| 7 | 7 | ) | |
| 8 | 8 | ||
| 9 | - | var xBitLock func(int, int) | |
| 9 | + | var xBitLock func(uintptr, int) | |
| 10 | 10 | ||
| 11 | 11 | // Sets the indicated @lock_bit in @address. If the bit is already | |
| 12 | 12 | // set, this call will block until g_bit_unlock() unsets the | |
| @@ -22,13 +22,26 @@ var xBitLock func(int, int) | |||
| 22 | 22 | // @address must be atomic in order for this function to work | |
| 23 | 23 | // reliably. While @address has a `volatile` qualifier, this is a historical | |
| 24 | 24 | // artifact and the argument passed to it should not be `volatile`. | |
| 25 | - | func BitLock(AddressVar int, LockBitVar int) { | |
| 25 | + | func BitLock(AddressVar uintptr, LockBitVar int) { | |
| 26 | 26 | ||
| 27 | 27 | xBitLock(AddressVar, LockBitVar) | |
| 28 | 28 | ||
| 29 | 29 | } | |
| 30 | 30 | ||
| 31 | - | var xBitTrylock func(int, int) bool | |
| 31 | + | var xBitLockAndGet func(uintptr, uint, int) | |
| 32 | + | ||
| 33 | + | // Sets the indicated @lock_bit in @address and atomically returns the new value. | |
| 34 | + | // | |
| 35 | + | // This is like [func@GLib.bit_lock], except it can atomically return the new value at | |
| 36 | + | // @address (right after obtaining the lock). Thus the value returned in @out_val | |
| 37 | + | // always has the @lock_bit set. | |
| 38 | + | func BitLockAndGet(AddressVar uintptr, LockBitVar uint, OutValVar int) { | |
| 39 | + | ||
| 40 | + | xBitLockAndGet(AddressVar, LockBitVar, OutValVar) | |
| 41 | + | ||
| 42 | + | } | |
| 43 | + | ||
| 44 | + | var xBitTrylock func(uintptr, int) bool | |
| 32 | 45 | ||
| 33 | 46 | // Sets the indicated @lock_bit in @address, returning %TRUE if | |
| 34 | 47 | // successful. If the bit is already set, returns %FALSE immediately. | |
| @@ -43,13 +56,13 @@ var xBitTrylock func(int, int) bool | |||
| 43 | 56 | // @address must be atomic in order for this function to work | |
| 44 | 57 | // reliably. While @address has a `volatile` qualifier, this is a historical | |
| 45 | 58 | // artifact and the argument passed to it should not be `volatile`. | |
| 46 | - | func BitTrylock(AddressVar int, LockBitVar int) bool { | |
| 59 | + | func BitTrylock(AddressVar uintptr, LockBitVar int) bool { | |
| 47 | 60 | ||
| 48 | 61 | cret := xBitTrylock(AddressVar, LockBitVar) | |
| 49 | 62 | return cret | |
| 50 | 63 | } | |
| 51 | 64 | ||
| 52 | - | var xBitUnlock func(int, int) | |
| 65 | + | var xBitUnlock func(uintptr, int) | |
| 53 | 66 | ||
| 54 | 67 | // Clears the indicated @lock_bit in @address. If another thread is | |
| 55 | 68 | // currently blocked in g_bit_lock() on this same bit then it will be | |
| @@ -59,12 +72,28 @@ var xBitUnlock func(int, int) | |||
| 59 | 72 | // @address must be atomic in order for this function to work | |
| 60 | 73 | // reliably. While @address has a `volatile` qualifier, this is a historical | |
| 61 | 74 | // artifact and the argument passed to it should not be `volatile`. | |
| 62 | - | func BitUnlock(AddressVar int, LockBitVar int) { | |
| 75 | + | func BitUnlock(AddressVar uintptr, LockBitVar int) { | |
| 63 | 76 | ||
| 64 | 77 | xBitUnlock(AddressVar, LockBitVar) | |
| 65 | 78 | ||
| 66 | 79 | } | |
| 67 | 80 | ||
| 81 | + | var xBitUnlockAndSet func(uintptr, uint, int, int) | |
| 82 | + | ||
| 83 | + | // This is like [func@GLib.bit_unlock] but also atomically sets @address to | |
| 84 | + | // @val. | |
| 85 | + | // | |
| 86 | + | // If @preserve_mask is not zero, then the @preserve_mask bits will be | |
| 87 | + | // preserved in @address and are not set to @val. | |
| 88 | + | // | |
| 89 | + | // Note that the @lock_bit bit will always be unset regardless of | |
| 90 | + | // @val, @preserve_mask and the currently set value in @address. | |
| 91 | + | func BitUnlockAndSet(AddressVar uintptr, LockBitVar uint, NewValVar int, PreserveMaskVar int) { | |
| 92 | + | ||
| 93 | + | xBitUnlockAndSet(AddressVar, LockBitVar, NewValVar, PreserveMaskVar) | |
| 94 | + | ||
| 95 | + | } | |
| 96 | + | ||
| 68 | 97 | var xPointerBitLock func(uintptr, int) | |
| 69 | 98 | ||
| 70 | 99 | // This is equivalent to g_bit_lock, but working on pointers (or other | |
| @@ -164,8 +193,10 @@ func init() { | |||
| 164 | 193 | } | |
| 165 | 194 | ||
| 166 | 195 | core.PuregoSafeRegister(&xBitLock, libs, "g_bit_lock") | |
| 196 | + | core.PuregoSafeRegister(&xBitLockAndGet, libs, "g_bit_lock_and_get") | |
| 167 | 197 | core.PuregoSafeRegister(&xBitTrylock, libs, "g_bit_trylock") | |
| 168 | 198 | core.PuregoSafeRegister(&xBitUnlock, libs, "g_bit_unlock") | |
| 199 | + | core.PuregoSafeRegister(&xBitUnlockAndSet, libs, "g_bit_unlock_and_set") | |
| 169 | 200 | core.PuregoSafeRegister(&xPointerBitLock, libs, "g_pointer_bit_lock") | |
| 170 | 201 | core.PuregoSafeRegister(&xPointerBitLockAndGet, libs, "g_pointer_bit_lock_and_get") | |
| 171 | 202 | core.PuregoSafeRegister(&xPointerBitLockMaskPtr, libs, "g_pointer_bit_lock_mask_ptr") | |
M v4/glib/gdate.go +35 -0
| @@ -287,6 +287,22 @@ func (x *Date) GetSundayWeekOfYear() uint { | |||
| 287 | 287 | return cret | |
| 288 | 288 | } | |
| 289 | 289 | ||
| 290 | + | var xDateGetWeekOfYear func(uintptr, DateWeekday) uint | |
| 291 | + | ||
| 292 | + | // Calculates the week of the year during which this date falls. | |
| 293 | + | // | |
| 294 | + | // The result depends on which day is considered the first day of the week, | |
| 295 | + | // which varies by locale. Both `date` and `first_day_of_week` must be valid. | |
| 296 | + | // | |
| 297 | + | // If @date is before the start of the first week of the year (for example, | |
| 298 | + | // before the first Monday in January if @first_day_of_week is | |
| 299 | + | // [enum@GLib.DateWeekday.MONDAY]) then zero will be returned. | |
| 300 | + | func (x *Date) GetWeekOfYear(FirstDayOfWeekVar DateWeekday) uint { | |
| 301 | + | ||
| 302 | + | cret := xDateGetWeekOfYear(x.GoPointer(), FirstDayOfWeekVar) | |
| 303 | + | return cret | |
| 304 | + | } | |
| 305 | + | ||
| 290 | 306 | var xDateGetWeekday func(uintptr) DateWeekday | |
| 291 | 307 | ||
| 292 | 308 | // Returns the day of the week for a #GDate. The date must be valid. | |
| @@ -664,6 +680,23 @@ func DateGetSundayWeeksInYear(YearVar DateYear) byte { | |||
| 664 | 680 | return cret | |
| 665 | 681 | } | |
| 666 | 682 | ||
| 683 | + | var xDateGetWeeksInYear func(DateYear, DateWeekday) byte | |
| 684 | + | ||
| 685 | + | // Calculates the number of weeks in the year. | |
| 686 | + | // | |
| 687 | + | // The result depends on which day is considered the first day of the week, | |
| 688 | + | // which varies by locale. `first_day_of_week` must be valid. | |
| 689 | + | // | |
| 690 | + | // The result will be either 52 or 53. Years always have 52 seven-day periods, | |
| 691 | + | // plus one or two extra days depending on whether it’s a leap year. This | |
| 692 | + | // function effectively calculates how many @first_day_of_week days there are in | |
| 693 | + | // the year. | |
| 694 | + | func DateGetWeeksInYear(YearVar DateYear, FirstDayOfWeekVar DateWeekday) byte { | |
| 695 | + | ||
| 696 | + | cret := xDateGetWeeksInYear(YearVar, FirstDayOfWeekVar) | |
| 697 | + | return cret | |
| 698 | + | } | |
| 699 | + | ||
| 667 | 700 | var xDateIsLeapYear func(DateYear) bool | |
| 668 | 701 | ||
| 669 | 702 | // Returns %TRUE if the year is a leap year. | |
| @@ -775,6 +808,7 @@ func init() { | |||
| 775 | 808 | core.PuregoSafeRegister(&xDateGetDaysInMonth, libs, "g_date_get_days_in_month") | |
| 776 | 809 | core.PuregoSafeRegister(&xDateGetMondayWeeksInYear, libs, "g_date_get_monday_weeks_in_year") | |
| 777 | 810 | core.PuregoSafeRegister(&xDateGetSundayWeeksInYear, libs, "g_date_get_sunday_weeks_in_year") | |
| 811 | + | core.PuregoSafeRegister(&xDateGetWeeksInYear, libs, "g_date_get_weeks_in_year") | |
| 778 | 812 | core.PuregoSafeRegister(&xDateIsLeapYear, libs, "g_date_is_leap_year") | |
| 779 | 813 | core.PuregoSafeRegister(&xDateStrftime, libs, "g_date_strftime") | |
| 780 | 814 | core.PuregoSafeRegister(&xDateValidDay, libs, "g_date_valid_day") | |
| @@ -806,6 +840,7 @@ func init() { | |||
| 806 | 840 | core.PuregoSafeRegister(&xDateGetMondayWeekOfYear, libs, "g_date_get_monday_week_of_year") | |
| 807 | 841 | core.PuregoSafeRegister(&xDateGetMonth, libs, "g_date_get_month") | |
| 808 | 842 | core.PuregoSafeRegister(&xDateGetSundayWeekOfYear, libs, "g_date_get_sunday_week_of_year") | |
| 843 | + | core.PuregoSafeRegister(&xDateGetWeekOfYear, libs, "g_date_get_week_of_year") | |
| 809 | 844 | core.PuregoSafeRegister(&xDateGetWeekday, libs, "g_date_get_weekday") | |
| 810 | 845 | core.PuregoSafeRegister(&xDateGetYear, libs, "g_date_get_year") | |
| 811 | 846 | core.PuregoSafeRegister(&xDateIsFirstOfMonth, libs, "g_date_is_first_of_month") | |
M v4/glib/gfileutils.go +2 -2
| @@ -507,8 +507,8 @@ var xFileSetContentsFull func(string, []byte, int, FileSetContentsFlags, int, ** | |||
| 507 | 507 | // to 7 characters to @filename. | |
| 508 | 508 | // | |
| 509 | 509 | // If the file didn’t exist before and is created, it will be given the | |
| 510 | - | // permissions from @mode. Otherwise, the permissions of the existing file may | |
| 511 | - | // be changed to @mode depending on @flags, or they may remain unchanged. | |
| 510 | + | // permissions from @mode. Otherwise, the permissions of the existing file will | |
| 511 | + | // remain unchanged. | |
| 512 | 512 | func FileSetContentsFull(FilenameVar string, ContentsVar []byte, LengthVar int, FlagsVar FileSetContentsFlags, ModeVar int) (bool, error) { | |
| 513 | 513 | var cerr *Error | |
| 514 | 514 | ||
M v4/glib/gkeyfile.go +5 -0
| @@ -786,6 +786,11 @@ var xKeyFileSetComment func(uintptr, string, string, string, **Error) bool | |||
| 786 | 786 | // If both @key and @group_name are `NULL`, then @comment will be | |
| 787 | 787 | // written above the first group in the file. | |
| 788 | 788 | // | |
| 789 | + | // Passing a non-existent @group_name or @key to this function returns | |
| 790 | + | // false and populates @error. (In contrast, passing a non-existent | |
| 791 | + | // `group_name` or `key` to [method@GLib.KeyFile.set_string] | |
| 792 | + | // creates the associated group name and key.) | |
| 793 | + | // | |
| 789 | 794 | // Note that this function prepends a `#` comment marker to | |
| 790 | 795 | // each line of @comment. | |
| 791 | 796 | func (x *KeyFile) SetComment(GroupNameVar string, KeyVar string, CommentVar string) (bool, error) { | |
M v4/glib/glibconfig.go +2 -2
| @@ -70,13 +70,13 @@ const ( | |||
| 70 | 70 | // Like #gtk_micro_version, but from the headers used at | |
| 71 | 71 | // application compile time, rather than from the library | |
| 72 | 72 | // linked against at application run time. | |
| 73 | - | MICRO_VERSION int = 4 | |
| 73 | + | MICRO_VERSION int = 0 | |
| 74 | 74 | // The minor version number of the GLib library. | |
| 75 | 75 | // | |
| 76 | 76 | // Like #gtk_minor_version, but from the headers used at | |
| 77 | 77 | // application compile time, rather than from the library | |
| 78 | 78 | // linked against at application run time. | |
| 79 | - | MINOR_VERSION int = 84 | |
| 79 | + | MINOR_VERSION int = 86 | |
| 80 | 80 | ||
| 81 | 81 | MODULE_SUFFIX string = "so" | |
| 82 | 82 | // A format specifier that can be used in printf()-style format strings | |
M v4/glib/gmain.go +331 -234
| @@ -133,8 +133,9 @@ func NewMainContextWithFlags(FlagsVar MainContextFlags) *MainContext { | |||
| 133 | 133 | var xMainContextAcquire func(uintptr) bool | |
| 134 | 134 | ||
| 135 | 135 | // Tries to become the owner of the specified context. | |
| 136 | + | // | |
| 136 | 137 | // If some other thread is the owner of the context, | |
| 137 | - | // returns %FALSE immediately. Ownership is properly | |
| 138 | + | // returns false immediately. Ownership is properly | |
| 138 | 139 | // recursive: the owner can require ownership again | |
| 139 | 140 | // and will release ownership when [method@GLib.MainContext.release] | |
| 140 | 141 | // is called as many times as [method@GLib.MainContext.acquire]. | |
| @@ -144,7 +145,7 @@ var xMainContextAcquire func(uintptr) bool | |||
| 144 | 145 | // [method@GLib.MainContext.check], [method@GLib.MainContext.dispatch], | |
| 145 | 146 | // [method@GLib.MainContext.release]. | |
| 146 | 147 | // | |
| 147 | - | // Since 2.76 @context can be %NULL to use the global-default | |
| 148 | + | // Since 2.76 @context can be `NULL` to use the global-default | |
| 148 | 149 | // main context. | |
| 149 | 150 | func (x *MainContext) Acquire() bool { | |
| 150 | 151 | ||
| @@ -155,8 +156,10 @@ func (x *MainContext) Acquire() bool { | |||
| 155 | 156 | var xMainContextAddPoll func(uintptr, *PollFD, int) | |
| 156 | 157 | ||
| 157 | 158 | // Adds a file descriptor to the set of file descriptors polled for | |
| 158 | - | // this context. This will very seldom be used directly. Instead | |
| 159 | - | // a typical event source will use `g_source_add_unix_fd` instead. | |
| 159 | + | // this context. | |
| 160 | + | // | |
| 161 | + | // This will very seldom be used directly. Instead | |
| 162 | + | // a typical event source will use `g_source_add_unix_fd()` instead. | |
| 160 | 163 | func (x *MainContext) AddPoll(FdVar *PollFD, PriorityVar int) { | |
| 161 | 164 | ||
| 162 | 165 | xMainContextAddPoll(x.GoPointer(), FdVar, PriorityVar) | |
| @@ -165,7 +168,9 @@ func (x *MainContext) AddPoll(FdVar *PollFD, PriorityVar int) { | |||
| 165 | 168 | ||
| 166 | 169 | var xMainContextCheck func(uintptr, int, []PollFD, int) bool | |
| 167 | 170 | ||
| 168 | - | // Passes the results of polling back to the main loop. You should be | |
| 171 | + | // Passes the results of polling back to the main loop. | |
| 172 | + | // | |
| 173 | + | // You should be | |
| 169 | 174 | // careful to pass @fds and its length @n_fds as received from | |
| 170 | 175 | // [method@GLib.MainContext.query], as this functions relies on assumptions | |
| 171 | 176 | // on how @fds is filled. | |
| @@ -173,7 +178,7 @@ var xMainContextCheck func(uintptr, int, []PollFD, int) bool | |||
| 173 | 178 | // You must have successfully acquired the context with | |
| 174 | 179 | // [method@GLib.MainContext.acquire] before you may call this function. | |
| 175 | 180 | // | |
| 176 | - | // Since 2.76 @context can be %NULL to use the global-default | |
| 181 | + | // Since 2.76 @context can be `NULL` to use the global-default | |
| 177 | 182 | // main context. | |
| 178 | 183 | func (x *MainContext) Check(MaxPriorityVar int, FdsVar []PollFD, NFdsVar int) bool { | |
| 179 | 184 | ||
| @@ -188,7 +193,7 @@ var xMainContextDispatch func(uintptr) | |||
| 188 | 193 | // You must have successfully acquired the context with | |
| 189 | 194 | // [method@GLib.MainContext.acquire] before you may call this function. | |
| 190 | 195 | // | |
| 191 | - | // Since 2.76 @context can be %NULL to use the global-default | |
| 196 | + | // Since 2.76 @context can be `NULL` to use the global-default | |
| 192 | 197 | // main context. | |
| 193 | 198 | func (x *MainContext) Dispatch() { | |
| 194 | 199 | ||
| @@ -198,8 +203,9 @@ func (x *MainContext) Dispatch() { | |||
| 198 | 203 | ||
| 199 | 204 | var xMainContextFindSourceByFuncsUserData func(uintptr, *SourceFuncs, uintptr) *Source | |
| 200 | 205 | ||
| 201 | - | // Finds a source with the given source functions and user data. If | |
| 202 | - | // multiple sources exist with the same source function and user data, | |
| 206 | + | // Finds a source with the given source functions and user data. | |
| 207 | + | // | |
| 208 | + | // If multiple sources exist with the same source function and user data, | |
| 203 | 209 | // the first one found will be returned. | |
| 204 | 210 | func (x *MainContext) FindSourceByFuncsUserData(FuncsVar *SourceFuncs, UserDataVar uintptr) *Source { | |
| 205 | 211 | ||
| @@ -209,7 +215,7 @@ func (x *MainContext) FindSourceByFuncsUserData(FuncsVar *SourceFuncs, UserDataV | |||
| 209 | 215 | ||
| 210 | 216 | var xMainContextFindSourceById func(uintptr, uint) *Source | |
| 211 | 217 | ||
| 212 | - | // Finds a #GSource given a pair of context and ID. | |
| 218 | + | // Finds a [struct@GLib.Source] given a pair of context and ID. | |
| 213 | 219 | // | |
| 214 | 220 | // It is a programmer error to attempt to look up a non-existent source. | |
| 215 | 221 | // | |
| @@ -229,8 +235,9 @@ func (x *MainContext) FindSourceById(SourceIdVar uint) *Source { | |||
| 229 | 235 | ||
| 230 | 236 | var xMainContextFindSourceByUserData func(uintptr, uintptr) *Source | |
| 231 | 237 | ||
| 232 | - | // Finds a source with the given user data for the callback. If | |
| 233 | - | // multiple sources exist with the same user data, the first | |
| 238 | + | // Finds a source with the given user data for the callback. | |
| 239 | + | // | |
| 240 | + | // If multiple sources exist with the same user data, the first | |
| 234 | 241 | // one found will be returned. | |
| 235 | 242 | func (x *MainContext) FindSourceByUserData(UserDataVar uintptr) *Source { | |
| 236 | 243 | ||
| @@ -252,13 +259,13 @@ var xMainContextInvoke func(uintptr, uintptr, uintptr) | |||
| 252 | 259 | // Invokes a function in such a way that @context is owned during the | |
| 253 | 260 | // invocation of @function. | |
| 254 | 261 | // | |
| 255 | - | // If @context is %NULL then the global-default main context — as | |
| 262 | + | // If @context is `NULL` then the global-default main context — as | |
| 256 | 263 | // returned by [func@GLib.MainContext.default] — is used. | |
| 257 | 264 | // | |
| 258 | 265 | // If @context is owned by the current thread, @function is called | |
| 259 | 266 | // directly. Otherwise, if @context is the thread-default main context | |
| 260 | - | // of the current thread and [method@GLib.MainContext.acquire] succeeds, then | |
| 261 | - | // @function is called and [method@GLib.MainContext.release] is called | |
| 267 | + | // of the current thread and [method@GLib.MainContext.acquire] succeeds, | |
| 268 | + | // then @function is called and [method@GLib.MainContext.release] is called | |
| 262 | 269 | // afterwards. | |
| 263 | 270 | // | |
| 264 | 271 | // In any other case, an idle source is created to call @function and | |
| @@ -267,9 +274,9 @@ var xMainContextInvoke func(uintptr, uintptr, uintptr) | |||
| 267 | 274 | // priority. If you want a different priority, use | |
| 268 | 275 | // [method@GLib.MainContext.invoke_full]. | |
| 269 | 276 | // | |
| 270 | - | // Note that, as with normal idle functions, @function should probably | |
| 271 | - | // return %FALSE. If it returns %TRUE, it will be continuously run in a | |
| 272 | - | // loop (and may prevent this call from returning). | |
| 277 | + | // Note that, as with normal idle functions, @function should probably return | |
| 278 | + | // [const@GLib.SOURCE_REMOVE]. If it returns [const@GLib.SOURCE_CONTINUE], it | |
| 279 | + | // will be continuously run in a loop (and may prevent this call from returning). | |
| 273 | 280 | func (x *MainContext) Invoke(FunctionVar *SourceFunc, DataVar uintptr) { | |
| 274 | 281 | ||
| 275 | 282 | xMainContextInvoke(x.GoPointer(), NewCallback(FunctionVar), DataVar) | |
| @@ -283,9 +290,10 @@ var xMainContextInvokeFull func(uintptr, int, uintptr, uintptr, uintptr) | |||
| 283 | 290 | // | |
| 284 | 291 | // This function is the same as [method@GLib.MainContext.invoke] except that it | |
| 285 | 292 | // lets you specify the priority in case @function ends up being | |
| 286 | - | // scheduled as an idle and also lets you give a #GDestroyNotify for @data. | |
| 293 | + | // scheduled as an idle and also lets you give a [callback@GLib.DestroyNotify] | |
| 294 | + | // for @data. | |
| 287 | 295 | // | |
| 288 | - | // @notify should not assume that it is called from any particular | |
| 296 | + | // The @notify function should not assume that it is called from any particular | |
| 289 | 297 | // thread or with any particular context acquired. | |
| 290 | 298 | func (x *MainContext) InvokeFull(PriorityVar int, FunctionVar *SourceFunc, DataVar uintptr, NotifyVar *DestroyNotify) { | |
| 291 | 299 | ||
| @@ -296,7 +304,9 @@ func (x *MainContext) InvokeFull(PriorityVar int, FunctionVar *SourceFunc, DataV | |||
| 296 | 304 | var xMainContextIsOwner func(uintptr) bool | |
| 297 | 305 | ||
| 298 | 306 | // Determines whether this thread holds the (recursive) | |
| 299 | - | // ownership of this [struct@GLib.MainContext]. This is useful to | |
| 307 | + | // ownership of this [struct@GLib.MainContext]. | |
| 308 | + | // | |
| 309 | + | // This is useful to | |
| 300 | 310 | // know before waiting on another thread that may be | |
| 301 | 311 | // blocking to get ownership of @context. | |
| 302 | 312 | func (x *MainContext) IsOwner() bool { | |
| @@ -307,17 +317,18 @@ func (x *MainContext) IsOwner() bool { | |||
| 307 | 317 | ||
| 308 | 318 | var xMainContextIteration func(uintptr, bool) bool | |
| 309 | 319 | ||
| 310 | - | // Runs a single iteration for the given main loop. This involves | |
| 320 | + | // Runs a single iteration for the given main loop. | |
| 321 | + | // | |
| 322 | + | // This involves | |
| 311 | 323 | // checking to see if any event sources are ready to be processed, | |
| 312 | - | // then if no events sources are ready and @may_block is %TRUE, waiting | |
| 324 | + | // then if no events sources are ready and @may_block is true, waiting | |
| 313 | 325 | // for a source to become ready, then dispatching the highest priority | |
| 314 | - | // events sources that are ready. Otherwise, if @may_block is %FALSE | |
| 315 | - | // sources are not waited to become ready, only those highest priority | |
| 316 | - | // events sources will be dispatched (if any), that are ready at this | |
| 317 | - | // given moment without further waiting. | |
| 326 | + | // events sources that are ready. Otherwise, if @may_block is false, | |
| 327 | + | // this function does not wait for sources to become ready, and only the highest | |
| 328 | + | // priority sources which are already ready (if any) will be dispatched. | |
| 318 | 329 | // | |
| 319 | - | // Note that even when @may_block is %TRUE, it is still possible for | |
| 320 | - | // [method@GLib.MainContext.iteration] to return %FALSE, since the wait may | |
| 330 | + | // Note that even when @may_block is true, it is still possible for | |
| 331 | + | // [method@GLib.MainContext.iteration] to return false, since the wait may | |
| 321 | 332 | // be interrupted for other reasons than an event source becoming ready. | |
| 322 | 333 | func (x *MainContext) Iteration(MayBlockVar bool) bool { | |
| 323 | 334 | ||
| @@ -346,7 +357,9 @@ func (x *MainContext) PopThreadDefault() { | |||
| 346 | 357 | ||
| 347 | 358 | var xMainContextPrepare func(uintptr, int) bool | |
| 348 | 359 | ||
| 349 | - | // Prepares to poll sources within a main loop. The resulting information | |
| 360 | + | // Prepares to poll sources within a main loop. | |
| 361 | + | // | |
| 362 | + | // The resulting information | |
| 350 | 363 | // for polling is determined by calling [method@GLib.MainContext.query]. | |
| 351 | 364 | // | |
| 352 | 365 | // You must have successfully acquired the context with | |
| @@ -377,8 +390,8 @@ var xMainContextPushThreadDefault func(uintptr) | |||
| 377 | 390 | // the new [struct@GLib.MainContext] to be the default for the whole lifecycle | |
| 378 | 391 | // of the thread. | |
| 379 | 392 | // | |
| 380 | - | // If you don't have control over how the new thread was created (e.g. | |
| 381 | - | // in the new thread isn't newly created, or if the thread life | |
| 393 | + | // If you don’t have control over how the new thread was created (e.g. | |
| 394 | + | // in the new thread isn’t newly created, or if the thread life | |
| 382 | 395 | // cycle is managed by a #GThreadPool), it is always suggested to wrap | |
| 383 | 396 | // the logic that needs to use the new [struct@GLib.MainContext] inside a | |
| 384 | 397 | // [method@GLib.MainContext.push_thread_default] / | |
| @@ -396,8 +409,8 @@ var xMainContextPushThreadDefault func(uintptr) | |||
| 396 | 409 | // started while the non-default context is active. | |
| 397 | 410 | // | |
| 398 | 411 | // Beware that libraries that predate this function may not correctly | |
| 399 | - | // handle being used from a thread with a thread-default context. Eg, | |
| 400 | - | // see g_file_supports_thread_contexts(). | |
| 412 | + | // handle being used from a thread with a thread-default context. For example, | |
| 413 | + | // see `g_file_supports_thread_contexts()`. | |
| 401 | 414 | func (x *MainContext) PushThreadDefault() { | |
| 402 | 415 | ||
| 403 | 416 | xMainContextPushThreadDefault(x.GoPointer()) | |
| @@ -454,9 +467,11 @@ func (x *MainContext) PusherNew() *MainContextPusher { | |||
| 454 | 467 | ||
| 455 | 468 | var xMainContextQuery func(uintptr, int, int, []PollFD, int) int | |
| 456 | 469 | ||
| 457 | - | // Determines information necessary to poll this main loop. You should | |
| 470 | + | // Determines information necessary to poll this main loop. | |
| 471 | + | // | |
| 472 | + | // You should | |
| 458 | 473 | // be careful to pass the resulting @fds array and its length @n_fds | |
| 459 | - | // as is when calling [method@GLib.MainContext.check], as this function relies | |
| 474 | + | // as-is when calling [method@GLib.MainContext.check], as this function relies | |
| 460 | 475 | // on assumptions made when the array is filled. | |
| 461 | 476 | // | |
| 462 | 477 | // You must have successfully acquired the context with | |
| @@ -479,7 +494,9 @@ func (x *MainContext) Ref() *MainContext { | |||
| 479 | 494 | var xMainContextRelease func(uintptr) | |
| 480 | 495 | ||
| 481 | 496 | // Releases ownership of a context previously acquired by this thread | |
| 482 | - | // with [method@GLib.MainContext.acquire]. If the context was acquired multiple | |
| 497 | + | // with [method@GLib.MainContext.acquire]. | |
| 498 | + | // | |
| 499 | + | // If the context was acquired multiple | |
| 483 | 500 | // times, the ownership will be released only when [method@GLib.MainContext.release] | |
| 484 | 501 | // is called as many times as it was acquired. | |
| 485 | 502 | // | |
| @@ -503,10 +520,11 @@ func (x *MainContext) RemovePoll(FdVar *PollFD) { | |||
| 503 | 520 | ||
| 504 | 521 | var xMainContextSetPollFunc func(uintptr, uintptr) | |
| 505 | 522 | ||
| 506 | - | // Sets the function to use to handle polling of file descriptors. It | |
| 507 | - | // will be used instead of the poll() system call | |
| 508 | - | // (or GLib's replacement function, which is used where | |
| 509 | - | // poll() isn't available). | |
| 523 | + | // Sets the function to use to handle polling of file descriptors. | |
| 524 | + | // | |
| 525 | + | // It will be used instead of the [`poll()`](man:poll(2)) system call | |
| 526 | + | // (or GLib’s replacement function, which is used where | |
| 527 | + | // `poll()` isn’t available). | |
| 510 | 528 | // | |
| 511 | 529 | // This function could possibly be used to integrate the GLib event | |
| 512 | 530 | // loop with an external event loop. | |
| @@ -529,8 +547,10 @@ func (x *MainContext) Unref() { | |||
| 529 | 547 | ||
| 530 | 548 | var xMainContextWait func(uintptr, *Cond, *Mutex) bool | |
| 531 | 549 | ||
| 532 | - | // Tries to become the owner of the specified context, | |
| 533 | - | // as with [method@GLib.MainContext.acquire]. But if another thread | |
| 550 | + | // Tries to become the owner of the specified context, and waits on @cond if | |
| 551 | + | // another thread is the owner. | |
| 552 | + | // | |
| 553 | + | // This is the same as [method@GLib.MainContext.acquire], but if another thread | |
| 534 | 554 | // is the owner, atomically drop @mutex and wait on @cond until | |
| 535 | 555 | // that owner releases ownership or until @cond is signaled, then | |
| 536 | 556 | // try again (once) to become the owner. | |
| @@ -542,10 +562,13 @@ func (x *MainContext) Wait(CondVar *Cond, MutexVar *Mutex) bool { | |||
| 542 | 562 | ||
| 543 | 563 | var xMainContextWakeup func(uintptr) | |
| 544 | 564 | ||
| 545 | - | // If @context is currently blocking in [method@GLib.MainContext.iteration] | |
| 546 | - | // waiting for a source to become ready, cause it to stop blocking | |
| 547 | - | // and return. Otherwise, cause the next invocation of | |
| 548 | - | // [method@GLib.MainContext.iteration] to return without blocking. | |
| 565 | + | // Wake up @context if it’s currently blocking in | |
| 566 | + | // [method@GLib.MainContext.iteration], causing it to stop blocking. | |
| 567 | + | // | |
| 568 | + | // The @context could be blocking waiting for a source to become ready. | |
| 569 | + | // Otherwise, if @context is not currently blocking, this function causes the | |
| 570 | + | // next invocation of [method@GLib.MainContext.iteration] to return without | |
| 571 | + | // blocking. | |
| 549 | 572 | // | |
| 550 | 573 | // This API is useful for low-level control over [struct@GLib.MainContext]; for | |
| 551 | 574 | // example, integrating it with main loop implementations such as | |
| @@ -554,7 +577,7 @@ var xMainContextWakeup func(uintptr) | |||
| 554 | 577 | // Another related use for this function is when implementing a main | |
| 555 | 578 | // loop with a termination condition, computed from multiple threads: | |
| 556 | 579 | // | |
| 557 | - | // |[<!-- language="C" --> | |
| 580 | + | // ```c | |
| 558 | 581 | // | |
| 559 | 582 | // #define NUM_TASKS 10 | |
| 560 | 583 | // static gint tasks_remaining = NUM_TASKS; // (atomic) | |
| @@ -563,17 +586,17 @@ var xMainContextWakeup func(uintptr) | |||
| 563 | 586 | // while (g_atomic_int_get (&tasks_remaining) != 0) | |
| 564 | 587 | // g_main_context_iteration (NULL, TRUE); | |
| 565 | 588 | // | |
| 566 | - | // ]| | |
| 589 | + | // ``` | |
| 567 | 590 | // | |
| 568 | 591 | // Then in a thread: | |
| 569 | - | // |[<!-- language="C" --> | |
| 592 | + | // ```c | |
| 570 | 593 | // | |
| 571 | - | // perform_work(); | |
| 594 | + | // perform_work (); | |
| 572 | 595 | // | |
| 573 | 596 | // if (g_atomic_int_dec_and_test (&tasks_remaining)) | |
| 574 | 597 | // g_main_context_wakeup (NULL); | |
| 575 | 598 | // | |
| 576 | - | // ]| | |
| 599 | + | // ``` | |
| 577 | 600 | func (x *MainContext) Wakeup() { | |
| 578 | 601 | ||
| 579 | 602 | xMainContextWakeup(x.GoPointer()) | |
| @@ -649,7 +672,8 @@ func (x *MainLoop) Ref() *MainLoop { | |||
| 649 | 672 | var xMainLoopRun func(uintptr) | |
| 650 | 673 | ||
| 651 | 674 | // Runs a main loop until [method@GLib.MainLoop.quit] is called on the loop. | |
| 652 | - | // If this is called for the thread of the loop's #GMainContext, | |
| 675 | + | // | |
| 676 | + | // If this is called from the thread of the loop’s [struct@GLib.MainContext], | |
| 653 | 677 | // it will process events from the loop, otherwise it will | |
| 654 | 678 | // simply wait. | |
| 655 | 679 | func (x *MainLoop) Run() { | |
| @@ -660,8 +684,9 @@ func (x *MainLoop) Run() { | |||
| 660 | 684 | ||
| 661 | 685 | var xMainLoopUnref func(uintptr) | |
| 662 | 686 | ||
| 663 | - | // Decreases the reference count on a [struct@GLib.MainLoop] object by one. If | |
| 664 | - | // the result is zero, free the loop and free all associated memory. | |
| 687 | + | // Decreases the reference count on a [struct@GLib.MainLoop] object by one. | |
| 688 | + | // | |
| 689 | + | // If the result is zero, the loop and all associated memory are freed. | |
| 665 | 690 | func (x *MainLoop) Unref() { | |
| 666 | 691 | ||
| 667 | 692 | xMainLoopUnref(x.GoPointer()) | |
| @@ -712,12 +737,14 @@ func (x *Source) GoPointer() uintptr { | |||
| 712 | 737 | ||
| 713 | 738 | var xNewSource func(*SourceFuncs, uint) *Source | |
| 714 | 739 | ||
| 715 | - | // Creates a new [struct@GLib.Source] structure. The size is specified to | |
| 740 | + | // Creates a new [struct@GLib.Source] structure. | |
| 741 | + | // | |
| 742 | + | // The size is specified to | |
| 716 | 743 | // allow creating structures derived from [struct@GLib.Source] that contain | |
| 717 | 744 | // additional data. The size passed in must be at least | |
| 718 | 745 | // `sizeof (GSource)`. | |
| 719 | 746 | // | |
| 720 | - | // The source will not initially be associated with any #GMainContext | |
| 747 | + | // The source will not initially be associated with any [struct@GLib.MainContext] | |
| 721 | 748 | // and must be added to one with [method@GLib.Source.attach] before it will be | |
| 722 | 749 | // executed. | |
| 723 | 750 | func NewSource(SourceFuncsVar *SourceFuncs, StructSizeVar uint) *Source { | |
| @@ -728,24 +755,25 @@ func NewSource(SourceFuncsVar *SourceFuncs, StructSizeVar uint) *Source { | |||
| 728 | 755 | ||
| 729 | 756 | var xSourceAddChildSource func(uintptr, *Source) | |
| 730 | 757 | ||
| 731 | - | // Adds @child_source to @source as a "polled" source; when @source is | |
| 732 | - | // added to a [struct@GLib.MainContext], @child_source will be automatically | |
| 733 | - | // added with the same priority, when @child_source is triggered, it will | |
| 734 | - | // cause @source to dispatch (in addition to calling its own | |
| 735 | - | // callback), and when @source is destroyed, it will destroy | |
| 736 | - | // @child_source as well. (@source will also still be dispatched if | |
| 737 | - | // its own prepare/check functions indicate that it is ready.) | |
| 758 | + | // Adds @child_source to @source as a ‘polled’ source. | |
| 738 | 759 | // | |
| 739 | - | // If you don't need @child_source to do anything on its own when it | |
| 740 | - | // triggers, you can call g_source_set_dummy_callback() on it to set a | |
| 741 | - | // callback that does nothing (except return %TRUE if appropriate). | |
| 760 | + | // When @source is added to a [struct@GLib.MainContext], @child_source will be | |
| 761 | + | // automatically added with the same priority. When @child_source is triggered, | |
| 762 | + | // it will cause @source to dispatch (in addition to calling its own callback), | |
| 763 | + | // and when @source is destroyed, it will destroy @child_source as well. | |
| 742 | 764 | // | |
| 743 | - | // @source will hold a reference on @child_source while @child_source | |
| 765 | + | // The @source will also still be dispatched if its own prepare/check functions | |
| 766 | + | // indicate that it is ready. | |
| 767 | + | // | |
| 768 | + | // If you don’t need @child_source to do anything on its own when it | |
| 769 | + | // triggers, you can call `g_source_set_dummy_callback()` on it to set a | |
| 770 | + | // callback that does nothing (except return true if appropriate). | |
| 771 | + | // | |
| 772 | + | // The @source will hold a reference on @child_source while @child_source | |
| 744 | 773 | // is attached to it. | |
| 745 | 774 | // | |
| 746 | - | // This API is only intended to be used by implementations of | |
| 747 | - | // [struct@GLib.Source]. Do not call this API on a [struct@GLib.Source] that | |
| 748 | - | // you did not create. | |
| 775 | + | // This API is only intended to be used by implementations of [struct@GLib.Source]. | |
| 776 | + | // Do not call this API on a [struct@GLib.Source] that you did not create. | |
| 749 | 777 | func (x *Source) AddChildSource(ChildSourceVar *Source) { | |
| 750 | 778 | ||
| 751 | 779 | xSourceAddChildSource(x.GoPointer(), ChildSourceVar) | |
| @@ -755,17 +783,19 @@ func (x *Source) AddChildSource(ChildSourceVar *Source) { | |||
| 755 | 783 | var xSourceAddPoll func(uintptr, *PollFD) | |
| 756 | 784 | ||
| 757 | 785 | // Adds a file descriptor to the set of file descriptors polled for | |
| 758 | - | // this source. This is usually combined with [ctor@GLib.Source.new] to add an | |
| 759 | - | // event source. The event source's check function will typically test | |
| 760 | - | // the @revents field in the #GPollFD struct and return %TRUE if events need | |
| 761 | - | // to be processed. | |
| 786 | + | // this source. | |
| 787 | + | // | |
| 788 | + | // This is usually combined with [ctor@GLib.Source.new] to add an | |
| 789 | + | // event source. The event source’s check function will typically test | |
| 790 | + | // the @revents field in the [struct@GLib.PollFD] struct and return true if | |
| 791 | + | // events need to be processed. | |
| 762 | 792 | // | |
| 763 | 793 | // This API is only intended to be used by implementations of [struct@GLib.Source]. | |
| 764 | 794 | // Do not call this API on a [struct@GLib.Source] that you did not create. | |
| 765 | 795 | // | |
| 766 | 796 | // Using this API forces the linear scanning of event sources on each | |
| 767 | 797 | // main loop iteration. Newly-written event sources should try to use | |
| 768 | - | // `g_source_add_unix_fd` instead of this API. | |
| 798 | + | // `g_source_add_unix_fd()` instead of this API. | |
| 769 | 799 | func (x *Source) AddPoll(FdVar *PollFD) { | |
| 770 | 800 | ||
| 771 | 801 | xSourceAddPoll(x.GoPointer(), FdVar) | |
| @@ -777,14 +807,14 @@ var xSourceAddUnixFd func(uintptr, int, IOCondition) uintptr | |||
| 777 | 807 | // Monitors @fd for the IO events in @events. | |
| 778 | 808 | // | |
| 779 | 809 | // The tag returned by this function can be used to remove or modify the | |
| 780 | - | // monitoring of the fd using [method@GLib.Source.remove_unix_fd] or | |
| 810 | + | // monitoring of the @fd using [method@GLib.Source.remove_unix_fd] or | |
| 781 | 811 | // [method@GLib.Source.modify_unix_fd]. | |
| 782 | 812 | // | |
| 783 | - | // It is not necessary to remove the fd before destroying the source; it | |
| 784 | - | // will be cleaned up automatically. | |
| 813 | + | // It is not necessary to remove the file descriptor before destroying the | |
| 814 | + | // source; it will be cleaned up automatically. | |
| 785 | 815 | // | |
| 786 | - | // This API is only intended to be used by implementations of #GSource. | |
| 787 | - | // Do not call this API on a #GSource that you did not create. | |
| 816 | + | // This API is only intended to be used by implementations of [struct@GLib.Source]. | |
| 817 | + | // Do not call this API on a [struct@GLib.Source] that you did not create. | |
| 788 | 818 | // | |
| 789 | 819 | // As the name suggests, this function is not available on Windows. | |
| 790 | 820 | func (x *Source) AddUnixFd(FdVar int, EventsVar IOCondition) uintptr { | |
| @@ -796,7 +826,9 @@ func (x *Source) AddUnixFd(FdVar int, EventsVar IOCondition) uintptr { | |||
| 796 | 826 | var xSourceAttach func(uintptr, *MainContext) uint | |
| 797 | 827 | ||
| 798 | 828 | // Adds a [struct@GLib.Source] to a @context so that it will be executed within | |
| 799 | - | // that context. Remove it by calling [method@GLib.Source.destroy]. | |
| 829 | + | // that context. | |
| 830 | + | // | |
| 831 | + | // Remove it by calling [method@GLib.Source.destroy]. | |
| 800 | 832 | // | |
| 801 | 833 | // This function is safe to call from any thread, regardless of which thread | |
| 802 | 834 | // the @context is running in. | |
| @@ -808,8 +840,10 @@ func (x *Source) Attach(ContextVar *MainContext) uint { | |||
| 808 | 840 | ||
| 809 | 841 | var xSourceDestroy func(uintptr) | |
| 810 | 842 | ||
| 811 | - | // Removes a source from its [struct@GLib.MainContext], if any, and mark it as | |
| 812 | - | // destroyed. The source cannot be subsequently added to another | |
| 843 | + | // Removes a source from its [struct@GLib.MainContext], if any, and marks it as | |
| 844 | + | // destroyed. | |
| 845 | + | // | |
| 846 | + | // The source cannot be subsequently added to another | |
| 813 | 847 | // context. It is safe to call this on sources which have already been | |
| 814 | 848 | // removed from their context. | |
| 815 | 849 | // | |
| @@ -821,18 +855,33 @@ var xSourceDestroy func(uintptr) | |||
| 821 | 855 | // | |
| 822 | 856 | // If the source is currently attached to a [struct@GLib.MainContext], | |
| 823 | 857 | // destroying it will effectively unset the callback similar to calling | |
| 824 | - | // [method@GLib.Source.set_callback]. This can mean, that the data's | |
| 825 | - | // #GDestroyNotify gets called right away. | |
| 858 | + | // [method@GLib.Source.set_callback]. This can mean, that the data’s | |
| 859 | + | // [callback@GLib.DestroyNotify] gets called right away. | |
| 826 | 860 | func (x *Source) Destroy() { | |
| 827 | 861 | ||
| 828 | 862 | xSourceDestroy(x.GoPointer()) | |
| 829 | 863 | ||
| 830 | 864 | } | |
| 831 | 865 | ||
| 866 | + | var xSourceDupContext func(uintptr) *MainContext | |
| 867 | + | ||
| 868 | + | // Gets a reference to the [struct@GLib.MainContext] with which the source is | |
| 869 | + | // associated. | |
| 870 | + | // | |
| 871 | + | // You can call this on a source that has been destroyed. You can | |
| 872 | + | // always call this function on the source returned from | |
| 873 | + | // [func@GLib.main_current_source]. | |
| 874 | + | func (x *Source) DupContext() *MainContext { | |
| 875 | + | ||
| 876 | + | cret := xSourceDupContext(x.GoPointer()) | |
| 877 | + | return cret | |
| 878 | + | } | |
| 879 | + | ||
| 832 | 880 | var xSourceGetCanRecurse func(uintptr) bool | |
| 833 | 881 | ||
| 834 | 882 | // Checks whether a source is allowed to be called recursively. | |
| 835 | - | // see [method@GLib.Source.set_can_recurse]. | |
| 883 | + | // | |
| 884 | + | // See [method@GLib.Source.set_can_recurse]. | |
| 836 | 885 | func (x *Source) GetCanRecurse() bool { | |
| 837 | 886 | ||
| 838 | 887 | cret := xSourceGetCanRecurse(x.GoPointer()) | |
| @@ -849,6 +898,10 @@ var xSourceGetContext func(uintptr) *MainContext | |||
| 849 | 898 | // always call this function on the source returned from | |
| 850 | 899 | // [func@GLib.main_current_source]. But calling this function on a source | |
| 851 | 900 | // whose [struct@GLib.MainContext] has been destroyed is an error. | |
| 901 | + | // | |
| 902 | + | // If the associated [struct@GLib.MainContext] could be destroy concurrently from | |
| 903 | + | // a different thread, then this function is not safe to call and | |
| 904 | + | // [method@GLib.Source.dup_context] should be used instead. | |
| 852 | 905 | func (x *Source) GetContext() *MainContext { | |
| 853 | 906 | ||
| 854 | 907 | cret := xSourceGetContext(x.GoPointer()) | |
| @@ -867,7 +920,9 @@ func (x *Source) GetCurrentTime(TimevalVar *TimeVal) { | |||
| 867 | 920 | ||
| 868 | 921 | var xSourceGetId func(uintptr) uint | |
| 869 | 922 | ||
| 870 | - | // Returns the numeric ID for a particular source. The ID of a source | |
| 923 | + | // Returns the numeric ID for a particular source. | |
| 924 | + | // | |
| 925 | + | // The ID of a source | |
| 871 | 926 | // is a positive integer which is unique within a particular main loop | |
| 872 | 927 | // context. The reverse mapping from ID to source is done by | |
| 873 | 928 | // [method@GLib.MainContext.find_source_by_id]. | |
| @@ -885,8 +940,10 @@ func (x *Source) GetId() uint { | |||
| 885 | 940 | ||
| 886 | 941 | var xSourceGetName func(uintptr) string | |
| 887 | 942 | ||
| 888 | - | // Gets a name for the source, used in debugging and profiling. The | |
| 889 | - | // name may be #NULL if it has never been set with [method@GLib.Source.set_name]. | |
| 943 | + | // Gets a name for the source, used in debugging and profiling. | |
| 944 | + | // | |
| 945 | + | // The | |
| 946 | + | // name may be `NULL` if it has never been set with [method@GLib.Source.set_name]. | |
| 890 | 947 | func (x *Source) GetName() string { | |
| 891 | 948 | ||
| 892 | 949 | cret := xSourceGetName(x.GoPointer()) | |
| @@ -904,10 +961,10 @@ func (x *Source) GetPriority() int { | |||
| 904 | 961 | ||
| 905 | 962 | var xSourceGetReadyTime func(uintptr) int64 | |
| 906 | 963 | ||
| 907 | - | // Gets the "ready time" of @source, as set by | |
| 964 | + | // Gets the ‘ready time’ of @source, as set by | |
| 908 | 965 | // [method@GLib.Source.set_ready_time]. | |
| 909 | 966 | // | |
| 910 | - | // Any time before or equal to the current monotonic time (including 0) | |
| 967 | + | // Any time before or equal to the current monotonic time (including zero) | |
| 911 | 968 | // is an indication that the source will fire immediately. | |
| 912 | 969 | func (x *Source) GetReadyTime() int64 { | |
| 913 | 970 | ||
| @@ -917,7 +974,9 @@ func (x *Source) GetReadyTime() int64 { | |||
| 917 | 974 | ||
| 918 | 975 | var xSourceGetTime func(uintptr) int64 | |
| 919 | 976 | ||
| 920 | - | // Gets the time to be used when checking this source. The advantage of | |
| 977 | + | // Gets the time to be used when checking this source. | |
| 978 | + | // | |
| 979 | + | // The advantage of | |
| 921 | 980 | // calling this function over calling [func@GLib.get_monotonic_time] directly is | |
| 922 | 981 | // that when checking multiple sources, GLib can cache a single value | |
| 923 | 982 | // instead of having to repeatedly get the system monotonic time. | |
| @@ -938,7 +997,7 @@ var xSourceIsDestroyed func(uintptr) bool | |||
| 938 | 997 | // from within idle handlers, but may have freed the object | |
| 939 | 998 | // before the dispatch of your idle handler. | |
| 940 | 999 | // | |
| 941 | - | // |[<!-- language="C" --> | |
| 1000 | + | // ```c | |
| 942 | 1001 | // static gboolean | |
| 943 | 1002 | // idle_callback (gpointer data) | |
| 944 | 1003 | // | |
| @@ -985,7 +1044,7 @@ var xSourceIsDestroyed func(uintptr) bool | |||
| 985 | 1044 | // G_OBJECT_CLASS (parent_class)->finalize (object); | |
| 986 | 1045 | // } | |
| 987 | 1046 | // | |
| 988 | - | // ]| | |
| 1047 | + | // ``` | |
| 989 | 1048 | // | |
| 990 | 1049 | // This will fail in a multi-threaded application if the | |
| 991 | 1050 | // widget is destroyed before the idle handler fires due | |
| @@ -993,7 +1052,7 @@ var xSourceIsDestroyed func(uintptr) bool | |||
| 993 | 1052 | // this particular problem, is to check to if the source | |
| 994 | 1053 | // has already been destroy within the callback. | |
| 995 | 1054 | // | |
| 996 | - | // |[<!-- language="C" --> | |
| 1055 | + | // ```c | |
| 997 | 1056 | // static gboolean | |
| 998 | 1057 | // idle_callback (gpointer data) | |
| 999 | 1058 | // | |
| @@ -1010,10 +1069,10 @@ var xSourceIsDestroyed func(uintptr) bool | |||
| 1010 | 1069 | // return FALSE; | |
| 1011 | 1070 | // } | |
| 1012 | 1071 | // | |
| 1013 | - | // ]| | |
| 1072 | + | // ``` | |
| 1014 | 1073 | // | |
| 1015 | 1074 | // Calls to this function from a thread other than the one acquired by the | |
| 1016 | - | // [struct@GLib.MainContext] the #GSource is attached to are typically | |
| 1075 | + | // [struct@GLib.MainContext] the [struct@GLib.Source] is attached to are typically | |
| 1017 | 1076 | // redundant, as the source could be destroyed immediately after this function | |
| 1018 | 1077 | // returns. However, once a source is destroyed it cannot be un-destroyed, so | |
| 1019 | 1078 | // this function can be used for opportunistic checks from any thread. | |
| @@ -1025,15 +1084,15 @@ func (x *Source) IsDestroyed() bool { | |||
| 1025 | 1084 | ||
| 1026 | 1085 | var xSourceModifyUnixFd func(uintptr, uintptr, IOCondition) | |
| 1027 | 1086 | ||
| 1028 | - | // Updates the event mask to watch for the fd identified by @tag. | |
| 1087 | + | // Updates the event mask to watch for the file descriptor identified by @tag. | |
| 1029 | 1088 | // | |
| 1030 | - | // @tag is the tag returned from [method@GLib.Source.add_unix_fd]. | |
| 1089 | + | // The @tag is the tag returned from [method@GLib.Source.add_unix_fd]. | |
| 1031 | 1090 | // | |
| 1032 | - | // If you want to remove a fd, don't set its event mask to zero. | |
| 1091 | + | // If you want to remove a file descriptor, don’t set its event mask to zero. | |
| 1033 | 1092 | // Instead, call [method@GLib.Source.remove_unix_fd]. | |
| 1034 | 1093 | // | |
| 1035 | - | // This API is only intended to be used by implementations of #GSource. | |
| 1036 | - | // Do not call this API on a #GSource that you did not create. | |
| 1094 | + | // This API is only intended to be used by implementations of [struct@GLib.Source]. | |
| 1095 | + | // Do not call this API on a [struct@GLib.Source] that you did not create. | |
| 1037 | 1096 | // | |
| 1038 | 1097 | // As the name suggests, this function is not available on Windows. | |
| 1039 | 1098 | func (x *Source) ModifyUnixFd(TagVar uintptr, NewEventsVar IOCondition) { | |
| @@ -1044,14 +1103,14 @@ func (x *Source) ModifyUnixFd(TagVar uintptr, NewEventsVar IOCondition) { | |||
| 1044 | 1103 | ||
| 1045 | 1104 | var xSourceQueryUnixFd func(uintptr, uintptr) IOCondition | |
| 1046 | 1105 | ||
| 1047 | - | // Queries the events reported for the fd corresponding to @tag on | |
| 1048 | - | // @source during the last poll. | |
| 1106 | + | // Queries the events reported for the file descriptor corresponding to @tag | |
| 1107 | + | // on @source during the last poll. | |
| 1049 | 1108 | // | |
| 1050 | 1109 | // The return value of this function is only defined when the function | |
| 1051 | 1110 | // is called from the check or dispatch functions for @source. | |
| 1052 | 1111 | // | |
| 1053 | - | // This API is only intended to be used by implementations of #GSource. | |
| 1054 | - | // Do not call this API on a #GSource that you did not create. | |
| 1112 | + | // This API is only intended to be used by implementations of [struct@GLib.Source]. | |
| 1113 | + | // Do not call this API on a [struct@GLib.Source] that you did not create. | |
| 1055 | 1114 | // | |
| 1056 | 1115 | // As the name suggests, this function is not available on Windows. | |
| 1057 | 1116 | func (x *Source) QueryUnixFd(TagVar uintptr) IOCondition { | |
| @@ -1073,8 +1132,8 @@ var xSourceRemoveChildSource func(uintptr, *Source) | |||
| 1073 | 1132 | ||
| 1074 | 1133 | // Detaches @child_source from @source and destroys it. | |
| 1075 | 1134 | // | |
| 1076 | - | // This API is only intended to be used by implementations of #GSource. | |
| 1077 | - | // Do not call this API on a #GSource that you did not create. | |
| 1135 | + | // This API is only intended to be used by implementations of [struct@GLib.Source]. | |
| 1136 | + | // Do not call this API on a [struct@GLib.Source] that you did not create. | |
| 1078 | 1137 | func (x *Source) RemoveChildSource(ChildSourceVar *Source) { | |
| 1079 | 1138 | ||
| 1080 | 1139 | xSourceRemoveChildSource(x.GoPointer(), ChildSourceVar) | |
| @@ -1098,12 +1157,12 @@ var xSourceRemoveUnixFd func(uintptr, uintptr) | |||
| 1098 | 1157 | ||
| 1099 | 1158 | // Reverses the effect of a previous call to [method@GLib.Source.add_unix_fd]. | |
| 1100 | 1159 | // | |
| 1101 | - | // You only need to call this if you want to remove an fd from being | |
| 1160 | + | // You only need to call this if you want to remove a file descriptor from being | |
| 1102 | 1161 | // watched while keeping the same source around. In the normal case you | |
| 1103 | 1162 | // will just want to destroy the source. | |
| 1104 | 1163 | // | |
| 1105 | - | // This API is only intended to be used by implementations of #GSource. | |
| 1106 | - | // Do not call this API on a #GSource that you did not create. | |
| 1164 | + | // This API is only intended to be used by implementations of [struct@GLib.Source]. | |
| 1165 | + | // Do not call this API on a [struct@GLib.Source] that you did not create. | |
| 1107 | 1166 | // | |
| 1108 | 1167 | // As the name suggests, this function is not available on Windows. | |
| 1109 | 1168 | func (x *Source) RemoveUnixFd(TagVar uintptr) { | |
| @@ -1115,17 +1174,17 @@ func (x *Source) RemoveUnixFd(TagVar uintptr) { | |||
| 1115 | 1174 | var xSourceSetCallback func(uintptr, uintptr, uintptr, uintptr) | |
| 1116 | 1175 | ||
| 1117 | 1176 | // Sets the callback function for a source. The callback for a source is | |
| 1118 | - | // called from the source's dispatch function. | |
| 1177 | + | // called from the source’s dispatch function. | |
| 1119 | 1178 | // | |
| 1120 | 1179 | // The exact type of @func depends on the type of source; ie. you | |
| 1121 | 1180 | // should not count on @func being called with @data as its first | |
| 1122 | 1181 | // parameter. Cast @func with [func@GLib.SOURCE_FUNC] to avoid warnings about | |
| 1123 | 1182 | // incompatible function types. | |
| 1124 | 1183 | // | |
| 1125 | - | // See [mainloop memory management](main-loop.html#memory-management-of-sources) for details | |
| 1184 | + | // See [main loop memory management](main-loop.html#memory-management-of-sources) for details | |
| 1126 | 1185 | // on how to handle memory management of @data. | |
| 1127 | 1186 | // | |
| 1128 | - | // Typically, you won't use this function. Instead use functions specific | |
| 1187 | + | // Typically, you won’t use this function. Instead use functions specific | |
| 1129 | 1188 | // to the type of source you are using, such as [func@GLib.idle_add] or | |
| 1130 | 1189 | // [func@GLib.timeout_add]. | |
| 1131 | 1190 | // | |
| @@ -1143,12 +1202,14 @@ func (x *Source) SetCallback(FuncVar *SourceFunc, DataVar uintptr, NotifyVar *De | |||
| 1143 | 1202 | ||
| 1144 | 1203 | var xSourceSetCallbackIndirect func(uintptr, uintptr, *SourceCallbackFuncs) | |
| 1145 | 1204 | ||
| 1146 | - | // Sets the callback function storing the data as a refcounted callback | |
| 1147 | - | // "object". This is used internally. Note that calling | |
| 1205 | + | // Sets the callback function storing the data as a reference counted callback | |
| 1206 | + | // ‘object’. | |
| 1207 | + | // | |
| 1208 | + | // This is used internally. Note that calling | |
| 1148 | 1209 | // [method@GLib.Source.set_callback_indirect] assumes | |
| 1149 | 1210 | // an initial reference count on @callback_data, and thus | |
| 1150 | - | // @callback_funcs->unref will eventually be called once more | |
| 1151 | - | // than @callback_funcs->ref. | |
| 1211 | + | // `callback_funcs->unref` will eventually be called once more than | |
| 1212 | + | // `callback_funcs->ref`. | |
| 1152 | 1213 | // | |
| 1153 | 1214 | // It is safe to call this function multiple times on a source which has already | |
| 1154 | 1215 | // been attached to a context. The changes will take effect for the next time | |
| @@ -1161,9 +1222,10 @@ func (x *Source) SetCallbackIndirect(CallbackDataVar uintptr, CallbackFuncsVar * | |||
| 1161 | 1222 | ||
| 1162 | 1223 | var xSourceSetCanRecurse func(uintptr, bool) | |
| 1163 | 1224 | ||
| 1164 | - | // Sets whether a source can be called recursively. If @can_recurse is | |
| 1165 | - | // %TRUE, then while the source is being dispatched then this source | |
| 1166 | - | // will be processed normally. Otherwise, all processing of this | |
| 1225 | + | // Sets whether a source can be called recursively. | |
| 1226 | + | // | |
| 1227 | + | // If @can_recurse is true, then while the source is being dispatched then this | |
| 1228 | + | // source will be processed normally. Otherwise, all processing of this | |
| 1167 | 1229 | // source is blocked until the dispatch function returns. | |
| 1168 | 1230 | func (x *Source) SetCanRecurse(CanRecurseVar bool) { | |
| 1169 | 1231 | ||
| @@ -1173,23 +1235,26 @@ func (x *Source) SetCanRecurse(CanRecurseVar bool) { | |||
| 1173 | 1235 | ||
| 1174 | 1236 | var xSourceSetDisposeFunction func(uintptr, uintptr) | |
| 1175 | 1237 | ||
| 1176 | - | // Set @dispose as dispose function on @source. @dispose will be called once | |
| 1177 | - | // the reference count of @source reaches 0 but before any of the state of the | |
| 1178 | - | // source is freed, especially before the finalize function is called. | |
| 1238 | + | // Set @dispose as dispose function on @source. | |
| 1239 | + | // | |
| 1240 | + | // The @dispose function will be called once the reference count of @source | |
| 1241 | + | // reaches zero but before any of the state of the source is freed, especially | |
| 1242 | + | // before the finalize function (set as part of the [type@GLib.SourceFuncs]) is | |
| 1243 | + | // called. | |
| 1179 | 1244 | // | |
| 1180 | 1245 | // This means that at this point @source is still a valid [struct@GLib.Source] | |
| 1181 | 1246 | // and it is allow for the reference count to increase again until @dispose | |
| 1182 | 1247 | // returns. | |
| 1183 | 1248 | // | |
| 1184 | - | // The dispose function can be used to clear any "weak" references to the | |
| 1185 | - | // @source in other data structures in a thread-safe way where it is possible | |
| 1186 | - | // for another thread to increase the reference count of @source again while | |
| 1187 | - | // it is being freed. | |
| 1249 | + | // The dispose function can be used to clear any ‘weak’ references to | |
| 1250 | + | // the @source in other data structures in a thread-safe way where it is | |
| 1251 | + | // possible for another thread to increase the reference count of @source again | |
| 1252 | + | // while it is being freed. | |
| 1188 | 1253 | // | |
| 1189 | - | // The finalize function can not be used for this purpose as at that point | |
| 1190 | - | // @source is already partially freed and not valid anymore. | |
| 1254 | + | // The finalize function can not be used for this purpose as at that | |
| 1255 | + | // point @source is already partially freed and not valid any more. | |
| 1191 | 1256 | // | |
| 1192 | - | // This should only ever be called from #GSource implementations. | |
| 1257 | + | // This should only ever be called from [struct@GLib.Source] implementations. | |
| 1193 | 1258 | func (x *Source) SetDisposeFunction(DisposeVar *SourceDisposeFunc) { | |
| 1194 | 1259 | ||
| 1195 | 1260 | xSourceSetDisposeFunction(x.GoPointer(), NewCallback(DisposeVar)) | |
| @@ -1198,8 +1263,10 @@ func (x *Source) SetDisposeFunction(DisposeVar *SourceDisposeFunc) { | |||
| 1198 | 1263 | ||
| 1199 | 1264 | var xSourceSetFuncs func(uintptr, *SourceFuncs) | |
| 1200 | 1265 | ||
| 1201 | - | // Sets the source functions (can be used to override | |
| 1202 | - | // default implementations) of an unattached source. | |
| 1266 | + | // Sets the source functions of an unattached source. | |
| 1267 | + | // | |
| 1268 | + | // These can be used to override the default implementations for the type | |
| 1269 | + | // of @source. | |
| 1203 | 1270 | func (x *Source) SetFuncs(FuncsVar *SourceFuncs) { | |
| 1204 | 1271 | ||
| 1205 | 1272 | xSourceSetFuncs(x.GoPointer(), FuncsVar) | |
| @@ -1209,16 +1276,18 @@ func (x *Source) SetFuncs(FuncsVar *SourceFuncs) { | |||
| 1209 | 1276 | var xSourceSetName func(uintptr, string) | |
| 1210 | 1277 | ||
| 1211 | 1278 | // Sets a name for the source, used in debugging and profiling. | |
| 1212 | - | // The name defaults to #NULL. | |
| 1279 | + | // | |
| 1280 | + | // The name defaults to `NULL`. | |
| 1213 | 1281 | // | |
| 1214 | 1282 | // The source name should describe in a human-readable way | |
| 1215 | - | // what the source does. For example, "X11 event queue" | |
| 1216 | - | // or "GTK repaint idle handler" or whatever it is. | |
| 1283 | + | // what the source does. For example, ‘X11 event queue’ | |
| 1284 | + | // or ‘GTK repaint idle handler’. | |
| 1217 | 1285 | // | |
| 1218 | 1286 | // It is permitted to call this function multiple times, but is not | |
| 1219 | 1287 | // recommended due to the potential performance impact. For example, | |
| 1220 | - | // one could change the name in the "check" function of a #GSourceFuncs | |
| 1221 | - | // to include details like the event type in the source name. | |
| 1288 | + | // one could change the name in the `check` function of a | |
| 1289 | + | // [struct@GLib.SourceFuncs] to include details like the event type in the | |
| 1290 | + | // source name. | |
| 1222 | 1291 | // | |
| 1223 | 1292 | // Use caution if changing the name while another thread may be | |
| 1224 | 1293 | // accessing it with [method@GLib.Source.get_name]; that function does not copy | |
| @@ -1234,7 +1303,9 @@ func (x *Source) SetName(NameVar string) { | |||
| 1234 | 1303 | ||
| 1235 | 1304 | var xSourceSetPriority func(uintptr, int) | |
| 1236 | 1305 | ||
| 1237 | - | // Sets the priority of a source. While the main loop is being run, a | |
| 1306 | + | // Sets the priority of a source. | |
| 1307 | + | // | |
| 1308 | + | // While the main loop is being run, a | |
| 1238 | 1309 | // source will be dispatched if it is ready to be dispatched and no | |
| 1239 | 1310 | // sources at a higher (numerically smaller) priority are ready to be | |
| 1240 | 1311 | // dispatched. | |
| @@ -1250,12 +1321,14 @@ func (x *Source) SetPriority(PriorityVar int) { | |||
| 1250 | 1321 | ||
| 1251 | 1322 | var xSourceSetReadyTime func(uintptr, int64) | |
| 1252 | 1323 | ||
| 1253 | - | // Sets a #GSource to be dispatched when the given monotonic time is | |
| 1254 | - | // reached (or passed). If the monotonic time is in the past (as it | |
| 1255 | - | // always will be if @ready_time is 0) then the source will be | |
| 1324 | + | // Sets a source to be dispatched when the given monotonic time is | |
| 1325 | + | // reached (or passed). | |
| 1326 | + | // | |
| 1327 | + | // If the monotonic time is in the past (as it | |
| 1328 | + | // always will be if @ready_time is `0`) then the source will be | |
| 1256 | 1329 | // dispatched immediately. | |
| 1257 | 1330 | // | |
| 1258 | - | // If @ready_time is -1 then the source is never woken up on the basis | |
| 1331 | + | // If @ready_time is `-1` then the source is never woken up on the basis | |
| 1259 | 1332 | // of the passage of time. | |
| 1260 | 1333 | // | |
| 1261 | 1334 | // Dispatching the source does not reset the ready time. You should do | |
| @@ -1267,11 +1340,11 @@ var xSourceSetReadyTime func(uintptr, int64) | |||
| 1267 | 1340 | // for both sources is reached during the same main context iteration, | |
| 1268 | 1341 | // then the order of dispatch is undefined. | |
| 1269 | 1342 | // | |
| 1270 | - | // It is a no-op to call this function on a #GSource which has already been | |
| 1271 | - | // destroyed with [method@GLib.Source.destroy]. | |
| 1343 | + | // It is a no-op to call this function on a [struct@GLib.Source] which has | |
| 1344 | + | // already been destroyed with [method@GLib.Source.destroy]. | |
| 1272 | 1345 | // | |
| 1273 | - | // This API is only intended to be used by implementations of #GSource. | |
| 1274 | - | // Do not call this API on a #GSource that you did not create. | |
| 1346 | + | // This API is only intended to be used by implementations of [struct@GLib.Source]. | |
| 1347 | + | // Do not call this API on a [struct@GLib.Source] that you did not create. | |
| 1275 | 1348 | func (x *Source) SetReadyTime(ReadyTimeVar int64) { | |
| 1276 | 1349 | ||
| 1277 | 1350 | xSourceSetReadyTime(x.GoPointer(), ReadyTimeVar) | |
| @@ -1291,8 +1364,9 @@ func (x *Source) SetStaticName(NameVar string) { | |||
| 1291 | 1364 | ||
| 1292 | 1365 | var xSourceUnref func(uintptr) | |
| 1293 | 1366 | ||
| 1294 | - | // Decreases the reference count of a source by one. If the | |
| 1295 | - | // resulting reference count is zero the source and associated | |
| 1367 | + | // Decreases the reference count of a source by one. | |
| 1368 | + | // | |
| 1369 | + | // If the resulting reference count is zero the source and associated | |
| 1296 | 1370 | // memory will be destroyed. | |
| 1297 | 1371 | func (x *Source) Unref() { | |
| 1298 | 1372 | ||
| @@ -1503,15 +1577,15 @@ var xChildWatchAdd func(Pid, uintptr, uintptr) uint | |||
| 1503 | 1577 | // | |
| 1504 | 1578 | // If you obtain @pid from [func@GLib.spawn_async] or | |
| 1505 | 1579 | // [func@GLib.spawn_async_with_pipes] you will need to pass | |
| 1506 | - | // %G_SPAWN_DO_NOT_REAP_CHILD as flag to the spawn function for the child | |
| 1507 | - | // watching to work. | |
| 1580 | + | // [flags@GLib.SpawnFlags.DO_NOT_REAP_CHILD] as a flag to the spawn function for | |
| 1581 | + | // the child watching to work. | |
| 1508 | 1582 | // | |
| 1509 | - | // Note that on platforms where #GPid must be explicitly closed | |
| 1583 | + | // Note that on platforms where [type@GLib.Pid] must be explicitly closed | |
| 1510 | 1584 | // (see [func@GLib.spawn_close_pid]) @pid must not be closed while the | |
| 1511 | 1585 | // source is still active. Typically, you will want to call | |
| 1512 | 1586 | // [func@GLib.spawn_close_pid] in the callback function for the source. | |
| 1513 | 1587 | // | |
| 1514 | - | // GLib supports only a single callback per process id. | |
| 1588 | + | // GLib supports only a single callback per process ID. | |
| 1515 | 1589 | // On POSIX platforms, the same restrictions mentioned for | |
| 1516 | 1590 | // [func@GLib.child_watch_source_new] apply to this function. | |
| 1517 | 1591 | // | |
| @@ -1532,19 +1606,19 @@ var xChildWatchAddFull func(int, Pid, uintptr, uintptr, uintptr) uint | |||
| 1532 | 1606 | // | |
| 1533 | 1607 | // If you obtain @pid from [func@GLib.spawn_async] or | |
| 1534 | 1608 | // [func@GLib.spawn_async_with_pipes] you will need to pass | |
| 1535 | - | // %G_SPAWN_DO_NOT_REAP_CHILD as flag to the spawn function for the child | |
| 1536 | - | // watching to work. | |
| 1609 | + | // [flags@GLib.SpawnFlags.DO_NOT_REAP_CHILD] as a flag to the spawn function for | |
| 1610 | + | // the child watching to work. | |
| 1537 | 1611 | // | |
| 1538 | 1612 | // In many programs, you will want to call [func@GLib.spawn_check_wait_status] | |
| 1539 | 1613 | // in the callback to determine whether or not the child exited | |
| 1540 | 1614 | // successfully. | |
| 1541 | 1615 | // | |
| 1542 | - | // Also, note that on platforms where #GPid must be explicitly closed | |
| 1616 | + | // Also, note that on platforms where [type@GLib.Pid] must be explicitly closed | |
| 1543 | 1617 | // (see [func@GLib.spawn_close_pid]) @pid must not be closed while the source | |
| 1544 | 1618 | // is still active. Typically, you should invoke [func@GLib.spawn_close_pid] | |
| 1545 | 1619 | // in the callback function for the source. | |
| 1546 | 1620 | // | |
| 1547 | - | // GLib supports only a single callback per process id. | |
| 1621 | + | // GLib supports only a single callback per process ID. | |
| 1548 | 1622 | // On POSIX platforms, the same restrictions mentioned for | |
| 1549 | 1623 | // [func@GLib.child_watch_source_new] apply to this function. | |
| 1550 | 1624 | // | |
| @@ -1560,16 +1634,16 @@ func ChildWatchAddFull(PriorityVar int, PidVar Pid, FunctionVar *ChildWatchFunc, | |||
| 1560 | 1634 | ||
| 1561 | 1635 | var xChildWatchSourceNew func(Pid) *Source | |
| 1562 | 1636 | ||
| 1563 | - | // Creates a new child_watch source. | |
| 1637 | + | // Creates a new child watch source. | |
| 1564 | 1638 | // | |
| 1565 | 1639 | // The source will not initially be associated with any | |
| 1566 | 1640 | // [struct@GLib.MainContext] and must be added to one with | |
| 1567 | 1641 | // [method@GLib.Source.attach] before it will be executed. | |
| 1568 | 1642 | // | |
| 1569 | 1643 | // Note that child watch sources can only be used in conjunction with | |
| 1570 | - | // `g_spawn...` when the %G_SPAWN_DO_NOT_REAP_CHILD flag is used. | |
| 1644 | + | // `g_spawn...` when the [flags@GLib.SpawnFlags.DO_NOT_REAP_CHILD] flag is used. | |
| 1571 | 1645 | // | |
| 1572 | - | // Note that on platforms where #GPid must be explicitly closed | |
| 1646 | + | // Note that on platforms where [type@GLib.Pid] must be explicitly closed | |
| 1573 | 1647 | // (see [func@GLib.spawn_close_pid]) @pid must not be closed while the | |
| 1574 | 1648 | // source is still active. Typically, you will want to call | |
| 1575 | 1649 | // [func@GLib.spawn_close_pid] in the callback function for the source. | |
| @@ -1577,29 +1651,29 @@ var xChildWatchSourceNew func(Pid) *Source | |||
| 1577 | 1651 | // On POSIX platforms, the following restrictions apply to this API | |
| 1578 | 1652 | // due to limitations in POSIX process interfaces: | |
| 1579 | 1653 | // | |
| 1580 | - | // - @pid must be a child of this process | |
| 1581 | - | // - @pid must be positive | |
| 1582 | - | // - the application must not call `waitpid` with a non-positive | |
| 1583 | - | // first argument, for instance in another thread | |
| 1584 | - | // - the application must not wait for @pid to exit by any other | |
| 1654 | + | // - @pid must be a child of this process. | |
| 1655 | + | // - @pid must be positive. | |
| 1656 | + | // - The application must not call [`waitpid()`](man:waitpid(1)) with a | |
| 1657 | + | // non-positive first argument, for instance in another thread. | |
| 1658 | + | // - The application must not wait for @pid to exit by any other | |
| 1585 | 1659 | // mechanism, including `waitpid(pid, ...)` or a second child-watch | |
| 1586 | - | // source for the same @pid | |
| 1587 | - | // - the application must not ignore `SIGCHLD` | |
| 1588 | - | // - Before 2.78, the application could not send a signal (`kill()`) to the | |
| 1660 | + | // source for the same @pid. | |
| 1661 | + | // - The application must not ignore `SIGCHLD`. | |
| 1662 | + | // - Before 2.78, the application could not send a signal ([`kill()`](man:kill(2))) to the | |
| 1589 | 1663 | // watched @pid in a race free manner. Since 2.78, you can do that while the | |
| 1590 | 1664 | // associated [struct@GLib.MainContext] is acquired. | |
| 1591 | 1665 | // - Before 2.78, even after destroying the [struct@GLib.Source], you could not | |
| 1592 | - | // be sure that @pid wasn't already reaped. Hence, it was also not | |
| 1666 | + | // be sure that @pid wasn’t already reaped. Hence, it was also not | |
| 1593 | 1667 | // safe to `kill()` or `waitpid()` on the process ID after the child watch | |
| 1594 | 1668 | // source was gone. Destroying the source before it fired made it | |
| 1595 | 1669 | // impossible to reliably reap the process. | |
| 1596 | 1670 | // | |
| 1597 | 1671 | // If any of those conditions are not met, this and related APIs will | |
| 1598 | 1672 | // not work correctly. This can often be diagnosed via a GLib warning | |
| 1599 | - | // stating that `ECHILD` was received by `waitpid`. | |
| 1673 | + | // stating that `ECHILD` was received by `waitpid()`. | |
| 1600 | 1674 | // | |
| 1601 | - | // Calling `waitpid` for specific processes other than @pid remains a | |
| 1602 | - | // valid thing to do. | |
| 1675 | + | // Calling [`waitpid()`](man:waitpid(2)) for specific processes other than @pid | |
| 1676 | + | // remains a valid thing to do. | |
| 1603 | 1677 | func ChildWatchSourceNew(PidVar Pid) *Source { | |
| 1604 | 1678 | ||
| 1605 | 1679 | cret := xChildWatchSourceNew(PidVar) | |
| @@ -1608,9 +1682,9 @@ func ChildWatchSourceNew(PidVar Pid) *Source { | |||
| 1608 | 1682 | ||
| 1609 | 1683 | var xClearHandleId func(uint, uintptr) | |
| 1610 | 1684 | ||
| 1611 | - | // Clears a numeric handler, such as a #GSource ID. | |
| 1685 | + | // Clears a numeric handler, such as a [struct@GLib.Source] ID. | |
| 1612 | 1686 | // | |
| 1613 | - | // @tag_ptr must be a valid pointer to the variable holding the handler. | |
| 1687 | + | // The @tag_ptr must be a valid pointer to the variable holding the handler. | |
| 1614 | 1688 | // | |
| 1615 | 1689 | // If the ID is zero then this function does nothing. | |
| 1616 | 1690 | // Otherwise, @clear_func is called with the ID as a parameter, and the tag is | |
| @@ -1626,7 +1700,10 @@ func ClearHandleId(TagPtrVar uint, ClearFuncVar *ClearHandleFunc) { | |||
| 1626 | 1700 | ||
| 1627 | 1701 | var xGetCurrentTime func(*TimeVal) | |
| 1628 | 1702 | ||
| 1629 | - | // Equivalent to the UNIX gettimeofday() function, but portable. | |
| 1703 | + | // Queries the system wall-clock time. | |
| 1704 | + | // | |
| 1705 | + | // This is equivalent to the UNIX [`gettimeofday()`](man:gettimeofday(2)) | |
| 1706 | + | // function, but portable. | |
| 1630 | 1707 | // | |
| 1631 | 1708 | // You may find [func@GLib.get_real_time] to be more convenient. | |
| 1632 | 1709 | func GetCurrentTime(ResultVar *TimeVal) { | |
| @@ -1639,13 +1716,14 @@ var xGetMonotonicTime func() int64 | |||
| 1639 | 1716 | ||
| 1640 | 1717 | // Queries the system monotonic time. | |
| 1641 | 1718 | // | |
| 1642 | - | // The monotonic clock will always increase and doesn't suffer | |
| 1719 | + | // The monotonic clock will always increase and doesn’t suffer | |
| 1643 | 1720 | // discontinuities when the user (or NTP) changes the system time. It | |
| 1644 | 1721 | // may or may not continue to tick during times where the machine is | |
| 1645 | 1722 | // suspended. | |
| 1646 | 1723 | // | |
| 1647 | 1724 | // We try to use the clock that corresponds as closely as possible to | |
| 1648 | - | // the passage of time as measured by system calls such as poll() but it | |
| 1725 | + | // the passage of time as measured by system calls such as | |
| 1726 | + | // [`poll()`](man:poll(2)) but it | |
| 1649 | 1727 | // may not always be possible to do this. | |
| 1650 | 1728 | func GetMonotonicTime() int64 { | |
| 1651 | 1729 | ||
| @@ -1657,9 +1735,8 @@ var xGetRealTime func() int64 | |||
| 1657 | 1735 | ||
| 1658 | 1736 | // Queries the system wall-clock time. | |
| 1659 | 1737 | // | |
| 1660 | - | // This call is functionally equivalent to [func@GLib.get_current_time] except | |
| 1661 | - | // that the return value is often more convenient than dealing with a | |
| 1662 | - | // #GTimeVal. | |
| 1738 | + | // This is equivalent to the UNIX [`gettimeofday()`](man:gettimeofday(2)) | |
| 1739 | + | // function, but portable. | |
| 1663 | 1740 | // | |
| 1664 | 1741 | // You should only use this call if you are actually interested in the real | |
| 1665 | 1742 | // wall-clock time. [func@GLib.get_monotonic_time] is probably more useful for | |
| @@ -1673,12 +1750,14 @@ func GetRealTime() int64 { | |||
| 1673 | 1750 | var xIdleAdd func(uintptr, uintptr) uint | |
| 1674 | 1751 | ||
| 1675 | 1752 | // Adds a function to be called whenever there are no higher priority | |
| 1676 | - | // events pending to the default main loop. The function is given the | |
| 1753 | + | // events pending to the default main loop. | |
| 1754 | + | // | |
| 1755 | + | // The function is given the | |
| 1677 | 1756 | // default idle priority, [const@GLib.PRIORITY_DEFAULT_IDLE]. If the function | |
| 1678 | - | // returns %FALSE it is automatically removed from the list of event | |
| 1679 | - | // sources and will not be called again. | |
| 1757 | + | // returns [const@GLib.SOURCE_REMOVE] it is automatically removed from the list | |
| 1758 | + | // of event sources and will not be called again. | |
| 1680 | 1759 | // | |
| 1681 | - | // See [mainloop memory management](main-loop.html#memory-management-of-sources) for details | |
| 1760 | + | // See [main loop memory management](main-loop.html#memory-management-of-sources) for details | |
| 1682 | 1761 | // on how to handle the return value and memory management of @data. | |
| 1683 | 1762 | // | |
| 1684 | 1763 | // This internally creates a main loop source using [func@GLib.idle_source_new] | |
| @@ -1697,10 +1776,10 @@ var xIdleAddFull func(int, uintptr, uintptr, uintptr) uint | |||
| 1697 | 1776 | // Adds a function to be called whenever there are no higher priority | |
| 1698 | 1777 | // events pending. | |
| 1699 | 1778 | // | |
| 1700 | - | // If the function returns [const@GLib.SOURCE_REMOVE] or %FALSE it is automatically | |
| 1779 | + | // If the function returns [const@GLib.SOURCE_REMOVE] it is automatically | |
| 1701 | 1780 | // removed from the list of event sources and will not be called again. | |
| 1702 | 1781 | // | |
| 1703 | - | // See [mainloop memory management](main-loop.html#memory-management-of-sources) for details | |
| 1782 | + | // See [main loop memory management](main-loop.html#memory-management-of-sources) for details | |
| 1704 | 1783 | // on how to handle the return value and memory management of @data. | |
| 1705 | 1784 | // | |
| 1706 | 1785 | // This internally creates a main loop source using [func@GLib.idle_source_new] | |
| @@ -1717,7 +1796,9 @@ func IdleAddFull(PriorityVar int, FunctionVar *SourceFunc, DataVar uintptr, Noti | |||
| 1717 | 1796 | var xIdleAddOnce func(uintptr, uintptr) uint | |
| 1718 | 1797 | ||
| 1719 | 1798 | // Adds a function to be called whenever there are no higher priority | |
| 1720 | - | // events pending to the default main loop. The function is given the | |
| 1799 | + | // events pending to the default main loop. | |
| 1800 | + | // | |
| 1801 | + | // The function is given the | |
| 1721 | 1802 | // default idle priority, [const@GLib.PRIORITY_DEFAULT_IDLE]. | |
| 1722 | 1803 | // | |
| 1723 | 1804 | // The function will only be called once and then the source will be | |
| @@ -1757,9 +1838,11 @@ func IdleSourceNew() *Source { | |||
| 1757 | 1838 | ||
| 1758 | 1839 | var xMainContextDefault func() *MainContext | |
| 1759 | 1840 | ||
| 1760 | - | // Returns the global-default main context. This is the main context | |
| 1841 | + | // Returns the global-default main context. | |
| 1842 | + | // | |
| 1843 | + | // This is the main context | |
| 1761 | 1844 | // used for main loop functions when a main loop is not explicitly | |
| 1762 | - | // specified, and corresponds to the "main" main loop. See also | |
| 1845 | + | // specified, and corresponds to the ‘main’ main loop. See also | |
| 1763 | 1846 | // [func@GLib.MainContext.get_thread_default]. | |
| 1764 | 1847 | func MainContextDefault() *MainContext { | |
| 1765 | 1848 | ||
| @@ -1769,14 +1852,15 @@ func MainContextDefault() *MainContext { | |||
| 1769 | 1852 | ||
| 1770 | 1853 | var xMainContextGetThreadDefault func() *MainContext | |
| 1771 | 1854 | ||
| 1772 | - | // Gets the thread-default #GMainContext for this thread. Asynchronous | |
| 1773 | - | // operations that want to be able to be run in contexts other than | |
| 1855 | + | // Gets the thread-default main context for this thread. | |
| 1856 | + | // | |
| 1857 | + | // Asynchronous operations that want to be able to be run in contexts other than | |
| 1774 | 1858 | // the default one should call this method or | |
| 1775 | 1859 | // [func@GLib.MainContext.ref_thread_default] to get a | |
| 1776 | 1860 | // [struct@GLib.MainContext] to add their [struct@GLib.Source]s to. (Note that | |
| 1777 | 1861 | // even in single-threaded programs applications may sometimes want to | |
| 1778 | 1862 | // temporarily push a non-default context, so it is not safe to assume that | |
| 1779 | - | // this will always return %NULL if you are running in the default thread.) | |
| 1863 | + | // this will always return `NULL` if you are running in the default thread.) | |
| 1780 | 1864 | // | |
| 1781 | 1865 | // If you need to hold a reference on the context, use | |
| 1782 | 1866 | // [func@GLib.MainContext.ref_thread_default] instead. | |
| @@ -1788,13 +1872,16 @@ func MainContextGetThreadDefault() *MainContext { | |||
| 1788 | 1872 | ||
| 1789 | 1873 | var xMainContextRefThreadDefault func() *MainContext | |
| 1790 | 1874 | ||
| 1791 | - | // Gets the thread-default [struct@GLib.MainContext] for this thread, as with | |
| 1792 | - | // [func@GLib.MainContext.get_thread_default], but also adds a reference to | |
| 1793 | - | // it with [method@GLib.MainContext.ref]. In addition, unlike | |
| 1875 | + | // Gets a reference to the thread-default [struct@GLib.MainContext] for this | |
| 1876 | + | // thread | |
| 1877 | + | // | |
| 1878 | + | // This is the same as [func@GLib.MainContext.get_thread_default], but it also | |
| 1879 | + | // adds a reference to the returned main context with [method@GLib.MainContext.ref]. | |
| 1880 | + | // In addition, unlike | |
| 1794 | 1881 | // [func@GLib.MainContext.get_thread_default], if the thread-default context | |
| 1795 | 1882 | // is the global-default context, this will return that | |
| 1796 | 1883 | // [struct@GLib.MainContext] (with a ref added to it) rather than returning | |
| 1797 | - | // %NULL. | |
| 1884 | + | // `NULL`. | |
| 1798 | 1885 | func MainContextRefThreadDefault() *MainContext { | |
| 1799 | 1886 | ||
| 1800 | 1887 | cret := xMainContextRefThreadDefault() | |
| @@ -1814,16 +1901,17 @@ var xMainDepth func() int | |||
| 1814 | 1901 | ||
| 1815 | 1902 | // Returns the depth of the stack of calls to | |
| 1816 | 1903 | // [method@GLib.MainContext.dispatch] on any #GMainContext in the current thread. | |
| 1817 | - | // That is, when called from the toplevel, it gives 0. When | |
| 1904 | + | // | |
| 1905 | + | // That is, when called from the top level, it gives `0`. When | |
| 1818 | 1906 | // called from within a callback from [method@GLib.MainContext.iteration] | |
| 1819 | - | // (or [method@GLib.MainLoop.run], etc.) it returns 1. When called from within | |
| 1907 | + | // (or [method@GLib.MainLoop.run], etc.) it returns `1`. When called from within | |
| 1820 | 1908 | // a callback to a recursive call to [method@GLib.MainContext.iteration], | |
| 1821 | - | // it returns 2. And so forth. | |
| 1909 | + | // it returns `2`. And so forth. | |
| 1822 | 1910 | // | |
| 1823 | 1911 | // This function is useful in a situation like the following: | |
| 1824 | - | // Imagine an extremely simple "garbage collected" system. | |
| 1912 | + | // Imagine an extremely simple ‘garbage collected’ system. | |
| 1825 | 1913 | // | |
| 1826 | - | // |[<!-- language="C" --> | |
| 1914 | + | // ```c | |
| 1827 | 1915 | // static GList *free_list; | |
| 1828 | 1916 | // | |
| 1829 | 1917 | // gpointer | |
| @@ -1855,16 +1943,16 @@ var xMainDepth func() int | |||
| 1855 | 1943 | // free_allocated_memory(); | |
| 1856 | 1944 | // } | |
| 1857 | 1945 | // | |
| 1858 | - | // ]| | |
| 1946 | + | // ``` | |
| 1859 | 1947 | // | |
| 1860 | 1948 | // This works from an application, however, if you want to do the same | |
| 1861 | 1949 | // thing from a library, it gets more difficult, since you no longer | |
| 1862 | 1950 | // control the main loop. You might think you can simply use an idle | |
| 1863 | - | // function to make the call to free_allocated_memory(), but that | |
| 1864 | - | // doesn't work, since the idle function could be called from a | |
| 1951 | + | // function to make the call to `free_allocated_memory()`, but that | |
| 1952 | + | // doesn’t work, since the idle function could be called from a | |
| 1865 | 1953 | // recursive callback. This can be fixed by using [func@GLib.main_depth] | |
| 1866 | 1954 | // | |
| 1867 | - | // |[<!-- language="C" --> | |
| 1955 | + | // ```c | |
| 1868 | 1956 | // gpointer | |
| 1869 | 1957 | // allocate_memory (gsize size) | |
| 1870 | 1958 | // | |
| @@ -1898,25 +1986,25 @@ var xMainDepth func() int | |||
| 1898 | 1986 | // } | |
| 1899 | 1987 | // } | |
| 1900 | 1988 | // | |
| 1901 | - | // ]| | |
| 1989 | + | // ``` | |
| 1902 | 1990 | // | |
| 1903 | 1991 | // There is a temptation to use [func@GLib.main_depth] to solve | |
| 1904 | 1992 | // problems with reentrancy. For instance, while waiting for data | |
| 1905 | 1993 | // to be received from the network in response to a menu item, | |
| 1906 | 1994 | // the menu item might be selected again. It might seem that | |
| 1907 | - | // one could make the menu item's callback return immediately | |
| 1995 | + | // one could make the menu item’s callback return immediately | |
| 1908 | 1996 | // and do nothing if [func@GLib.main_depth] returns a value greater than 1. | |
| 1909 | 1997 | // However, this should be avoided since the user then sees selecting | |
| 1910 | - | // the menu item do nothing. Furthermore, you'll find yourself adding | |
| 1998 | + | // the menu item do nothing. Furthermore, you’ll find yourself adding | |
| 1911 | 1999 | // these checks all over your code, since there are doubtless many, | |
| 1912 | 2000 | // many things that the user could do. Instead, you can use the | |
| 1913 | 2001 | // following techniques: | |
| 1914 | 2002 | // | |
| 1915 | - | // 1. Use gtk_widget_set_sensitive() or modal dialogs to prevent | |
| 2003 | + | // 1. Use `gtk_widget_set_sensitive()` or modal dialogs to prevent | |
| 1916 | 2004 | // the user from interacting with elements while the main | |
| 1917 | 2005 | // loop is recursing. | |
| 1918 | 2006 | // | |
| 1919 | - | // 2. Avoid main loop recursion in situations where you can't handle | |
| 2007 | + | // 2. Avoid main loop recursion in situations where you can’t handle | |
| 1920 | 2008 | // arbitrary callbacks. Instead, structure your code so that you | |
| 1921 | 2009 | // simply return to the main loop and then get called again when | |
| 1922 | 2010 | // there is more work to do. | |
| @@ -1928,10 +2016,12 @@ func MainDepth() int { | |||
| 1928 | 2016 | ||
| 1929 | 2017 | var xSourceRemove func(uint) bool | |
| 1930 | 2018 | ||
| 1931 | - | // Removes the source with the given ID from the default main context. You must | |
| 2019 | + | // Removes the source with the given ID from the default main context. | |
| 2020 | + | // | |
| 2021 | + | // You must | |
| 1932 | 2022 | // use [method@GLib.Source.destroy] for sources added to a non-default main context. | |
| 1933 | 2023 | // | |
| 1934 | - | // The ID of a #GSource is given by [method@GLib.Source.get_id], or will be | |
| 2024 | + | // The ID of a [struct@GLib.Source] is given by [method@GLib.Source.get_id], or will be | |
| 1935 | 2025 | // returned by the functions [method@GLib.Source.attach], [func@GLib.idle_add], | |
| 1936 | 2026 | // [func@GLib.idle_add_full], [func@GLib.timeout_add], | |
| 1937 | 2027 | // [func@GLib.timeout_add_full], [func@GLib.child_watch_add], | |
| @@ -1957,8 +2047,10 @@ func SourceRemove(TagVar uint) bool { | |||
| 1957 | 2047 | var xSourceRemoveByFuncsUserData func(*SourceFuncs, uintptr) bool | |
| 1958 | 2048 | ||
| 1959 | 2049 | // Removes a source from the default main loop context given the | |
| 1960 | - | // source functions and user data. If multiple sources exist with the | |
| 1961 | - | // same source functions and user data, only one will be destroyed. | |
| 2050 | + | // source functions and user data. | |
| 2051 | + | // | |
| 2052 | + | // If multiple sources exist with the same source functions and user data, only | |
| 2053 | + | // one will be destroyed. | |
| 1962 | 2054 | func SourceRemoveByFuncsUserData(FuncsVar *SourceFuncs, UserDataVar uintptr) bool { | |
| 1963 | 2055 | ||
| 1964 | 2056 | cret := xSourceRemoveByFuncsUserData(FuncsVar, UserDataVar) | |
| @@ -1968,8 +2060,9 @@ func SourceRemoveByFuncsUserData(FuncsVar *SourceFuncs, UserDataVar uintptr) boo | |||
| 1968 | 2060 | var xSourceRemoveByUserData func(uintptr) bool | |
| 1969 | 2061 | ||
| 1970 | 2062 | // Removes a source from the default main loop context given the user | |
| 1971 | - | // data for the callback. If multiple sources exist with the same user | |
| 1972 | - | // data, only one will be destroyed. | |
| 2063 | + | // data for the callback. | |
| 2064 | + | // | |
| 2065 | + | // If multiple sources exist with the same user data, only one will be destroyed. | |
| 1973 | 2066 | func SourceRemoveByUserData(UserDataVar uintptr) bool { | |
| 1974 | 2067 | ||
| 1975 | 2068 | cret := xSourceRemoveByUserData(UserDataVar) | |
| @@ -2006,7 +2099,7 @@ var xTimeoutAdd func(uint, uintptr, uintptr) uint | |||
| 2006 | 2099 | // priority, [const@GLib.PRIORITY_DEFAULT]. | |
| 2007 | 2100 | // | |
| 2008 | 2101 | // The given @function is called repeatedly until it returns | |
| 2009 | - | // [const@GLib.SOURCE_REMOVE] or %FALSE, at which point the timeout is | |
| 2102 | + | // [const@GLib.SOURCE_REMOVE], at which point the timeout is | |
| 2010 | 2103 | // automatically destroyed and the function will not be called again. The first | |
| 2011 | 2104 | // call to the function will be at the end of the first @interval. | |
| 2012 | 2105 | // | |
| @@ -2014,12 +2107,12 @@ var xTimeoutAdd func(uint, uintptr, uintptr) uint | |||
| 2014 | 2107 | // event sources. Thus they should not be relied on for precise timing. | |
| 2015 | 2108 | // After each call to the timeout function, the time of the next | |
| 2016 | 2109 | // timeout is recalculated based on the current time and the given interval | |
| 2017 | - | // (it does not try to 'catch up' time lost in delays). | |
| 2110 | + | // (it does not try to ‘catch up’ time lost in delays). | |
| 2018 | 2111 | // | |
| 2019 | - | // See [mainloop memory management](main-loop.html#memory-management-of-sources) for details | |
| 2112 | + | // See [main loop memory management](main-loop.html#memory-management-of-sources) for details | |
| 2020 | 2113 | // on how to handle the return value and memory management of @data. | |
| 2021 | 2114 | // | |
| 2022 | - | // If you want to have a timer in the "seconds" range and do not care | |
| 2115 | + | // If you want to have a timer in the ‘seconds’ range and do not care | |
| 2023 | 2116 | // about the exact time of the first call of the timer, use the | |
| 2024 | 2117 | // [func@GLib.timeout_add_seconds] function; this function allows for more | |
| 2025 | 2118 | // optimizations and more efficient system power usage. | |
| @@ -2044,8 +2137,11 @@ func TimeoutAdd(IntervalVar uint, FunctionVar *SourceFunc, DataVar uintptr) uint | |||
| 2044 | 2137 | var xTimeoutAddFull func(int, uint, uintptr, uintptr, uintptr) uint | |
| 2045 | 2138 | ||
| 2046 | 2139 | // Sets a function to be called at regular intervals, with the given | |
| 2047 | - | // priority. The function is called repeatedly until it returns | |
| 2048 | - | // %FALSE, at which point the timeout is automatically destroyed and | |
| 2140 | + | // priority. | |
| 2141 | + | // | |
| 2142 | + | // The function is called repeatedly until it returns | |
| 2143 | + | // [const@GLib.SOURCE_REMOVE], at which point the timeout is automatically | |
| 2144 | + | // destroyed and | |
| 2049 | 2145 | // the function will not be called again. The @notify function is | |
| 2050 | 2146 | // called when the timeout is destroyed. The first call to the | |
| 2051 | 2147 | // function will be at the end of the first @interval. | |
| @@ -2054,9 +2150,9 @@ var xTimeoutAddFull func(int, uint, uintptr, uintptr, uintptr) uint | |||
| 2054 | 2150 | // event sources. Thus they should not be relied on for precise timing. | |
| 2055 | 2151 | // After each call to the timeout function, the time of the next | |
| 2056 | 2152 | // timeout is recalculated based on the current time and the given interval | |
| 2057 | - | // (it does not try to 'catch up' time lost in delays). | |
| 2153 | + | // (it does not try to ‘catch up’ time lost in delays). | |
| 2058 | 2154 | // | |
| 2059 | - | // See [mainloop memory management](main-loop.html#memory-management-of-sources) for details | |
| 2155 | + | // See [main loop memory management](main-loop.html#memory-management-of-sources) for details | |
| 2060 | 2156 | // on how to handle the return value and memory management of @data. | |
| 2061 | 2157 | // | |
| 2062 | 2158 | // This internally creates a main loop source using | |
| @@ -2094,8 +2190,8 @@ var xTimeoutAddSeconds func(uint, uintptr, uintptr) uint | |||
| 2094 | 2190 | // Sets a function to be called at regular intervals with the default | |
| 2095 | 2191 | // priority, [const@GLib.PRIORITY_DEFAULT]. | |
| 2096 | 2192 | // | |
| 2097 | - | // The function is called repeatedly until it returns [const@GLib.SOURCE_REMOVE] | |
| 2098 | - | // or %FALSE, at which point the timeout is automatically destroyed | |
| 2193 | + | // The function is called repeatedly until it returns [const@GLib.SOURCE_REMOVE], | |
| 2194 | + | // at which point the timeout is automatically destroyed | |
| 2099 | 2195 | // and the function will not be called again. | |
| 2100 | 2196 | // | |
| 2101 | 2197 | // This internally creates a main loop source using | |
| @@ -2109,7 +2205,7 @@ var xTimeoutAddSeconds func(uint, uintptr, uintptr) uint | |||
| 2109 | 2205 | // of one second. If you need finer precision and have such a timeout, | |
| 2110 | 2206 | // you may want to use [func@GLib.timeout_add] instead. | |
| 2111 | 2207 | // | |
| 2112 | - | // See [mainloop memory management](main-loop.html#memory-management-of-sources) for details | |
| 2208 | + | // See [main loop memory management](main-loop.html#memory-management-of-sources) for details | |
| 2113 | 2209 | // on how to handle the return value and memory management of @data. | |
| 2114 | 2210 | // | |
| 2115 | 2211 | // The interval given is in terms of monotonic time, not wall clock | |
| @@ -2124,15 +2220,15 @@ var xTimeoutAddSecondsFull func(int, uint, uintptr, uintptr, uintptr) uint | |||
| 2124 | 2220 | ||
| 2125 | 2221 | // Sets a function to be called at regular intervals, with @priority. | |
| 2126 | 2222 | // | |
| 2127 | - | // The function is called repeatedly until it returns [const@GLib.SOURCE_REMOVE] | |
| 2128 | - | // or %FALSE, at which point the timeout is automatically destroyed and | |
| 2223 | + | // The function is called repeatedly until it returns [const@GLib.SOURCE_REMOVE], | |
| 2224 | + | // at which point the timeout is automatically destroyed and | |
| 2129 | 2225 | // the function will not be called again. | |
| 2130 | 2226 | // | |
| 2131 | 2227 | // Unlike [func@GLib.timeout_add], this function operates at whole second | |
| 2132 | 2228 | // granularity. The initial starting point of the timer is determined by the | |
| 2133 | 2229 | // implementation and the implementation is expected to group multiple timers | |
| 2134 | - | // together so that they fire all at the same time. To allow this grouping, the | |
| 2135 | - | // @interval to the first timer is rounded and can deviate up to one second | |
| 2230 | + | // together so that they fire all at the same time. To allow this grouping, | |
| 2231 | + | // the @interval to the first timer is rounded and can deviate up to one second | |
| 2136 | 2232 | // from the specified interval. Subsequent timer iterations will generally run | |
| 2137 | 2233 | // at the specified interval. | |
| 2138 | 2234 | // | |
| @@ -2141,7 +2237,7 @@ var xTimeoutAddSecondsFull func(int, uint, uintptr, uintptr, uintptr) uint | |||
| 2141 | 2237 | // After each call to the timeout function, the time of the next | |
| 2142 | 2238 | // timeout is recalculated based on the current time and the given @interval | |
| 2143 | 2239 | // | |
| 2144 | - | // See [mainloop memory management](main-loop.html#memory-management-of-sources) for details | |
| 2240 | + | // See [main loop memory management](main-loop.html#memory-management-of-sources) for details | |
| 2145 | 2241 | // on how to handle the return value and memory management of @data. | |
| 2146 | 2242 | // | |
| 2147 | 2243 | // If you want timing more precise than whole seconds, use | |
| @@ -2149,7 +2245,7 @@ var xTimeoutAddSecondsFull func(int, uint, uintptr, uintptr, uintptr) uint | |||
| 2149 | 2245 | // | |
| 2150 | 2246 | // The grouping of timers to fire at the same time results in a more power | |
| 2151 | 2247 | // and CPU efficient behavior so if your timer is in multiples of seconds | |
| 2152 | - | // and you don't require the first timer exactly one second from now, the | |
| 2248 | + | // and you don’t require the first timer exactly one second from now, the | |
| 2153 | 2249 | // use of [func@GLib.timeout_add_seconds] is preferred over | |
| 2154 | 2250 | // [func@GLib.timeout_add]. | |
| 2155 | 2251 | // | |
| @@ -2306,6 +2402,7 @@ func init() { | |||
| 2306 | 2402 | core.PuregoSafeRegister(&xSourceAddUnixFd, libs, "g_source_add_unix_fd") | |
| 2307 | 2403 | core.PuregoSafeRegister(&xSourceAttach, libs, "g_source_attach") | |
| 2308 | 2404 | core.PuregoSafeRegister(&xSourceDestroy, libs, "g_source_destroy") | |
| 2405 | + | core.PuregoSafeRegister(&xSourceDupContext, libs, "g_source_dup_context") | |
| 2309 | 2406 | core.PuregoSafeRegister(&xSourceGetCanRecurse, libs, "g_source_get_can_recurse") | |
| 2310 | 2407 | core.PuregoSafeRegister(&xSourceGetContext, libs, "g_source_get_context") | |
| 2311 | 2408 | core.PuregoSafeRegister(&xSourceGetCurrentTime, libs, "g_source_get_current_time") | |
M v4/glib/gmarkup.go +4 -0
| @@ -334,6 +334,10 @@ func (x *MarkupParseContext) Unref() { | |||
| 334 | 334 | // errors are intended to be set from these callbacks. If you set an error | |
| 335 | 335 | // from a callback, g_markup_parse_context_parse() will report that error | |
| 336 | 336 | // back to its caller. | |
| 337 | + | // | |
| 338 | + | // Refer to the [GMarkup](../glib/markup.html) documentation to understand | |
| 339 | + | // the scope and limitations of `GMarkupParser`. In particular, it is not a | |
| 340 | + | // full XML parser and it must not be used to process untrusted data. | |
| 337 | 341 | type MarkupParser struct { | |
| 338 | 342 | _ structs.HostLayout | |
| 339 | 343 | ||
M v4/glib/gmessages.go +41 -1
| @@ -218,6 +218,45 @@ func LogDefaultHandler(LogDomainVar string, LogLevelVar LogLevelFlags, MessageVa | |||
| 218 | 218 | ||
| 219 | 219 | } | |
| 220 | 220 | ||
| 221 | + | var xLogGetAlwaysFatal func() LogLevelFlags | |
| 222 | + | ||
| 223 | + | // Gets the current fatal mask. | |
| 224 | + | // | |
| 225 | + | // This is mostly used by custom log writers to make fatal messages | |
| 226 | + | // (`fatal-warnings`, `fatal-criticals`) work as expected, when using the | |
| 227 | + | // `G_DEBUG` environment variable (see [Running GLib Applications](running.html)). | |
| 228 | + | // | |
| 229 | + | // An example usage is shown below: | |
| 230 | + | // | |
| 231 | + | // ```c | |
| 232 | + | // static GLogWriterOutput | |
| 233 | + | // my_custom_log_writer_fn (GLogLevelFlags log_level, | |
| 234 | + | // | |
| 235 | + | // const GLogField *fields, | |
| 236 | + | // gsize n_fields, | |
| 237 | + | // gpointer user_data) | |
| 238 | + | // | |
| 239 | + | // { | |
| 240 | + | // | |
| 241 | + | // // abort if the message was fatal | |
| 242 | + | // if (log_level & g_log_get_always_fatal ()) | |
| 243 | + | // g_abort (); | |
| 244 | + | // | |
| 245 | + | // // custom log handling code | |
| 246 | + | // ... | |
| 247 | + | // ... | |
| 248 | + | // | |
| 249 | + | // // success | |
| 250 | + | // return G_LOG_WRITER_HANDLED; | |
| 251 | + | // } | |
| 252 | + | // | |
| 253 | + | // ``` | |
| 254 | + | func LogGetAlwaysFatal() LogLevelFlags { | |
| 255 | + | ||
| 256 | + | cret := xLogGetAlwaysFatal() | |
| 257 | + | return cret | |
| 258 | + | } | |
| 259 | + | ||
| 221 | 260 | var xLogGetDebugEnabled func() bool | |
| 222 | 261 | ||
| 223 | 262 | // Return whether debug output from the GLib logging system is enabled. | |
| @@ -257,7 +296,7 @@ var xLogSetAlwaysFatal func(LogLevelFlags) LogLevelFlags | |||
| 257 | 296 | // | |
| 258 | 297 | // You can also make some message levels fatal at runtime by setting | |
| 259 | 298 | // the `G_DEBUG` environment variable (see | |
| 260 | - | // [Running GLib Applications](glib-running.html)). | |
| 299 | + | // [Running GLib Applications](running.html)). | |
| 261 | 300 | // | |
| 262 | 301 | // Libraries should not call this function, as it affects all messages logged | |
| 263 | 302 | // by a process, including those from other libraries. | |
| @@ -936,6 +975,7 @@ func init() { | |||
| 936 | 975 | core.PuregoSafeRegister(&xAssertWarning, libs, "g_assert_warning") | |
| 937 | 976 | core.PuregoSafeRegister(&xLog, libs, "g_log") | |
| 938 | 977 | core.PuregoSafeRegister(&xLogDefaultHandler, libs, "g_log_default_handler") | |
| 978 | + | core.PuregoSafeRegister(&xLogGetAlwaysFatal, libs, "g_log_get_always_fatal") | |
| 939 | 979 | core.PuregoSafeRegister(&xLogGetDebugEnabled, libs, "g_log_get_debug_enabled") | |
| 940 | 980 | core.PuregoSafeRegister(&xLogRemoveHandler, libs, "g_log_remove_handler") | |
| 941 | 981 | core.PuregoSafeRegister(&xLogSetAlwaysFatal, libs, "g_log_set_always_fatal") | |
M v4/glib/gpathbuf.go +1 -1
| @@ -262,7 +262,7 @@ var xPathBufEqual func(uintptr, uintptr) bool | |||
| 262 | 262 | // Compares two path buffers for equality and returns `TRUE` | |
| 263 | 263 | // if they are equal. | |
| 264 | 264 | // | |
| 265 | - | // The path inside the paths buffers are not going to be normalized, | |
| 265 | + | // The paths inside the path buffers are not going to be normalized, | |
| 266 | 266 | // so `X/Y/Z/A/..`, `X/./Y/Z` and `X/Y/Z` are not going to be considered | |
| 267 | 267 | // equal. | |
| 268 | 268 | // | |
M v4/glib/gregex.go +339 -59
| @@ -133,6 +133,9 @@ var xMatchInfoFetchNamedPos func(uintptr, string, int, int) bool | |||
| 133 | 133 | // If @name is a valid sub pattern name but it didn't match anything | |
| 134 | 134 | // (e.g. sub pattern `"X"`, matching `"b"` against `"(?P<X>a)?b"`) | |
| 135 | 135 | // then @start_pos and @end_pos are set to -1 and %TRUE is returned. | |
| 136 | + | // | |
| 137 | + | // As @end_pos is set to the byte after the final byte of the match (on success), | |
| 138 | + | // the length of the match can be calculated as `end_pos - start_pos`. | |
| 136 | 139 | func (x *MatchInfo) FetchNamedPos(NameVar string, StartPosVar int, EndPosVar int) bool { | |
| 137 | 140 | ||
| 138 | 141 | cret := xMatchInfoFetchNamedPos(x.GoPointer(), NameVar, StartPosVar, EndPosVar) | |
| @@ -141,19 +144,213 @@ func (x *MatchInfo) FetchNamedPos(NameVar string, StartPosVar int, EndPosVar int | |||
| 141 | 144 | ||
| 142 | 145 | var xMatchInfoFetchPos func(uintptr, int, int, int) bool | |
| 143 | 146 | ||
| 144 | - | // Retrieves the position in bytes of the @match_num'th capturing | |
| 145 | - | // parentheses. 0 is the full text of the match, 1 is the first | |
| 146 | - | // paren set, 2 the second, and so on. | |
| 147 | + | // Returns the start and end positions (in bytes) of a successfully matching | |
| 148 | + | // capture parenthesis. | |
| 147 | 149 | // | |
| 148 | - | // If @match_num is a valid sub pattern but it didn't match anything | |
| 149 | - | // (e.g. sub pattern 1, matching "b" against "(a)?b") then @start_pos | |
| 150 | - | // and @end_pos are set to -1 and %TRUE is returned. | |
| 150 | + | // Valid values for @match_num are `0` for the full text of the match, | |
| 151 | + | // `1` for the first paren set, `2` for the second, and so on. | |
| 151 | 152 | // | |
| 152 | - | // If the match was obtained using the DFA algorithm, that is using | |
| 153 | - | // g_regex_match_all() or g_regex_match_all_full(), the retrieved | |
| 154 | - | // position is not that of a set of parentheses but that of a matched | |
| 155 | - | // substring. Substrings are matched in reverse order of length, so | |
| 156 | - | // 0 is the longest match. | |
| 153 | + | // As @end_pos is set to the byte after the final byte of the match (on success), | |
| 154 | + | // the length of the match can be calculated as `end_pos - start_pos`. | |
| 155 | + | // | |
| 156 | + | // As a best practice, initialize @start_pos and @end_pos to identifiable | |
| 157 | + | // values, such as `G_MAXINT`, so that you can test if | |
| 158 | + | // `g_match_info_fetch_pos()` actually changed the value for a given | |
| 159 | + | // capture parenthesis. | |
| 160 | + | // | |
| 161 | + | // The parameter @match_num corresponds to a matched capture parenthesis. The | |
| 162 | + | // actual value you use for @match_num depends on the method used to generate | |
| 163 | + | // @match_info. The following sections describe those methods. | |
| 164 | + | // | |
| 165 | + | // ## Methods Using Non-deterministic Finite Automata Matching | |
| 166 | + | // | |
| 167 | + | // The methods [method@GLib.Regex.match] and [method@GLib.Regex.match_full] | |
| 168 | + | // return a [struct@GLib.MatchInfo] using traditional (greedy) pattern | |
| 169 | + | // matching, also known as | |
| 170 | + | // [Non-deterministic Finite Automaton](https://en.wikipedia.org/wiki/Nondeterministic_finite_automaton) | |
| 171 | + | // (NFA) matching. You pass the returned `GMatchInfo` from these methods to | |
| 172 | + | // `g_match_info_fetch_pos()` to determine the start and end positions | |
| 173 | + | // of capture parentheses. The values for @match_num correspond to the capture | |
| 174 | + | // parentheses in order, with `0` corresponding to the entire matched string. | |
| 175 | + | // | |
| 176 | + | // @match_num can refer to a capture parenthesis with no match. For example, | |
| 177 | + | // the string `b` matches against the pattern `(a)?b`, but the capture | |
| 178 | + | // parenthesis `(a)` has no match. In this case, `g_match_info_fetch_pos()` | |
| 179 | + | // returns true and sets @start_pos and @end_pos to `-1` when called with | |
| 180 | + | // `match_num` as `1` (for `(a)`). | |
| 181 | + | // | |
| 182 | + | // For an expanded example, a regex pattern is `(a)?(.*?)the (.*)`, | |
| 183 | + | // and a candidate string is `glib regexes are the best`. In this scenario | |
| 184 | + | // there are four capture parentheses numbered 0–3: an implicit one | |
| 185 | + | // for the entire string, and three explicitly declared in the regex pattern. | |
| 186 | + | // | |
| 187 | + | // Given this example, the following table describes the return values | |
| 188 | + | // from `g_match_info_fetch_pos()` for various values of @match_num. | |
| 189 | + | // | |
| 190 | + | // `match_num` | Contents | Return value | Returned `start_pos` | Returned `end_pos` | |
| 191 | + | // ----------- | -------- | ------------ | -------------------- | ------------------ | |
| 192 | + | // 0 | Matches entire string | True | 0 | 25 | |
| 193 | + | // 1 | Does not match first character | True | -1 | -1 | |
| 194 | + | // 2 | All text before `the ` | True | 0 | 17 | |
| 195 | + | // 3 | All text after `the ` | True | 21 | 25 | |
| 196 | + | // 4 | Capture paren out of range | False | Unchanged | Unchanged | |
| 197 | + | // | |
| 198 | + | // The following code sample and output implements this example. | |
| 199 | + | // | |
| 200 | + | // ``` { .c } | |
| 201 | + | // #include <glib.h> | |
| 202 | + | // | |
| 203 | + | // int | |
| 204 | + | // main (int argc, char *argv[]) | |
| 205 | + | // | |
| 206 | + | // { | |
| 207 | + | // g_autoptr(GError) local_error = NULL; | |
| 208 | + | // const char *regex_pattern = "(a)?(.*?)the (.*)"; | |
| 209 | + | // const char *test_string = "glib regexes are the best"; | |
| 210 | + | // g_autoptr(GRegex) regex = NULL; | |
| 211 | + | // | |
| 212 | + | // regex = g_regex_new (regex_pattern, | |
| 213 | + | // G_REGEX_DEFAULT, | |
| 214 | + | // G_REGEX_MATCH_DEFAULT, | |
| 215 | + | // &local_error); | |
| 216 | + | // if (regex == NULL) | |
| 217 | + | // { | |
| 218 | + | // g_printerr ("Error creating regex: %s\n", local_error->message); | |
| 219 | + | // return 1; | |
| 220 | + | // } | |
| 221 | + | // | |
| 222 | + | // g_autoptr(GMatchInfo) match_info = NULL; | |
| 223 | + | // g_regex_match (regex, test_string, G_REGEX_MATCH_DEFAULT, &match_info); | |
| 224 | + | // | |
| 225 | + | // int n_matched_strings = g_match_info_get_match_count (match_info); | |
| 226 | + | // | |
| 227 | + | // // Print header line | |
| 228 | + | // g_print ("match_num Contents Return value returned start_pos returned end_pos\n"); | |
| 229 | + | // | |
| 230 | + | // // Iterate over each capture paren, including one that is out of range as a demonstration. | |
| 231 | + | // for (int match_num = 0; match_num <= n_matched_strings; match_num++) | |
| 232 | + | // { | |
| 233 | + | // gboolean found_match; | |
| 234 | + | // g_autofree char *paren_string = NULL; | |
| 235 | + | // int start_pos = G_MAXINT; | |
| 236 | + | // int end_pos = G_MAXINT; | |
| 237 | + | // | |
| 238 | + | // found_match = g_match_info_fetch_pos (match_info, | |
| 239 | + | // match_num, | |
| 240 | + | // &start_pos, | |
| 241 | + | // &end_pos); | |
| 242 | + | // | |
| 243 | + | // // If no match, display N/A as the found string. | |
| 244 | + | // if (start_pos == G_MAXINT || start_pos == -1) | |
| 245 | + | // paren_string = g_strdup ("N/A"); | |
| 246 | + | // else | |
| 247 | + | // paren_string = g_strndup (test_string + start_pos, end_pos - start_pos); | |
| 248 | + | // | |
| 249 | + | // g_print ("%-9d %-25s %-12d %-18d %d\n", match_num, paren_string, found_match, start_pos, end_pos); | |
| 250 | + | // } | |
| 251 | + | // | |
| 252 | + | // return 0; | |
| 253 | + | // } | |
| 254 | + | // | |
| 255 | + | // ``` | |
| 256 | + | // | |
| 257 | + | // ``` | |
| 258 | + | // match_num Contents Return value returned start_pos returned end_pos | |
| 259 | + | // 0 glib regexes are the best 1 0 25 | |
| 260 | + | // 1 N/A 1 -1 -1 | |
| 261 | + | // 2 glib regexes are 1 0 17 | |
| 262 | + | // 3 best 1 21 25 | |
| 263 | + | // 4 N/A 0 2147483647 2147483647 | |
| 264 | + | // ``` | |
| 265 | + | // ## Methods Using Deterministic Finite Automata Matching | |
| 266 | + | // | |
| 267 | + | // The methods [method@GLib.Regex.match_all] and | |
| 268 | + | // [method@GLib.Regex.match_all_full] | |
| 269 | + | // return a `GMatchInfo` using | |
| 270 | + | // [Deterministic Finite Automaton](https://en.wikipedia.org/wiki/Deterministic_finite_automaton) | |
| 271 | + | // (DFA) pattern matching. This algorithm detects overlapping matches. You pass | |
| 272 | + | // the returned `GMatchInfo` from these methods to `g_match_info_fetch_pos()` | |
| 273 | + | // to determine the start and end positions of each overlapping match. Use the | |
| 274 | + | // method [method@GLib.MatchInfo.get_match_count] to determine the number | |
| 275 | + | // of overlapping matches. | |
| 276 | + | // | |
| 277 | + | // For example, a regex pattern is `<.*>`, and a candidate string is | |
| 278 | + | // `<a> <b> <c>`. In this scenario there are three implicit capture | |
| 279 | + | // parentheses: one for the entire string, one for `<a> <b>`, and one for `<a>`. | |
| 280 | + | // | |
| 281 | + | // Given this example, the following table describes the return values from | |
| 282 | + | // `g_match_info_fetch_pos()` for various values of @match_num. | |
| 283 | + | // | |
| 284 | + | // `match_num` | Contents | Return value | Returned `start_pos` | Returned `end_pos` | |
| 285 | + | // ----------- | -------- | ------------ | -------------------- | ------------------ | |
| 286 | + | // 0 | Matches entire string | True | 0 | 11 | |
| 287 | + | // 1 | Matches `<a> <b>` | True | 0 | 7 | |
| 288 | + | // 2 | Matches `<a>` | True | 0 | 3 | |
| 289 | + | // 3 | Capture paren out of range | False | Unchanged | Unchanged | |
| 290 | + | // | |
| 291 | + | // The following code sample and output implements this example. | |
| 292 | + | // | |
| 293 | + | // ``` { .c } | |
| 294 | + | // #include <glib.h> | |
| 295 | + | // | |
| 296 | + | // int | |
| 297 | + | // main (int argc, char *argv[]) | |
| 298 | + | // | |
| 299 | + | // { | |
| 300 | + | // g_autoptr(GError) local_error = NULL; | |
| 301 | + | // const char *regex_pattern = "<.*>"; | |
| 302 | + | // const char *test_string = "<a> <b> <c>"; | |
| 303 | + | // g_autoptr(GRegex) regex = NULL; | |
| 304 | + | // | |
| 305 | + | // regex = g_regex_new (regex_pattern, | |
| 306 | + | // G_REGEX_DEFAULT, | |
| 307 | + | // G_REGEX_MATCH_DEFAULT, | |
| 308 | + | // &local_error); | |
| 309 | + | // if (regex == NULL) | |
| 310 | + | // { | |
| 311 | + | // g_printerr ("Error creating regex: %s\n", local_error->message); | |
| 312 | + | // return -1; | |
| 313 | + | // } | |
| 314 | + | // | |
| 315 | + | // g_autoptr(GMatchInfo) match_info = NULL; | |
| 316 | + | // g_regex_match_all (regex, test_string, G_REGEX_MATCH_DEFAULT, &match_info); | |
| 317 | + | // | |
| 318 | + | // int n_matched_strings = g_match_info_get_match_count (match_info); | |
| 319 | + | // | |
| 320 | + | // // Print header line | |
| 321 | + | // g_print ("match_num Contents Return value returned start_pos returned end_pos\n"); | |
| 322 | + | // | |
| 323 | + | // // Iterate over each capture paren, including one that is out of range as a demonstration. | |
| 324 | + | // for (int match_num = 0; match_num <= n_matched_strings; match_num++) | |
| 325 | + | // { | |
| 326 | + | // gboolean found_match; | |
| 327 | + | // g_autofree char *paren_string = NULL; | |
| 328 | + | // int start_pos = G_MAXINT; | |
| 329 | + | // int end_pos = G_MAXINT; | |
| 330 | + | // | |
| 331 | + | // found_match = g_match_info_fetch_pos (match_info, match_num, &start_pos, &end_pos); | |
| 332 | + | // | |
| 333 | + | // // If no match, display N/A as the found string. | |
| 334 | + | // if (start_pos == G_MAXINT || start_pos == -1) | |
| 335 | + | // paren_string = g_strdup ("N/A"); | |
| 336 | + | // else | |
| 337 | + | // paren_string = g_strndup (test_string + start_pos, end_pos - start_pos); | |
| 338 | + | // | |
| 339 | + | // g_print ("%-9d %-25s %-12d %-18d %d\n", match_num, paren_string, found_match, start_pos, end_pos); | |
| 340 | + | // } | |
| 341 | + | // | |
| 342 | + | // return 0; | |
| 343 | + | // } | |
| 344 | + | // | |
| 345 | + | // ``` | |
| 346 | + | // | |
| 347 | + | // ``` | |
| 348 | + | // match_num Contents Return value returned start_pos returned end_pos | |
| 349 | + | // 0 <a> <b> <c> 1 0 11 | |
| 350 | + | // 1 <a> <b> 1 0 7 | |
| 351 | + | // 2 <a> 1 0 3 | |
| 352 | + | // 3 N/A 0 2147483647 2147483647 | |
| 353 | + | // ``` | |
| 157 | 354 | func (x *MatchInfo) FetchPos(MatchNumVar int, StartPosVar int, EndPosVar int) bool { | |
| 158 | 355 | ||
| 159 | 356 | cret := xMatchInfoFetchPos(x.GoPointer(), MatchNumVar, StartPosVar, EndPosVar) | |
| @@ -296,58 +493,141 @@ func (x *MatchInfo) Unref() { | |||
| 296 | 493 | ||
| 297 | 494 | } | |
| 298 | 495 | ||
| 299 | - | // A `GRegex` is the "compiled" form of a regular expression pattern. | |
| 496 | + | // A `GRegex` is a compiled form of a regular expression. | |
| 497 | + | // | |
| 498 | + | // After instantiating a `GRegex`, you can use its methods to find matches | |
| 499 | + | // in a string, replace matches within a string, or split the string at matches. | |
| 300 | 500 | // | |
| 301 | 501 | // `GRegex` implements regular expression pattern matching using syntax and | |
| 302 | - | // semantics similar to Perl regular expression. See the | |
| 303 | - | // [PCRE documentation](man:pcrepattern(3)) for the syntax definition. | |
| 304 | - | // | |
| 305 | - | // Some functions accept a @start_position argument, setting it differs | |
| 306 | - | // from just passing over a shortened string and setting %G_REGEX_MATCH_NOTBOL | |
| 307 | - | // in the case of a pattern that begins with any kind of lookbehind assertion. | |
| 308 | - | // For example, consider the pattern "\Biss\B" which finds occurrences of "iss" | |
| 309 | - | // in the middle of words. ("\B" matches only if the current position in the | |
| 310 | - | // subject is not a word boundary.) When applied to the string "Mississipi" | |
| 311 | - | // from the fourth byte, namely "issipi", it does not match, because "\B" is | |
| 312 | - | // always false at the start of the subject, which is deemed to be a word | |
| 313 | - | // boundary. However, if the entire string is passed , but with | |
| 314 | - | // @start_position set to 4, it finds the second occurrence of "iss" because | |
| 315 | - | // it is able to look behind the starting point to discover that it is | |
| 316 | - | // preceded by a letter. | |
| 317 | - | // | |
| 318 | - | // Note that, unless you set the %G_REGEX_RAW flag, all the strings passed | |
| 319 | - | // to these functions must be encoded in UTF-8. The lengths and the positions | |
| 320 | - | // inside the strings are in bytes and not in characters, so, for instance, | |
| 321 | - | // "\xc3\xa0" (i.e. "à") is two bytes long but it is treated as a | |
| 322 | - | // single character. If you set %G_REGEX_RAW the strings can be non-valid | |
| 323 | - | // UTF-8 strings and a byte is treated as a character, so "\xc3\xa0" is two | |
| 324 | - | // bytes and two characters long. | |
| 325 | - | // | |
| 326 | - | // When matching a pattern, "\n" matches only against a "\n" character in | |
| 327 | - | // the string, and "\r" matches only a "\r" character. To match any newline | |
| 328 | - | // sequence use "\R". This particular group matches either the two-character | |
| 329 | - | // sequence CR + LF ("\r\n"), or one of the single characters LF (linefeed, | |
| 330 | - | // U+000A, "\n"), VT vertical tab, U+000B, "\v"), FF (formfeed, U+000C, "\f"), | |
| 331 | - | // CR (carriage return, U+000D, "\r"), NEL (next line, U+0085), LS (line | |
| 332 | - | // separator, U+2028), or PS (paragraph separator, U+2029). | |
| 502 | + | // semantics (such as character classes, quantifiers, and capture groups) | |
| 503 | + | // similar to Perl regular expression. See the | |
| 504 | + | // [PCRE documentation](man:pcre2pattern(3)) for details. | |
| 505 | + | // | |
| 506 | + | // A typical scenario for regex pattern matching is to check if a string | |
| 507 | + | // matches a pattern. The following statements implement this scenario. | |
| 508 | + | // | |
| 509 | + | // ``` { .c } | |
| 510 | + | // const char *regex_pattern = ".*GLib.*"; | |
| 511 | + | // const char *string_to_search = "You will love the GLib implementation of regex"; | |
| 512 | + | // g_autoptr(GMatchInfo) match_info = NULL; | |
| 513 | + | // g_autoptr(GRegex) regex = NULL; | |
| 514 | + | // | |
| 515 | + | // regex = g_regex_new (regex_pattern, G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL); | |
| 516 | + | // g_assert (regex != NULL); | |
| 517 | + | // | |
| 518 | + | // if (g_regex_match (regex, string_to_search, G_REGEX_MATCH_DEFAULT, &match_info)) | |
| 519 | + | // | |
| 520 | + | // { | |
| 521 | + | // int start_pos, end_pos; | |
| 522 | + | // g_match_info_fetch_pos (match_info, 0, &start_pos, &end_pos); | |
| 523 | + | // g_print ("Match successful! Overall pattern matches bytes %d to %d\n", start_pos, end_pos); | |
| 524 | + | // } | |
| 525 | + | // | |
| 526 | + | // else | |
| 527 | + | // | |
| 528 | + | // { | |
| 529 | + | // g_print ("No match!\n"); | |
| 530 | + | // } | |
| 531 | + | // | |
| 532 | + | // ``` | |
| 533 | + | // | |
| 534 | + | // The constructor for `GRegex` includes two sets of bitmapped flags: | |
| 535 | + | // | |
| 536 | + | // * [flags@GLib.RegexCompileFlags]—These flags | |
| 537 | + | // control how GLib compiles the regex. There are options for case | |
| 538 | + | // sensitivity, multiline, ignoring whitespace, etc. | |
| 539 | + | // * [flags@GLib.RegexMatchFlags]—These flags control | |
| 540 | + | // `GRegex`’s matching behavior, such as anchoring and customizing definitions | |
| 541 | + | // for newline characters. | |
| 542 | + | // | |
| 543 | + | // Some regex patterns include backslash assertions, such as `\d` (digit) or | |
| 544 | + | // `\D` (non-digit). The regex pattern must escape those backslashes. For | |
| 545 | + | // example, the pattern `"\\d\\D"` matches a digit followed by a non-digit. | |
| 546 | + | // | |
| 547 | + | // GLib’s implementation of pattern matching includes a `start_position` | |
| 548 | + | // argument for some of the match, replace, and split methods. Specifying | |
| 549 | + | // a start position provides flexibility when you want to ignore the first | |
| 550 | + | // _n_ characters of a string, but want to incorporate backslash assertions | |
| 551 | + | // at character _n_ - 1. For example, a database field contains inconsistent | |
| 552 | + | // spelling for a job title: `healthcare provider` and `health-care provider`. | |
| 553 | + | // The database manager wants to make the spelling consistent by adding a | |
| 554 | + | // hyphen when it is missing. The following regex pattern tests for the string | |
| 555 | + | // `care` preceded by a non-word boundary character (instead of a hyphen) | |
| 556 | + | // and followed by a space. | |
| 557 | + | // | |
| 558 | + | // ``` { .c } | |
| 559 | + | // const char *regex_pattern = "\\Bcare\\s"; | |
| 560 | + | // ``` | |
| 561 | + | // | |
| 562 | + | // An efficient way to match with this pattern is to start examining at | |
| 563 | + | // `start_position` 6 in the string `healthcare` or `health-care`. | |
| 564 | + | // | |
| 565 | + | // ``` { .c } | |
| 566 | + | // const char *regex_pattern = "\\Bcare\\s"; | |
| 567 | + | // const char *string_to_search = "healthcare provider"; | |
| 568 | + | // g_autoptr(GMatchInfo) match_info = NULL; | |
| 569 | + | // g_autoptr(GRegex) regex = NULL; | |
| 570 | + | // | |
| 571 | + | // regex = g_regex_new ( | |
| 572 | + | // | |
| 573 | + | // regex_pattern, | |
| 574 | + | // G_REGEX_DEFAULT, | |
| 575 | + | // G_REGEX_MATCH_DEFAULT, | |
| 576 | + | // NULL); | |
| 577 | + | // | |
| 578 | + | // g_assert (regex != NULL); | |
| 579 | + | // | |
| 580 | + | // g_regex_match_full ( | |
| 581 | + | // | |
| 582 | + | // regex, | |
| 583 | + | // string_to_search, | |
| 584 | + | // -1, | |
| 585 | + | // 6, // position of 'c' in the test string. | |
| 586 | + | // G_REGEX_MATCH_DEFAULT, | |
| 587 | + | // &match_info, | |
| 588 | + | // NULL); | |
| 589 | + | // | |
| 590 | + | // ``` | |
| 591 | + | // | |
| 592 | + | // The method [method@GLib.Regex.match_full] (and other methods implementing | |
| 593 | + | // `start_pos`) allow for lookback before the start position to determine if | |
| 594 | + | // the previous character satisfies an assertion. | |
| 595 | + | // | |
| 596 | + | // Unless you set the [flags@GLib.RegexCompileFlags.RAW] as one of | |
| 597 | + | // the `GRegexCompileFlags`, all the strings passed to `GRegex` methods must | |
| 598 | + | // be encoded in UTF-8. The lengths and the positions inside the strings are | |
| 599 | + | // in bytes and not in characters, so, for instance, `\xc3\xa0` (i.e., `à`) | |
| 600 | + | // is two bytes long but it is treated as a single character. If you set | |
| 601 | + | // `G_REGEX_RAW`, the strings can be non-valid UTF-8 strings and a byte is | |
| 602 | + | // treated as a character, so `\xc3\xa0` is two bytes and two characters long. | |
| 603 | + | // | |
| 604 | + | // Regarding line endings, `\n` matches a `\n` character, and `\r` matches | |
| 605 | + | // a `\r` character. More generally, `\R` matches all typical line endings: | |
| 606 | + | // CR + LF (`\r\n`), LF (linefeed, U+000A, `\n`), VT (vertical tab, U+000B, | |
| 607 | + | // `\v`), FF (formfeed, U+000C, `\f`), CR (carriage return, U+000D, `\r`), | |
| 608 | + | // NEL (next line, U+0085), LS (line separator, U+2028), and PS (paragraph | |
| 609 | + | // separator, U+2029). | |
| 333 | 610 | // | |
| 334 | 611 | // The behaviour of the dot, circumflex, and dollar metacharacters are | |
| 335 | - | // affected by newline characters, the default is to recognize any newline | |
| 336 | - | // character (the same characters recognized by "\R"). This can be changed | |
| 337 | - | // with `G_REGEX_NEWLINE_CR`, `G_REGEX_NEWLINE_LF` and `G_REGEX_NEWLINE_CRLF` | |
| 338 | - | // compile options, and with `G_REGEX_MATCH_NEWLINE_ANY`, | |
| 339 | - | // `G_REGEX_MATCH_NEWLINE_CR`, `G_REGEX_MATCH_NEWLINE_LF` and | |
| 340 | - | // `G_REGEX_MATCH_NEWLINE_CRLF` match options. These settings are also | |
| 341 | - | // relevant when compiling a pattern if `G_REGEX_EXTENDED` is set, and an | |
| 342 | - | // unescaped "#" outside a character class is encountered. This indicates | |
| 343 | - | // a comment that lasts until after the next newline. | |
| 344 | - | // | |
| 345 | - | // Creating and manipulating the same `GRegex` structure from different | |
| 346 | - | // threads is not a problem as `GRegex` does not modify its internal | |
| 347 | - | // state between creation and destruction, on the other hand `GMatchInfo` | |
| 348 | - | // is not threadsafe. | |
| 349 | - | // | |
| 350 | - | // The regular expressions low-level functionalities are obtained through | |
| 612 | + | // affected by newline characters. By default, `GRegex` matches any newline | |
| 613 | + | // character matched by `\R`. You can limit the matched newline characters by | |
| 614 | + | // specifying the [flags@GLib.RegexMatchFlags.NEWLINE_CR], | |
| 615 | + | // [flags@GLib.RegexMatchFlags.NEWLINE_LF], and | |
| 616 | + | // [flags@GLib.RegexMatchFlags.NEWLINE_CRLF] compile options, and | |
| 617 | + | // with [flags@GLib.RegexMatchFlags.NEWLINE_ANY], | |
| 618 | + | // [flags@GLib.RegexMatchFlags.NEWLINE_CR], | |
| 619 | + | // [flags@GLib.RegexMatchFlags.NEWLINE_LF] and | |
| 620 | + | // [flags@GLib.RegexMatchFlags.NEWLINE_CRLF] match options. | |
| 621 | + | // These settings are also relevant when compiling a pattern if | |
| 622 | + | // [flags@GLib.RegexCompileFlags.EXTENDED] is set and an unescaped | |
| 623 | + | // `#` outside a character class is encountered. This indicates a comment | |
| 624 | + | // that lasts until after the next newline. | |
| 625 | + | // | |
| 626 | + | // Because `GRegex` does not modify its internal state between creation and | |
| 627 | + | // destruction, you can create and modify the same `GRegex` instance from | |
| 628 | + | // different threads. In contrast, [struct@GLib.MatchInfo] is not thread safe. | |
| 629 | + | // | |
| 630 | + | // The regular expression low-level functionalities are obtained through | |
| 351 | 631 | // the excellent [PCRE](http://www.pcre.org/) library written by Philip Hazel. | |
| 352 | 632 | type Regex struct { | |
| 353 | 633 | _ structs.HostLayout | |
M v4/glib/gspawn.go +3 -2
| @@ -138,8 +138,9 @@ var xSpawnAsync func(string, []string, []string, SpawnFlags, uintptr, uintptr, * | |||
| 138 | 138 | ||
| 139 | 139 | // Executes a child program asynchronously. | |
| 140 | 140 | // | |
| 141 | - | // See g_spawn_async_with_pipes() for a full description; this function | |
| 142 | - | // simply calls the g_spawn_async_with_pipes() without any pipes. | |
| 141 | + | // See g_spawn_async_with_pipes_and_fds() for a full description; this function | |
| 142 | + | // simply calls the g_spawn_async_with_pipes() without any pipes, which in turn | |
| 143 | + | // calls g_spawn_async_with_pipes_and_fds(). | |
| 143 | 144 | // | |
| 144 | 145 | // You should call g_spawn_close_pid() on the returned child process | |
| 145 | 146 | // reference when you don't need it any more. | |
M v4/glib/gstdio.go +10 -0
| @@ -146,6 +146,13 @@ var xFopen func(string, string) uintptr | |||
| 146 | 146 | // currently impossible to close a file if the application C library and the C library | |
| 147 | 147 | // used by GLib are different. Convenience functions like g_file_set_contents_full() | |
| 148 | 148 | // avoid this problem. | |
| 149 | + | // | |
| 150 | + | // Since GLib 2.86, the `e` option is supported in @mode on all platforms. On | |
| 151 | + | // Unix platforms it will set `O_CLOEXEC` on the opened file descriptor. On | |
| 152 | + | // Windows platforms it will be converted to the | |
| 153 | + | // [`N` modifier](https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/fopen-wfopen?view=msvc-170). | |
| 154 | + | // It is recommended to set `e` unconditionally, unless you know the returned | |
| 155 | + | // file should be shared between this process and a new fork. | |
| 149 | 156 | func Fopen(FilenameVar string, ModeVar string) uintptr { | |
| 150 | 157 | ||
| 151 | 158 | cret := xFopen(FilenameVar, ModeVar) | |
| @@ -158,6 +165,9 @@ var xFreopen func(string, string, uintptr) uintptr | |||
| 158 | 165 | // opens a file and associates it with an existing stream. | |
| 159 | 166 | // | |
| 160 | 167 | // See your C library manual for more details about freopen(). | |
| 168 | + | // | |
| 169 | + | // Since GLib 2.86, the `e` option is supported in @mode on all platforms. See | |
| 170 | + | // the documentation for [func@GLib.fopen] for more details. | |
| 161 | 171 | func Freopen(FilenameVar string, ModeVar string, StreamVar uintptr) uintptr { | |
| 162 | 172 | ||
| 163 | 173 | cret := xFreopen(FilenameVar, ModeVar, StreamVar) | |
M v4/glib/gstring.go +14 -1
| @@ -69,7 +69,7 @@ var xNewStringTake func(string) *String | |||
| 69 | 69 | // Creates a new #GString, initialized with the given string. | |
| 70 | 70 | // | |
| 71 | 71 | // After this call, @init belongs to the #GString and may no longer be | |
| 72 | - | // modified by the caller. The memory of @data has to be dynamically | |
| 72 | + | // modified by the caller. The memory of @init has to be dynamically | |
| 73 | 73 | // allocated and will eventually be freed with g_free(). | |
| 74 | 74 | func NewStringTake(InitVar string) *String { | |
| 75 | 75 | ||
| @@ -199,6 +199,18 @@ func (x *String) Assign(RvalVar string) *String { | |||
| 199 | 199 | return cret | |
| 200 | 200 | } | |
| 201 | 201 | ||
| 202 | + | var xStringCopy func(uintptr) *String | |
| 203 | + | ||
| 204 | + | // Copies the [struct@GLib.String] instance and its contents. | |
| 205 | + | // | |
| 206 | + | // This will preserve the allocation length of the [struct@GLib.String] in the | |
| 207 | + | // copy. | |
| 208 | + | func (x *String) Copy() *String { | |
| 209 | + | ||
| 210 | + | cret := xStringCopy(x.GoPointer()) | |
| 211 | + | return cret | |
| 212 | + | } | |
| 213 | + | ||
| 202 | 214 | var xStringDown func(uintptr) *String | |
| 203 | 215 | ||
| 204 | 216 | // Converts a #GString to lowercase. | |
| @@ -494,6 +506,7 @@ func init() { | |||
| 494 | 506 | core.PuregoSafeRegister(&xStringAsciiDown, libs, "g_string_ascii_down") | |
| 495 | 507 | core.PuregoSafeRegister(&xStringAsciiUp, libs, "g_string_ascii_up") | |
| 496 | 508 | core.PuregoSafeRegister(&xStringAssign, libs, "g_string_assign") | |
| 509 | + | core.PuregoSafeRegister(&xStringCopy, libs, "g_string_copy") | |
| 497 | 510 | core.PuregoSafeRegister(&xStringDown, libs, "g_string_down") | |
| 498 | 511 | core.PuregoSafeRegister(&xStringEqual, libs, "g_string_equal") | |
| 499 | 512 | core.PuregoSafeRegister(&xStringErase, libs, "g_string_erase") | |
M v4/glib/gtestutils.go +2 -2
| @@ -428,7 +428,7 @@ var xTestAddDataFuncFull func(string, uintptr, uintptr, uintptr) | |||
| 428 | 428 | ||
| 429 | 429 | // Creates a new test case. | |
| 430 | 430 | // | |
| 431 | - | // In constract to [func@GLib.test_add_data_func], this function | |
| 431 | + | // In contrast to [func@GLib.test_add_data_func], this function | |
| 432 | 432 | // is freeing @test_data after the test run is complete. | |
| 433 | 433 | func TestAddDataFuncFull(TestpathVar string, TestDataVar uintptr, TestFuncVar *TestDataFunc, DataFreeFuncVar *DestroyNotify) { | |
| 434 | 434 | ||
| @@ -1345,7 +1345,7 @@ var xTestTrapSubprocessWithEnvp func(string, []string, uint64, TestSubprocessFla | |||
| 1345 | 1345 | // } | |
| 1346 | 1346 | // | |
| 1347 | 1347 | // // Reruns this same test in a subprocess | |
| 1348 | - | // g_autoptr(GStrv) envp = g_get_environ (); | |
| 1348 | + | // g_auto(GStrv) envp = g_get_environ (); | |
| 1349 | 1349 | // envp = g_environ_setenv (g_steal_pointer (&envp), "USER", "charlie", TRUE); | |
| 1350 | 1350 | // g_test_trap_subprocess_with_envp (NULL, envp, 0, G_TEST_SUBPROCESS_DEFAULT); | |
| 1351 | 1351 | // g_test_trap_assert_passed (); | |
M v4/glib/gunicode.go +4 -4
| @@ -1584,7 +1584,7 @@ func Utf8TruncateMiddle(StringVar string, TruncateLengthVar uint) string { | |||
| 1584 | 1584 | return cret | |
| 1585 | 1585 | } | |
| 1586 | 1586 | ||
| 1587 | - | var xUtf8Validate func([]byte, int, string) bool | |
| 1587 | + | var xUtf8Validate func([]byte, int, []byte) bool | |
| 1588 | 1588 | ||
| 1589 | 1589 | // Validates UTF-8 encoded text. | |
| 1590 | 1590 | // | |
| @@ -1603,19 +1603,19 @@ var xUtf8Validate func([]byte, int, string) bool | |||
| 1603 | 1603 | // routines require valid UTF-8 as input; so data read from a file | |
| 1604 | 1604 | // or the network should be checked with `g_utf8_validate()` before | |
| 1605 | 1605 | // doing anything else with it. | |
| 1606 | - | func Utf8Validate(StrVar []byte, MaxLenVar int, EndVar string) bool { | |
| 1606 | + | func Utf8Validate(StrVar []byte, MaxLenVar int, EndVar []byte) bool { | |
| 1607 | 1607 | ||
| 1608 | 1608 | cret := xUtf8Validate(StrVar, MaxLenVar, EndVar) | |
| 1609 | 1609 | return cret | |
| 1610 | 1610 | } | |
| 1611 | 1611 | ||
| 1612 | - | var xUtf8ValidateLen func([]byte, uint, string) bool | |
| 1612 | + | var xUtf8ValidateLen func([]byte, uint, []byte) bool | |
| 1613 | 1613 | ||
| 1614 | 1614 | // Validates UTF-8 encoded text. | |
| 1615 | 1615 | // | |
| 1616 | 1616 | // As with [func@GLib.utf8_validate], but @max_len must be set, and hence this | |
| 1617 | 1617 | // function will always return `FALSE` if any of the bytes of @str are nul. | |
| 1618 | - | func Utf8ValidateLen(StrVar []byte, MaxLenVar uint, EndVar string) bool { | |
| 1618 | + | func Utf8ValidateLen(StrVar []byte, MaxLenVar uint, EndVar []byte) bool { | |
| 1619 | 1619 | ||
| 1620 | 1620 | cret := xUtf8ValidateLen(StrVar, MaxLenVar, EndVar) | |
| 1621 | 1621 | return cret | |
M v4/gmodule/gmodule.go +4 -0
| @@ -25,6 +25,10 @@ type ModuleUnload func(*Module) | |||
| 25 | 25 | // The #GModule struct is an opaque data structure to represent a | |
| 26 | 26 | // [dynamically-loaded module](modules.html#dynamic-loading-of-modules). | |
| 27 | 27 | // It should only be accessed via the following functions. | |
| 28 | + | // | |
| 29 | + | // To ensure correct lock ordering, these functions must not be called from | |
| 30 | + | // global constructors (for example, those using GCC’s | |
| 31 | + | // `__attribute__((constructor))` attribute). | |
| 28 | 32 | type Module struct { | |
| 29 | 33 | _ structs.HostLayout | |
| 30 | 34 | } | |
M v4/gobject/genums.go +4 -4
| @@ -80,7 +80,7 @@ func (x *FlagsValue) GoPointer() uintptr { | |||
| 80 | 80 | return uintptr(unsafe.Pointer(x)) | |
| 81 | 81 | } | |
| 82 | 82 | ||
| 83 | - | var xEnumCompleteTypeInfo func(types.GType, *TypeInfo, *EnumValue) | |
| 83 | + | var xEnumCompleteTypeInfo func(types.GType, *TypeInfo, []EnumValue) | |
| 84 | 84 | ||
| 85 | 85 | // This function is meant to be called from the `complete_type_info` | |
| 86 | 86 | // function of a #GTypePlugin implementation, as in the following | |
| @@ -105,7 +105,7 @@ var xEnumCompleteTypeInfo func(types.GType, *TypeInfo, *EnumValue) | |||
| 105 | 105 | // } | |
| 106 | 106 | // | |
| 107 | 107 | // ]| | |
| 108 | - | func EnumCompleteTypeInfo(GEnumTypeVar types.GType, InfoVar *TypeInfo, ConstValuesVar *EnumValue) { | |
| 108 | + | func EnumCompleteTypeInfo(GEnumTypeVar types.GType, InfoVar *TypeInfo, ConstValuesVar []EnumValue) { | |
| 109 | 109 | ||
| 110 | 110 | xEnumCompleteTypeInfo(GEnumTypeVar, InfoVar, ConstValuesVar) | |
| 111 | 111 | ||
| @@ -163,12 +163,12 @@ func EnumToString(GEnumTypeVar types.GType, ValueVar int) string { | |||
| 163 | 163 | return cret | |
| 164 | 164 | } | |
| 165 | 165 | ||
| 166 | - | var xFlagsCompleteTypeInfo func(types.GType, *TypeInfo, *FlagsValue) | |
| 166 | + | var xFlagsCompleteTypeInfo func(types.GType, *TypeInfo, []FlagsValue) | |
| 167 | 167 | ||
| 168 | 168 | // This function is meant to be called from the complete_type_info() | |
| 169 | 169 | // function of a #GTypePlugin implementation, see the example for | |
| 170 | 170 | // g_enum_complete_type_info() above. | |
| 171 | - | func FlagsCompleteTypeInfo(GFlagsTypeVar types.GType, InfoVar *TypeInfo, ConstValuesVar *FlagsValue) { | |
| 171 | + | func FlagsCompleteTypeInfo(GFlagsTypeVar types.GType, InfoVar *TypeInfo, ConstValuesVar []FlagsValue) { | |
| 172 | 172 | ||
| 173 | 173 | xFlagsCompleteTypeInfo(GFlagsTypeVar, InfoVar, ConstValuesVar) | |
| 174 | 174 | ||
M v4/gobject/gobject.go +0 -1
| @@ -1660,7 +1660,6 @@ func (x *Object) Ref() *Object { | |||
| 1660 | 1660 | if cret == 0 { | |
| 1661 | 1661 | return nil | |
| 1662 | 1662 | } | |
| 1663 | - | IncreaseRef(cret) | |
| 1664 | 1663 | cls = &Object{} | |
| 1665 | 1664 | cls.Ptr = cret | |
| 1666 | 1665 | return cls | |
M v4/gobject/gtype.go +0 -13
| @@ -1011,18 +1011,6 @@ func TypeClassPeekStatic(TypeVar types.GType) *TypeClass { | |||
| 1011 | 1011 | return cret | |
| 1012 | 1012 | } | |
| 1013 | 1013 | ||
| 1014 | - | var xTypeClassRef func(types.GType) *TypeClass | |
| 1015 | - | ||
| 1016 | - | // Increments the reference count of the class structure belonging to | |
| 1017 | - | // @type. | |
| 1018 | - | // | |
| 1019 | - | // This function will demand-create the class if it doesn't exist already. | |
| 1020 | - | func TypeClassRef(TypeVar types.GType) *TypeClass { | |
| 1021 | - | ||
| 1022 | - | cret := xTypeClassRef(TypeVar) | |
| 1023 | - | return cret | |
| 1024 | - | } | |
| 1025 | - | ||
| 1026 | 1014 | var xTypeCreateInstance func(types.GType) *TypeInstance | |
| 1027 | 1015 | ||
| 1028 | 1016 | // Creates and initializes an instance of @type if @type is valid and | |
| @@ -1573,7 +1561,6 @@ func init() { | |||
| 1573 | 1561 | core.PuregoSafeRegister(&xTypeClassGet, libs, "g_type_class_get") | |
| 1574 | 1562 | core.PuregoSafeRegister(&xTypeClassPeek, libs, "g_type_class_peek") | |
| 1575 | 1563 | core.PuregoSafeRegister(&xTypeClassPeekStatic, libs, "g_type_class_peek_static") | |
| 1576 | - | core.PuregoSafeRegister(&xTypeClassRef, libs, "g_type_class_ref") | |
| 1577 | 1564 | core.PuregoSafeRegister(&xTypeCreateInstance, libs, "g_type_create_instance") | |
| 1578 | 1565 | core.PuregoSafeRegister(&xTypeDefaultInterfaceGet, libs, "g_type_default_interface_get") | |
| 1579 | 1566 | core.PuregoSafeRegister(&xTypeDefaultInterfacePeek, libs, "g_type_default_interface_peek") | |
M v4/gobject/gtypemodule.go +4 -4
| @@ -244,7 +244,7 @@ func (x *TypeModule) AddInterface(InstanceTypeVar types.GType, InterfaceTypeVar | |||
| 244 | 244 | ||
| 245 | 245 | } | |
| 246 | 246 | ||
| 247 | - | var xTypeModuleRegisterEnum func(uintptr, string, *EnumValue) types.GType | |
| 247 | + | var xTypeModuleRegisterEnum func(uintptr, string, []EnumValue) types.GType | |
| 248 | 248 | ||
| 249 | 249 | // Looks up or registers an enumeration that is implemented with a particular | |
| 250 | 250 | // type plugin. If a type with name @type_name was previously registered, | |
| @@ -256,13 +256,13 @@ var xTypeModuleRegisterEnum func(uintptr, string, *EnumValue) types.GType | |||
| 256 | 256 | // | |
| 257 | 257 | // Since 2.56 if @module is %NULL this will call g_type_register_static() | |
| 258 | 258 | // instead. This can be used when making a static build of the module. | |
| 259 | - | func (x *TypeModule) RegisterEnum(NameVar string, ConstStaticValuesVar *EnumValue) types.GType { | |
| 259 | + | func (x *TypeModule) RegisterEnum(NameVar string, ConstStaticValuesVar []EnumValue) types.GType { | |
| 260 | 260 | ||
| 261 | 261 | cret := xTypeModuleRegisterEnum(x.GoPointer(), NameVar, ConstStaticValuesVar) | |
| 262 | 262 | return cret | |
| 263 | 263 | } | |
| 264 | 264 | ||
| 265 | - | var xTypeModuleRegisterFlags func(uintptr, string, *FlagsValue) types.GType | |
| 265 | + | var xTypeModuleRegisterFlags func(uintptr, string, []FlagsValue) types.GType | |
| 266 | 266 | ||
| 267 | 267 | // Looks up or registers a flags type that is implemented with a particular | |
| 268 | 268 | // type plugin. If a type with name @type_name was previously registered, | |
| @@ -274,7 +274,7 @@ var xTypeModuleRegisterFlags func(uintptr, string, *FlagsValue) types.GType | |||
| 274 | 274 | // | |
| 275 | 275 | // Since 2.56 if @module is %NULL this will call g_type_register_static() | |
| 276 | 276 | // instead. This can be used when making a static build of the module. | |
| 277 | - | func (x *TypeModule) RegisterFlags(NameVar string, ConstStaticValuesVar *FlagsValue) types.GType { | |
| 277 | + | func (x *TypeModule) RegisterFlags(NameVar string, ConstStaticValuesVar []FlagsValue) types.GType { | |
| 278 | 278 | ||
| 279 | 279 | cret := xTypeModuleRegisterFlags(x.GoPointer(), NameVar, ConstStaticValuesVar) | |
| 280 | 280 | return cret | |
M v4/gobject/gvalue.go +97 -41
| @@ -12,21 +12,30 @@ import ( | |||
| 12 | 12 | ) | |
| 13 | 13 | ||
| 14 | 14 | // The type of value transformation functions which can be registered with | |
| 15 | - | // g_value_register_transform_func(). | |
| 15 | + | // [func@GObject.Value.register_transform_func]. | |
| 16 | 16 | // | |
| 17 | 17 | // @dest_value will be initialized to the correct destination type. | |
| 18 | 18 | type ValueTransform func(*Value, *Value) | |
| 19 | 19 | ||
| 20 | 20 | // An opaque structure used to hold different types of values. | |
| 21 | 21 | // | |
| 22 | + | // Before it can be used, a `GValue` has to be initialized to a specific type by | |
| 23 | + | // calling [method@GObject.Value.init] on it. | |
| 24 | + | // | |
| 25 | + | // Many types which are stored within a `GValue` need to allocate data on the | |
| 26 | + | // heap, so [method@GObject.Value.unset] must always be called on a `GValue` to | |
| 27 | + | // free any such data once you’re finished with the `GValue`, even if the | |
| 28 | + | // `GValue` itself is stored on the stack. | |
| 29 | + | // | |
| 22 | 30 | // The data within the structure has protected scope: it is accessible only | |
| 23 | - | // to functions within a #GTypeValueTable structure, or implementations of | |
| 24 | - | // the g_value_*() API. That is, code portions which implement new fundamental | |
| 25 | - | // types. | |
| 31 | + | // to functions within a [struct@GObject.TypeValueTable] structure, or | |
| 32 | + | // implementations of the `g_value_*()` API. That is, code which implements new | |
| 33 | + | // fundamental types. | |
| 26 | 34 | // | |
| 27 | - | // #GValue users cannot make any assumptions about how data is stored | |
| 35 | + | // `GValue` users cannot make any assumptions about how data is stored | |
| 28 | 36 | // within the 2 element @data union, and the @g_type member should | |
| 29 | - | // only be accessed through the G_VALUE_TYPE() macro. | |
| 37 | + | // only be accessed through the [func@GObject.VALUE_TYPE] macro and related | |
| 38 | + | // macros. | |
| 30 | 39 | type Value struct { | |
| 31 | 40 | _ structs.HostLayout | |
| 32 | 41 | ||
| @@ -123,6 +132,7 @@ func (x *Value) DupVariant() *glib.Variant { | |||
| 123 | 132 | var xValueFitsPointer func(uintptr) bool | |
| 124 | 133 | ||
| 125 | 134 | // Determines if @value will fit inside the size of a pointer value. | |
| 135 | + | // | |
| 126 | 136 | // This is an internal function introduced mainly for C marshallers. | |
| 127 | 137 | func (x *Value) FitsPointer() bool { | |
| 128 | 138 | ||
| @@ -340,7 +350,21 @@ func (x *Value) GetVariant() *glib.Variant { | |||
| 340 | 350 | ||
| 341 | 351 | var xValueInit func(uintptr, types.GType) *Value | |
| 342 | 352 | ||
| 343 | - | // Initializes @value with the default value of @type. | |
| 353 | + | // Initializes @value to store values of the given @type, and sets its value | |
| 354 | + | // to the default for @type. | |
| 355 | + | // | |
| 356 | + | // This must be called before any other methods on a [struct@GObject.Value], so | |
| 357 | + | // the value knows what type it’s meant to store. | |
| 358 | + | // | |
| 359 | + | // ```c | |
| 360 | + | // | |
| 361 | + | // GValue value = G_VALUE_INIT; | |
| 362 | + | // | |
| 363 | + | // g_value_init (&value, SOME_G_TYPE); | |
| 364 | + | // … | |
| 365 | + | // g_value_unset (&value); | |
| 366 | + | // | |
| 367 | + | // ``` | |
| 344 | 368 | func (x *Value) Init(GTypeVar types.GType) *Value { | |
| 345 | 369 | ||
| 346 | 370 | cret := xValueInit(x.GoPointer(), GTypeVar) | |
| @@ -349,13 +373,15 @@ func (x *Value) Init(GTypeVar types.GType) *Value { | |||
| 349 | 373 | ||
| 350 | 374 | var xValueInitFromInstance func(uintptr, *TypeInstance) | |
| 351 | 375 | ||
| 352 | - | // Initializes and sets @value from an instantiatable type via the | |
| 353 | - | // value_table's collect_value() function. | |
| 376 | + | // Initializes and sets @value from an instantiatable type. | |
| 377 | + | // | |
| 378 | + | // This calls the [callback@GObject.TypeValueCollectFunc] function for the type | |
| 379 | + | // the [struct@GObject.Value] contains. | |
| 354 | 380 | // | |
| 355 | 381 | // Note: The @value will be initialised with the exact type of | |
| 356 | - | // @instance. If you wish to set the @value's type to a different GType | |
| 357 | - | // (such as a parent class GType), you need to manually call | |
| 358 | - | // g_value_init() and g_value_set_instance(). | |
| 382 | + | // @instance. If you wish to set the @value’s type to a different | |
| 383 | + | // [type@GObject.Type] (such as a parent class type), you need to manually call | |
| 384 | + | // [method@GObject.Value.init] and [method@GObject.Value.set_instance]. | |
| 359 | 385 | func (x *Value) InitFromInstance(InstanceVar *TypeInstance) { | |
| 360 | 386 | ||
| 361 | 387 | xValueInitFromInstance(x.GoPointer(), InstanceVar) | |
| @@ -364,8 +390,11 @@ func (x *Value) InitFromInstance(InstanceVar *TypeInstance) { | |||
| 364 | 390 | ||
| 365 | 391 | var xValuePeekPointer func(uintptr) uintptr | |
| 366 | 392 | ||
| 367 | - | // Returns the value contents as pointer. This function asserts that | |
| 368 | - | // g_value_fits_pointer() returned %TRUE for the passed in value. | |
| 393 | + | // Returns the value contents as a pointer. | |
| 394 | + | // | |
| 395 | + | // This function asserts that [method@GObject.Value.fits_pointer] returned true | |
| 396 | + | // for the passed in value. | |
| 397 | + | // | |
| 369 | 398 | // This is an internal function introduced mainly for C marshallers. | |
| 370 | 399 | func (x *Value) PeekPointer() uintptr { | |
| 371 | 400 | ||
| @@ -376,7 +405,8 @@ func (x *Value) PeekPointer() uintptr { | |||
| 376 | 405 | var xValueReset func(uintptr) *Value | |
| 377 | 406 | ||
| 378 | 407 | // Clears the current value in @value and resets it to the default value | |
| 379 | - | // (as if the value had just been initialized). | |
| 408 | + | // (as if the value had just been initialized using | |
| 409 | + | // [method@GObject.Value.init]). | |
| 380 | 410 | func (x *Value) Reset() *Value { | |
| 381 | 411 | ||
| 382 | 412 | cret := xValueReset(x.GoPointer()) | |
| @@ -466,8 +496,10 @@ func (x *Value) SetGtype(VGtypeVar types.GType) { | |||
| 466 | 496 | ||
| 467 | 497 | var xValueSetInstance func(uintptr, uintptr) | |
| 468 | 498 | ||
| 469 | - | // Sets @value from an instantiatable type via the | |
| 470 | - | // value_table's collect_value() function. | |
| 499 | + | // Sets @value from an instantiatable type. | |
| 500 | + | // | |
| 501 | + | // This calls the [callback@GObject.TypeValueCollectFunc] function for the type | |
| 502 | + | // the [struct@GObject.Value] contains. | |
| 471 | 503 | func (x *Value) SetInstance(InstanceVar uintptr) { | |
| 472 | 504 | ||
| 473 | 505 | xValueSetInstance(x.GoPointer(), InstanceVar) | |
| @@ -752,12 +784,17 @@ func (x *Value) TakeVariant(VariantVar *glib.Variant) { | |||
| 752 | 784 | var xValueTransform func(uintptr, *Value) bool | |
| 753 | 785 | ||
| 754 | 786 | // Tries to cast the contents of @src_value into a type appropriate | |
| 755 | - | // to store in @dest_value, e.g. to transform a %G_TYPE_INT value | |
| 756 | - | // into a %G_TYPE_FLOAT value. Performing transformations between | |
| 757 | - | // value types might incur precision lossage. Especially | |
| 758 | - | // transformations into strings might reveal seemingly arbitrary | |
| 759 | - | // results and shouldn't be relied upon for production code (such | |
| 760 | - | // as rcfile value or object property serialization). | |
| 787 | + | // to store in @dest_value. | |
| 788 | + | // | |
| 789 | + | // If a transformation is not possible, @dest_value is not modified. | |
| 790 | + | // | |
| 791 | + | // For example, this could transform a `G_TYPE_INT` value into a `G_TYPE_FLOAT` | |
| 792 | + | // value. | |
| 793 | + | // | |
| 794 | + | // Performing transformations between value types might incur precision loss. | |
| 795 | + | // Especially transformations into strings might reveal seemingly arbitrary | |
| 796 | + | // results and the format of particular transformations to strings is not | |
| 797 | + | // guaranteed over time. | |
| 761 | 798 | func (x *Value) Transform(DestValueVar *Value) bool { | |
| 762 | 799 | ||
| 763 | 800 | cret := xValueTransform(x.GoPointer(), DestValueVar) | |
| @@ -766,10 +803,11 @@ func (x *Value) Transform(DestValueVar *Value) bool { | |||
| 766 | 803 | ||
| 767 | 804 | var xValueUnset func(uintptr) | |
| 768 | 805 | ||
| 769 | - | // Clears the current value in @value (if any) and "unsets" the type, | |
| 770 | - | // this releases all resources associated with this GValue. An unset | |
| 771 | - | // value is the same as an uninitialized (zero-filled) #GValue | |
| 772 | - | // structure. | |
| 806 | + | // Clears the current value in @value (if any) and ‘unsets’ the type. | |
| 807 | + | // | |
| 808 | + | // This releases all resources associated with this [struct@GObject.Value]. An | |
| 809 | + | // unset value is the same as a cleared (zero-filled) | |
| 810 | + | // [struct@GObject.Value] structure set to `G_VALUE_INIT`. | |
| 773 | 811 | func (x *Value) Unset() { | |
| 774 | 812 | ||
| 775 | 813 | xValueUnset(x.GoPointer()) | |
| @@ -777,21 +815,37 @@ func (x *Value) Unset() { | |||
| 777 | 815 | } | |
| 778 | 816 | ||
| 779 | 817 | const ( | |
| 780 | - | // For string values, indicates that the string contained is canonical and will | |
| 781 | - | // exist for the duration of the process. See g_value_set_interned_string(). | |
| 818 | + | // Flag to indicate that a string in a [struct@GObject.Value] is canonical and | |
| 819 | + | // will exist for the duration of the process. | |
| 820 | + | // | |
| 821 | + | // See [method@GObject.Value.set_interned_string]. | |
| 822 | + | // | |
| 823 | + | // This flag should be checked by implementations of | |
| 824 | + | // [callback@GObject.TypeValueFreeFunc], [callback@GObject.TypeValueCollectFunc] | |
| 825 | + | // and [callback@GObject.TypeValueLCopyFunc]. | |
| 782 | 826 | VALUE_INTERNED_STRING int = 268435456 | |
| 783 | - | // If passed to G_VALUE_COLLECT(), allocated data won't be copied | |
| 784 | - | // but used verbatim. This does not affect ref-counted types like | |
| 785 | - | // objects. This does not affect usage of g_value_copy(), the data will | |
| 827 | + | // Flag to indicate that allocated data in a [struct@GObject.Value] shouldn’t be | |
| 828 | + | // copied. | |
| 829 | + | // | |
| 830 | + | // If passed to [func@GObject.VALUE_COLLECT], allocated data won’t be copied | |
| 831 | + | // but used verbatim. This does not affect ref-counted types like objects. | |
| 832 | + | // | |
| 833 | + | // This does not affect usage of [method@GObject.Value.copy]: the data will | |
| 786 | 834 | // be copied if it is not ref-counted. | |
| 835 | + | // | |
| 836 | + | // This flag should be checked by implementations of | |
| 837 | + | // [callback@GObject.TypeValueFreeFunc], [callback@GObject.TypeValueCollectFunc] | |
| 838 | + | // and [callback@GObject.TypeValueLCopyFunc]. | |
| 787 | 839 | VALUE_NOCOPY_CONTENTS int = 134217728 | |
| 788 | 840 | ) | |
| 789 | 841 | ||
| 790 | 842 | var xValueRegisterTransformFunc func(types.GType, types.GType, uintptr) | |
| 791 | 843 | ||
| 792 | - | // Registers a value transformation function for use in g_value_transform(). | |
| 793 | - | // A previously registered transformation function for @src_type and @dest_type | |
| 794 | - | // will be replaced. | |
| 844 | + | // Registers a value transformation function for use in | |
| 845 | + | // [method@GObject.Value.transform]. | |
| 846 | + | // | |
| 847 | + | // Any previously registered transformation function for @src_type and | |
| 848 | + | // @dest_type will be replaced. | |
| 795 | 849 | func ValueRegisterTransformFunc(SrcTypeVar types.GType, DestTypeVar types.GType, TransformFuncVar *ValueTransform) { | |
| 796 | 850 | ||
| 797 | 851 | xValueRegisterTransformFunc(SrcTypeVar, DestTypeVar, glib.NewCallback(TransformFuncVar)) | |
| @@ -800,8 +854,8 @@ func ValueRegisterTransformFunc(SrcTypeVar types.GType, DestTypeVar types.GType, | |||
| 800 | 854 | ||
| 801 | 855 | var xValueTypeCompatible func(types.GType, types.GType) bool | |
| 802 | 856 | ||
| 803 | - | // Returns whether a #GValue of type @src_type can be copied into | |
| 804 | - | // a #GValue of type @dest_type. | |
| 857 | + | // Checks whether a [method@GObject.Value.copy] is able to copy values of type | |
| 858 | + | // @src_type into values of type @dest_type. | |
| 805 | 859 | func ValueTypeCompatible(SrcTypeVar types.GType, DestTypeVar types.GType) bool { | |
| 806 | 860 | ||
| 807 | 861 | cret := xValueTypeCompatible(SrcTypeVar, DestTypeVar) | |
| @@ -810,10 +864,12 @@ func ValueTypeCompatible(SrcTypeVar types.GType, DestTypeVar types.GType) bool { | |||
| 810 | 864 | ||
| 811 | 865 | var xValueTypeTransformable func(types.GType, types.GType) bool | |
| 812 | 866 | ||
| 813 | - | // Check whether g_value_transform() is able to transform values | |
| 814 | - | // of type @src_type into values of type @dest_type. Note that for | |
| 815 | - | // the types to be transformable, they must be compatible or a | |
| 816 | - | // transformation function must be registered. | |
| 867 | + | // Checks whether [method@GObject.Value.transform] is able to transform values | |
| 868 | + | // of type @src_type into values of type @dest_type. | |
| 869 | + | // | |
| 870 | + | // Note that for the types to be transformable, they must be compatible or a | |
| 871 | + | // transformation function must be registered using | |
| 872 | + | // [func@GObject.Value.register_transform_func]. | |
| 817 | 873 | func ValueTypeTransformable(SrcTypeVar types.GType, DestTypeVar types.GType) bool { | |
| 818 | 874 | ||
| 819 | 875 | cret := xValueTypeTransformable(SrcTypeVar, DestTypeVar) | |
A v4/gsk/gskcomponenttransfer.go +32 -0
| @@ -0,0 +1,32 @@ | |||
| 1 | + | // Package gsk was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT | |
| 2 | + | package gsk | |
| 3 | + | ||
| 4 | + | import ( | |
| 5 | + | "github.com/jwijenbergh/purego" | |
| 6 | + | "github.com/jwijenbergh/puregotk/pkg/core" | |
| 7 | + | ) | |
| 8 | + | ||
| 9 | + | var xComponentTransferEqual func(uintptr, uintptr) bool | |
| 10 | + | ||
| 11 | + | // Compares two component transfers for equality. | |
| 12 | + | func ComponentTransferEqual(SelfVar uintptr, OtherVar uintptr) bool { | |
| 13 | + | ||
| 14 | + | cret := xComponentTransferEqual(SelfVar, OtherVar) | |
| 15 | + | return cret | |
| 16 | + | } | |
| 17 | + | ||
| 18 | + | func init() { | |
| 19 | + | core.SetPackageName("GSK", "gtk4") | |
| 20 | + | core.SetSharedLibraries("GSK", []string{"libgtk-4.so.1"}) | |
| 21 | + | var libs []uintptr | |
| 22 | + | for _, libPath := range core.GetPaths("GSK") { | |
| 23 | + | lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) | |
| 24 | + | if err != nil { | |
| 25 | + | panic(err) | |
| 26 | + | } | |
| 27 | + | libs = append(libs, lib) | |
| 28 | + | } | |
| 29 | + | ||
| 30 | + | core.PuregoSafeRegister(&xComponentTransferEqual, libs, "gsk_component_transfer_equal") | |
| 31 | + | ||
| 32 | + | } | |
M v4/gsk/gskenums.go +2 -0
| @@ -384,6 +384,8 @@ const ( | |||
| 384 | 384 | StrokeNodeValue RenderNodeType = 29 | |
| 385 | 385 | // A node that possibly redirects part of the scene graph to a subsurface. | |
| 386 | 386 | SubsurfaceNodeValue RenderNodeType = 30 | |
| 387 | + | // A node that applies some function to each color component. | |
| 388 | + | ComponentTransferNodeValue RenderNodeType = 31 | |
| 387 | 389 | ) | |
| 388 | 390 | ||
| 389 | 391 | // The filters used when scaling texture data. | |
M v4/gsk/gskpath.go +30 -1
| @@ -17,7 +17,11 @@ import ( | |||
| 17 | 17 | // | |
| 18 | 18 | // Each contour of the path starts with a @GSK_PATH_MOVE operation. | |
| 19 | 19 | // Closed contours end with a @GSK_PATH_CLOSE operation. | |
| 20 | - | type PathForeachFunc func(PathOperation, *graphene.Point, uint, float32, uintptr) bool | |
| 20 | + | type PathForeachFunc func(PathOperation, []graphene.Point, uint, float32, uintptr) bool | |
| 21 | + | ||
| 22 | + | // Prototype of the callback to iterate through the | |
| 23 | + | // intersections of two paths. | |
| 24 | + | type PathIntersectionFunc func(*Path, *PathPoint, *Path, *PathPoint, PathIntersection, uintptr) bool | |
| 21 | 25 | ||
| 22 | 26 | // Flags that can be passed to gsk_path_foreach() to influence what | |
| 23 | 27 | // kinds of operations the path is decomposed into. | |
| @@ -46,6 +50,29 @@ const ( | |||
| 46 | 50 | PathForeachAllowConicValue PathForeachFlags = 4 | |
| 47 | 51 | ) | |
| 48 | 52 | ||
| 53 | + | // The values of this enumeration classify intersections | |
| 54 | + | // between paths. | |
| 55 | + | type PathIntersection int | |
| 56 | + | ||
| 57 | + | var xPathIntersectionGLibType func() types.GType | |
| 58 | + | ||
| 59 | + | func PathIntersectionGLibType() types.GType { | |
| 60 | + | return xPathIntersectionGLibType() | |
| 61 | + | } | |
| 62 | + | ||
| 63 | + | const ( | |
| 64 | + | ||
| 65 | + | // No intersection | |
| 66 | + | PathIntersectionNoneValue PathIntersection = 0 | |
| 67 | + | // A normal intersection, where the two paths | |
| 68 | + | // cross each other | |
| 69 | + | PathIntersectionNormalValue PathIntersection = 1 | |
| 70 | + | // The start of a segment where the two paths coincide | |
| 71 | + | PathIntersectionStartValue PathIntersection = 2 | |
| 72 | + | // The end of a segment where the two paths coincide | |
| 73 | + | PathIntersectionEndValue PathIntersection = 3 | |
| 74 | + | ) | |
| 75 | + | ||
| 49 | 76 | var xPathParse func(string) *Path | |
| 50 | 77 | ||
| 51 | 78 | // Constructs a path from a serialized form. | |
| @@ -92,6 +119,8 @@ func init() { | |||
| 92 | 119 | ||
| 93 | 120 | core.PuregoSafeRegister(&xPathForeachFlagsGLibType, libs, "gsk_path_foreach_flags_get_type") | |
| 94 | 121 | ||
| 122 | + | core.PuregoSafeRegister(&xPathIntersectionGLibType, libs, "gsk_path_intersection_get_type") | |
| 123 | + | ||
| 95 | 124 | core.PuregoSafeRegister(&xPathParse, libs, "gsk_path_parse") | |
| 96 | 125 | ||
| 97 | 126 | } | |
M v4/gsk/gsktypes.go +236 -1
| @@ -14,6 +14,188 @@ import ( | |||
| 14 | 14 | "github.com/jwijenbergh/puregotk/v4/pango" | |
| 15 | 15 | ) | |
| 16 | 16 | ||
| 17 | + | // Specifies a transfer function for a color component to be applied | |
| 18 | + | // while rendering. | |
| 19 | + | // | |
| 20 | + | // The available functions include linear, piecewise-linear, | |
| 21 | + | // gamma and step functions. | |
| 22 | + | // | |
| 23 | + | // Note that the transfer function is applied to un-premultiplied | |
| 24 | + | // values, and all results are clamped to the [0, 1] range. | |
| 25 | + | type ComponentTransfer struct { | |
| 26 | + | _ structs.HostLayout | |
| 27 | + | } | |
| 28 | + | ||
| 29 | + | var xComponentTransferGLibType func() types.GType | |
| 30 | + | ||
| 31 | + | func ComponentTransferGLibType() types.GType { | |
| 32 | + | return xComponentTransferGLibType() | |
| 33 | + | } | |
| 34 | + | ||
| 35 | + | func (x *ComponentTransfer) GoPointer() uintptr { | |
| 36 | + | return uintptr(unsafe.Pointer(x)) | |
| 37 | + | } | |
| 38 | + | ||
| 39 | + | var xNewComponentTransferDiscrete func(uint, []float32) *ComponentTransfer | |
| 40 | + | ||
| 41 | + | // Creates a new component transfer that applies | |
| 42 | + | // a step function. | |
| 43 | + | // | |
| 44 | + | // The new value is computed as | |
| 45 | + | // | |
| 46 | + | // C' = values[k] | |
| 47 | + | // | |
| 48 | + | // where k is the smallest value such that | |
| 49 | + | // | |
| 50 | + | // k / n <= C < (k + 1) / n | |
| 51 | + | // | |
| 52 | + | // <figure> | |
| 53 | + | // | |
| 54 | + | // <picture> | |
| 55 | + | // <source srcset="discrete-dark.png" media="(prefers-color-scheme: dark)"> | |
| 56 | + | // <img alt="Component transfer: discrete" src="discrete-light.png"> | |
| 57 | + | // </picture> | |
| 58 | + | // | |
| 59 | + | // </figure> | |
| 60 | + | func NewComponentTransferDiscrete(NVar uint, ValuesVar []float32) *ComponentTransfer { | |
| 61 | + | ||
| 62 | + | cret := xNewComponentTransferDiscrete(NVar, ValuesVar) | |
| 63 | + | return cret | |
| 64 | + | } | |
| 65 | + | ||
| 66 | + | var xNewComponentTransferGamma func(float32, float32, float32) *ComponentTransfer | |
| 67 | + | ||
| 68 | + | // Creates a new component transfer that applies | |
| 69 | + | // a gamma transform. | |
| 70 | + | // | |
| 71 | + | // The new value is computed as | |
| 72 | + | // | |
| 73 | + | // C' = amp * pow (C, exp) + ofs | |
| 74 | + | // | |
| 75 | + | // <figure> | |
| 76 | + | // | |
| 77 | + | // <picture> | |
| 78 | + | // <source srcset="gamma-dark.png" media="(prefers-color-scheme: dark)"> | |
| 79 | + | // <img alt="Component transfer: gamma" src="gamma-light.png"> | |
| 80 | + | // </picture> | |
| 81 | + | // | |
| 82 | + | // </figure> | |
| 83 | + | func NewComponentTransferGamma(AmpVar float32, ExpVar float32, OfsVar float32) *ComponentTransfer { | |
| 84 | + | ||
| 85 | + | cret := xNewComponentTransferGamma(AmpVar, ExpVar, OfsVar) | |
| 86 | + | return cret | |
| 87 | + | } | |
| 88 | + | ||
| 89 | + | var xNewComponentTransferIdentity func() *ComponentTransfer | |
| 90 | + | ||
| 91 | + | // Creates a new component transfer that doesn't | |
| 92 | + | // change the component value. | |
| 93 | + | // | |
| 94 | + | // <figure> | |
| 95 | + | // | |
| 96 | + | // <picture> | |
| 97 | + | // <source srcset="identity-dark.png" media="(prefers-color-scheme: dark)"> | |
| 98 | + | // <img alt="Component transfer: identity" src="identity-light.png"> | |
| 99 | + | // </picture> | |
| 100 | + | // | |
| 101 | + | // </figure> | |
| 102 | + | func NewComponentTransferIdentity() *ComponentTransfer { | |
| 103 | + | ||
| 104 | + | cret := xNewComponentTransferIdentity() | |
| 105 | + | return cret | |
| 106 | + | } | |
| 107 | + | ||
| 108 | + | var xNewComponentTransferLevels func(float32) *ComponentTransfer | |
| 109 | + | ||
| 110 | + | // Creates a new component transfer that limits | |
| 111 | + | // the values of the component to `n` levels. | |
| 112 | + | // | |
| 113 | + | // The new value is computed as | |
| 114 | + | // | |
| 115 | + | // C' = (floor (C * n) + 0.5) / n | |
| 116 | + | // | |
| 117 | + | // <figure> | |
| 118 | + | // | |
| 119 | + | // <picture> | |
| 120 | + | // <source srcset="levels-dark.png" media="(prefers-color-scheme: dark)"> | |
| 121 | + | // <img alt="Component transfer: levels" src="levels-light.png"> | |
| 122 | + | // </picture> | |
| 123 | + | // | |
| 124 | + | // </figure> | |
| 125 | + | func NewComponentTransferLevels(NVar float32) *ComponentTransfer { | |
| 126 | + | ||
| 127 | + | cret := xNewComponentTransferLevels(NVar) | |
| 128 | + | return cret | |
| 129 | + | } | |
| 130 | + | ||
| 131 | + | var xNewComponentTransferLinear func(float32, float32) *ComponentTransfer | |
| 132 | + | ||
| 133 | + | // Creates a new component transfer that applies | |
| 134 | + | // a linear transform. | |
| 135 | + | // | |
| 136 | + | // The new value is computed as | |
| 137 | + | // | |
| 138 | + | // C' = C * m + b | |
| 139 | + | // | |
| 140 | + | // <figure> | |
| 141 | + | // | |
| 142 | + | // <picture> | |
| 143 | + | // <source srcset="linear-dark.png" media="(prefers-color-scheme: dark)"> | |
| 144 | + | // <img alt="Component transfer: linear" src="linear-light.png"> | |
| 145 | + | // </picture> | |
| 146 | + | // | |
| 147 | + | // </figure> | |
| 148 | + | func NewComponentTransferLinear(MVar float32, BVar float32) *ComponentTransfer { | |
| 149 | + | ||
| 150 | + | cret := xNewComponentTransferLinear(MVar, BVar) | |
| 151 | + | return cret | |
| 152 | + | } | |
| 153 | + | ||
| 154 | + | var xNewComponentTransferTable func(uint, []float32) *ComponentTransfer | |
| 155 | + | ||
| 156 | + | // Creates a new component transfer that applies | |
| 157 | + | // a piecewise linear function. | |
| 158 | + | // | |
| 159 | + | // The new value is computed as | |
| 160 | + | // | |
| 161 | + | // C' = values[k] + (C - k / (n - 1)) * n * (values[k + 1] - values[k]) | |
| 162 | + | // | |
| 163 | + | // where k is the smallest value such that | |
| 164 | + | // | |
| 165 | + | // k / (n - 1) <= C < (k + 1) / (n - 1) | |
| 166 | + | // | |
| 167 | + | // <figure> | |
| 168 | + | // | |
| 169 | + | // <picture> | |
| 170 | + | // <source srcset="table-dark.png" media="(prefers-color-scheme: dark)"> | |
| 171 | + | // <img alt="Component transfer: table" src="table-light.png"> | |
| 172 | + | // </picture> | |
| 173 | + | // | |
| 174 | + | // </figure> | |
| 175 | + | func NewComponentTransferTable(NVar uint, ValuesVar []float32) *ComponentTransfer { | |
| 176 | + | ||
| 177 | + | cret := xNewComponentTransferTable(NVar, ValuesVar) | |
| 178 | + | return cret | |
| 179 | + | } | |
| 180 | + | ||
| 181 | + | var xComponentTransferCopy func(uintptr) *ComponentTransfer | |
| 182 | + | ||
| 183 | + | // Creates a copy of @other. | |
| 184 | + | func (x *ComponentTransfer) Copy() *ComponentTransfer { | |
| 185 | + | ||
| 186 | + | cret := xComponentTransferCopy(x.GoPointer()) | |
| 187 | + | return cret | |
| 188 | + | } | |
| 189 | + | ||
| 190 | + | var xComponentTransferFree func(uintptr) | |
| 191 | + | ||
| 192 | + | // Frees a component transfer. | |
| 193 | + | func (x *ComponentTransfer) Free() { | |
| 194 | + | ||
| 195 | + | xComponentTransferFree(x.GoPointer()) | |
| 196 | + | ||
| 197 | + | } | |
| 198 | + | ||
| 17 | 199 | // Describes lines and curves that are more complex than simple rectangles. | |
| 18 | 200 | // | |
| 19 | 201 | // Paths can used for rendering (filling or stroking) and for animations | |
| @@ -69,6 +251,29 @@ func (x *Path) Foreach(FlagsVar PathForeachFlags, FuncVar *PathForeachFunc, User | |||
| 69 | 251 | return cret | |
| 70 | 252 | } | |
| 71 | 253 | ||
| 254 | + | var xPathForeachIntersection func(uintptr, *Path, uintptr, uintptr) bool | |
| 255 | + | ||
| 256 | + | // Finds intersections between two paths. | |
| 257 | + | // | |
| 258 | + | // This function finds intersections between @path1 and @path2, | |
| 259 | + | // and calls @func for each of them, in increasing order for @path1. | |
| 260 | + | // | |
| 261 | + | // If @path2 is not provided or equal to @path1, the function finds | |
| 262 | + | // non-trivial self-intersections of @path1. | |
| 263 | + | // | |
| 264 | + | // When segments of the paths coincide, the callback is called once | |
| 265 | + | // for the start of the segment, with @GSK_PATH_INTERSECTION_START, and | |
| 266 | + | // once for the end of the segment, with @GSK_PATH_INTERSECTION_END. | |
| 267 | + | // Note that other intersections may occur between the start and end | |
| 268 | + | // of such a segment. | |
| 269 | + | // | |
| 270 | + | // If @func returns `FALSE`, the iteration is stopped. | |
| 271 | + | func (x *Path) ForeachIntersection(Path2Var *Path, FuncVar *PathIntersectionFunc, UserDataVar uintptr) bool { | |
| 272 | + | ||
| 273 | + | cret := xPathForeachIntersection(x.GoPointer(), Path2Var, glib.NewCallback(FuncVar), UserDataVar) | |
| 274 | + | return cret | |
| 275 | + | } | |
| 276 | + | ||
| 72 | 277 | var xPathGetBounds func(uintptr, *graphene.Rect) bool | |
| 73 | 278 | ||
| 74 | 279 | // Computes the bounds of the given path. | |
| @@ -1005,7 +1210,7 @@ var xStrokeSetLineWidth func(uintptr, float32) | |||
| 1005 | 1210 | ||
| 1006 | 1211 | // Sets the line width to be used when stroking. | |
| 1007 | 1212 | // | |
| 1008 | - | // The line width must be > 0. | |
| 1213 | + | // The line width must be >= 0. | |
| 1009 | 1214 | func (x *Stroke) SetLineWidth(LineWidthVar float32) { | |
| 1010 | 1215 | ||
| 1011 | 1216 | xStrokeSetLineWidth(x.GoPointer(), LineWidthVar) | |
| @@ -1122,6 +1327,22 @@ func (x *Transform) Matrix(MatrixVar *graphene.Matrix) *Transform { | |||
| 1122 | 1327 | return cret | |
| 1123 | 1328 | } | |
| 1124 | 1329 | ||
| 1330 | + | var xTransformMatrix2d func(uintptr, float32, float32, float32, float32, float32, float32) *Transform | |
| 1331 | + | ||
| 1332 | + | // Multiplies @next with the matrix [ xx yx x0; xy yy y0; 0 0 1 ]. | |
| 1333 | + | // | |
| 1334 | + | // The result of calling [method@Gsk.Transform.to_2d] on the returned | |
| 1335 | + | // [struct@Gsk.Transform] should match the input passed to this | |
| 1336 | + | // function. | |
| 1337 | + | // | |
| 1338 | + | // This function consumes @next. Use [method@Gsk.Transform.ref] first | |
| 1339 | + | // if you want to keep it around. | |
| 1340 | + | func (x *Transform) Matrix2d(XxVar float32, YxVar float32, XyVar float32, YyVar float32, DxVar float32, DyVar float32) *Transform { | |
| 1341 | + | ||
| 1342 | + | cret := xTransformMatrix2d(x.GoPointer(), XxVar, YxVar, XyVar, YyVar, DxVar, DyVar) | |
| 1343 | + | return cret | |
| 1344 | + | } | |
| 1345 | + | ||
| 1125 | 1346 | var xTransformPerspective func(uintptr, float32) *Transform | |
| 1126 | 1347 | ||
| 1127 | 1348 | // Applies a perspective projection transform. | |
| @@ -1429,9 +1650,22 @@ func init() { | |||
| 1429 | 1650 | libs = append(libs, lib) | |
| 1430 | 1651 | } | |
| 1431 | 1652 | ||
| 1653 | + | core.PuregoSafeRegister(&xComponentTransferGLibType, libs, "gsk_component_transfer_get_type") | |
| 1654 | + | ||
| 1655 | + | core.PuregoSafeRegister(&xNewComponentTransferDiscrete, libs, "gsk_component_transfer_new_discrete") | |
| 1656 | + | core.PuregoSafeRegister(&xNewComponentTransferGamma, libs, "gsk_component_transfer_new_gamma") | |
| 1657 | + | core.PuregoSafeRegister(&xNewComponentTransferIdentity, libs, "gsk_component_transfer_new_identity") | |
| 1658 | + | core.PuregoSafeRegister(&xNewComponentTransferLevels, libs, "gsk_component_transfer_new_levels") | |
| 1659 | + | core.PuregoSafeRegister(&xNewComponentTransferLinear, libs, "gsk_component_transfer_new_linear") | |
| 1660 | + | core.PuregoSafeRegister(&xNewComponentTransferTable, libs, "gsk_component_transfer_new_table") | |
| 1661 | + | ||
| 1662 | + | core.PuregoSafeRegister(&xComponentTransferCopy, libs, "gsk_component_transfer_copy") | |
| 1663 | + | core.PuregoSafeRegister(&xComponentTransferFree, libs, "gsk_component_transfer_free") | |
| 1664 | + | ||
| 1432 | 1665 | core.PuregoSafeRegister(&xPathGLibType, libs, "gsk_path_get_type") | |
| 1433 | 1666 | ||
| 1434 | 1667 | core.PuregoSafeRegister(&xPathForeach, libs, "gsk_path_foreach") | |
| 1668 | + | core.PuregoSafeRegister(&xPathForeachIntersection, libs, "gsk_path_foreach_intersection") | |
| 1435 | 1669 | core.PuregoSafeRegister(&xPathGetBounds, libs, "gsk_path_get_bounds") | |
| 1436 | 1670 | core.PuregoSafeRegister(&xPathGetClosestPoint, libs, "gsk_path_get_closest_point") | |
| 1437 | 1671 | core.PuregoSafeRegister(&xPathGetEndPoint, libs, "gsk_path_get_end_point") | |
| @@ -1521,6 +1755,7 @@ func init() { | |||
| 1521 | 1755 | core.PuregoSafeRegister(&xTransformGetCategory, libs, "gsk_transform_get_category") | |
| 1522 | 1756 | core.PuregoSafeRegister(&xTransformInvert, libs, "gsk_transform_invert") | |
| 1523 | 1757 | core.PuregoSafeRegister(&xTransformMatrix, libs, "gsk_transform_matrix") | |
| 1758 | + | core.PuregoSafeRegister(&xTransformMatrix2d, libs, "gsk_transform_matrix_2d") | |
| 1524 | 1759 | core.PuregoSafeRegister(&xTransformPerspective, libs, "gsk_transform_perspective") | |
| 1525 | 1760 | core.PuregoSafeRegister(&xTransformPrint, libs, "gsk_transform_print") | |
| 1526 | 1761 | core.PuregoSafeRegister(&xTransformRef, libs, "gsk_transform_ref") | |
A v4/gsk/main.go +100 -0
| @@ -0,0 +1,100 @@ | |||
| 1 | + | // Package gsk was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT | |
| 2 | + | package gsk | |
| 3 | + | ||
| 4 | + | import ( | |
| 5 | + | "github.com/jwijenbergh/purego" | |
| 6 | + | "github.com/jwijenbergh/puregotk/pkg/core" | |
| 7 | + | "github.com/jwijenbergh/puregotk/v4/gobject" | |
| 8 | + | "github.com/jwijenbergh/puregotk/v4/gobject/types" | |
| 9 | + | ) | |
| 10 | + | ||
| 11 | + | type ComponentTransferNode struct { | |
| 12 | + | RenderNode | |
| 13 | + | } | |
| 14 | + | ||
| 15 | + | var xComponentTransferNodeGLibType func() types.GType | |
| 16 | + | ||
| 17 | + | func ComponentTransferNodeGLibType() types.GType { | |
| 18 | + | return xComponentTransferNodeGLibType() | |
| 19 | + | } | |
| 20 | + | ||
| 21 | + | func ComponentTransferNodeNewFromInternalPtr(ptr uintptr) *ComponentTransferNode { | |
| 22 | + | cls := &ComponentTransferNode{} | |
| 23 | + | cls.Ptr = ptr | |
| 24 | + | return cls | |
| 25 | + | } | |
| 26 | + | ||
| 27 | + | var xNewComponentTransferNode func(uintptr, *ComponentTransfer, *ComponentTransfer, *ComponentTransfer, *ComponentTransfer) uintptr | |
| 28 | + | ||
| 29 | + | // Creates a render node that will apply component | |
| 30 | + | // transfers to a child node. | |
| 31 | + | func NewComponentTransferNode(ChildVar *RenderNode, RVar *ComponentTransfer, GVar *ComponentTransfer, BVar *ComponentTransfer, AVar *ComponentTransfer) *ComponentTransferNode { | |
| 32 | + | var cls *ComponentTransferNode | |
| 33 | + | ||
| 34 | + | cret := xNewComponentTransferNode(ChildVar.GoPointer(), RVar, GVar, BVar, AVar) | |
| 35 | + | ||
| 36 | + | if cret == 0 { | |
| 37 | + | return nil | |
| 38 | + | } | |
| 39 | + | cls = &ComponentTransferNode{} | |
| 40 | + | cls.Ptr = cret | |
| 41 | + | return cls | |
| 42 | + | } | |
| 43 | + | ||
| 44 | + | var xComponentTransferNodeGetChild func(uintptr) uintptr | |
| 45 | + | ||
| 46 | + | // Gets the child node that is getting drawn by the given @node. | |
| 47 | + | func (x *ComponentTransferNode) GetChild() *RenderNode { | |
| 48 | + | var cls *RenderNode | |
| 49 | + | ||
| 50 | + | cret := xComponentTransferNodeGetChild(x.GoPointer()) | |
| 51 | + | ||
| 52 | + | if cret == 0 { | |
| 53 | + | return nil | |
| 54 | + | } | |
| 55 | + | gobject.IncreaseRef(cret) | |
| 56 | + | cls = &RenderNode{} | |
| 57 | + | cls.Ptr = cret | |
| 58 | + | return cls | |
| 59 | + | } | |
| 60 | + | ||
| 61 | + | var xComponentTransferNodeGetTransfer func(uintptr, uint) *ComponentTransfer | |
| 62 | + | ||
| 63 | + | // Gets the component transfer for one of the components. | |
| 64 | + | func (x *ComponentTransferNode) GetTransfer(ComponentVar uint) *ComponentTransfer { | |
| 65 | + | ||
| 66 | + | cret := xComponentTransferNodeGetTransfer(x.GoPointer(), ComponentVar) | |
| 67 | + | return cret | |
| 68 | + | } | |
| 69 | + | ||
| 70 | + | func (c *ComponentTransferNode) GoPointer() uintptr { | |
| 71 | + | if c == nil { | |
| 72 | + | return 0 | |
| 73 | + | } | |
| 74 | + | return c.Ptr | |
| 75 | + | } | |
| 76 | + | ||
| 77 | + | func (c *ComponentTransferNode) SetGoPointer(ptr uintptr) { | |
| 78 | + | c.Ptr = ptr | |
| 79 | + | } | |
| 80 | + | ||
| 81 | + | func init() { | |
| 82 | + | core.SetPackageName("GSK", "gtk4") | |
| 83 | + | core.SetSharedLibraries("GSK", []string{"libgtk-4.so.1"}) | |
| 84 | + | var libs []uintptr | |
| 85 | + | for _, libPath := range core.GetPaths("GSK") { | |
| 86 | + | lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) | |
| 87 | + | if err != nil { | |
| 88 | + | panic(err) | |
| 89 | + | } | |
| 90 | + | libs = append(libs, lib) | |
| 91 | + | } | |
| 92 | + | ||
| 93 | + | core.PuregoSafeRegister(&xComponentTransferNodeGLibType, libs, "gsk_component_transfer_node_get_type") | |
| 94 | + | ||
| 95 | + | core.PuregoSafeRegister(&xNewComponentTransferNode, libs, "gsk_component_transfer_node_new") | |
| 96 | + | ||
| 97 | + | core.PuregoSafeRegister(&xComponentTransferNodeGetChild, libs, "gsk_component_transfer_node_get_child") | |
| 98 | + | core.PuregoSafeRegister(&xComponentTransferNodeGetTransfer, libs, "gsk_component_transfer_node_get_transfer") | |
| 99 | + | ||
| 100 | + | } | |
M v4/gtk/gtkapplication.go +3 -6
| @@ -168,10 +168,8 @@ const ( | |||
| 168 | 168 | // [A simple example](https://gitlab.gnome.org/GNOME/gtk/tree/main/examples/bp/bloatpad.c) | |
| 169 | 169 | // is available in the GTK source code repository | |
| 170 | 170 | // | |
| 171 | - | // `GtkApplication` optionally registers with a session manager of the | |
| 172 | - | // users session (if you set the [property@Gtk.Application:register-session] | |
| 173 | - | // property) and offers various functionality related to the session | |
| 174 | - | // life-cycle. | |
| 171 | + | // `GtkApplication` registers with a session manager if possible and | |
| 172 | + | // offers various functionality related to the session life-cycle. | |
| 175 | 173 | // | |
| 176 | 174 | // An application can block various ways to end the session with | |
| 177 | 175 | // the [method@Gtk.Application.inhibit] function. Typical use cases for | |
| @@ -520,8 +518,7 @@ func (c *Application) SetGoPointer(ptr uintptr) { | |||
| 520 | 518 | ||
| 521 | 519 | // Emitted when the session manager is about to end the session. | |
| 522 | 520 | // | |
| 523 | - | // This signal is only emitted if [property@Gtk.Application:register-session] | |
| 524 | - | // is true. Applications can connect to this signal and call | |
| 521 | + | // Applications can connect to this signal and call | |
| 525 | 522 | // [method@Gtk.Application.inhibit] with [flags@Gtk.ApplicationInhibitFlags.logout] | |
| 526 | 523 | // to delay the end of the session until state has been saved. | |
| 527 | 524 | func (x *Application) ConnectQueryEnd(cb *func(Application)) uint32 { | |
M v4/gtk/gtkcalendar.go +23 -15
| @@ -22,17 +22,15 @@ import ( | |||
| 22 | 22 | // | |
| 23 | 23 | // A `GtkCalendar` can be created with [ctor@Gtk.Calendar.new]. | |
| 24 | 24 | // | |
| 25 | - | // The date that is currently displayed can be altered with | |
| 26 | - | // [method@Gtk.Calendar.select_day]. | |
| 25 | + | // The selected date can be retrieved from a `GtkCalendar` using | |
| 26 | + | // [method@Gtk.Calendar.get_date]. | |
| 27 | + | // It can be altered with [method@Gtk.Calendar.set_date]. | |
| 27 | 28 | // | |
| 28 | 29 | // To place a visual marker on a particular day, use | |
| 29 | 30 | // [method@Gtk.Calendar.mark_day] and to remove the marker, | |
| 30 | 31 | // [method@Gtk.Calendar.unmark_day]. Alternative, all | |
| 31 | 32 | // marks can be cleared with [method@Gtk.Calendar.clear_marks]. | |
| 32 | 33 | // | |
| 33 | - | // The selected date can be retrieved from a `GtkCalendar` using | |
| 34 | - | // [method@Gtk.Calendar.get_date]. | |
| 35 | - | // | |
| 36 | 34 | // Users should be aware that, although the Gregorian calendar is the | |
| 37 | 35 | // legal calendar in most countries, it was adopted progressively | |
| 38 | 36 | // between 1582 and 1929. Display before these dates is likely to be | |
| @@ -219,12 +217,21 @@ func (x *Calendar) SelectDay(DateVar *glib.DateTime) { | |||
| 219 | 217 | ||
| 220 | 218 | } | |
| 221 | 219 | ||
| 220 | + | var xCalendarSetDate func(uintptr, *glib.DateTime) | |
| 221 | + | ||
| 222 | + | // Switches to @date's year and month and selects its day. | |
| 223 | + | func (x *Calendar) SetDate(DateVar *glib.DateTime) { | |
| 224 | + | ||
| 225 | + | xCalendarSetDate(x.GoPointer(), DateVar) | |
| 226 | + | ||
| 227 | + | } | |
| 228 | + | ||
| 222 | 229 | var xCalendarSetDay func(uintptr, int) | |
| 223 | 230 | ||
| 224 | 231 | // Sets the day for the selected date. | |
| 225 | 232 | // | |
| 226 | - | // The new date must be valid. For example, setting 31 for the day when the | |
| 227 | - | // month is February, fails. | |
| 233 | + | // The new date must be valid. For example, setting the day to 31 when the | |
| 234 | + | // month is February will fail. | |
| 228 | 235 | func (x *Calendar) SetDay(DayVar int) { | |
| 229 | 236 | ||
| 230 | 237 | xCalendarSetDay(x.GoPointer(), DayVar) | |
| @@ -235,8 +242,8 @@ var xCalendarSetMonth func(uintptr, int) | |||
| 235 | 242 | ||
| 236 | 243 | // Sets the month for the selected date. | |
| 237 | 244 | // | |
| 238 | - | // The new date must be valid. For example, setting 1 (February) for the month | |
| 239 | - | // when the day is 31, fails. | |
| 245 | + | // The new date must be valid. For example, setting the month to 1 (February) | |
| 246 | + | // when the day is 31 will fail. | |
| 240 | 247 | func (x *Calendar) SetMonth(MonthVar int) { | |
| 241 | 248 | ||
| 242 | 249 | xCalendarSetMonth(x.GoPointer(), MonthVar) | |
| @@ -277,8 +284,8 @@ var xCalendarSetYear func(uintptr, int) | |||
| 277 | 284 | ||
| 278 | 285 | // Sets the year for the selected date. | |
| 279 | 286 | // | |
| 280 | - | // The new date must be valid. For example, setting 2023 for the year when then | |
| 281 | - | // the date is 2024-02-29, fails. | |
| 287 | + | // The new date must be valid. For example, setting the year to 2023 when the | |
| 288 | + | // date is February 29 will fail. | |
| 282 | 289 | func (x *Calendar) SetYear(YearVar int) { | |
| 283 | 290 | ||
| 284 | 291 | xCalendarSetYear(x.GoPointer(), YearVar) | |
| @@ -325,7 +332,7 @@ func (x *Calendar) ConnectDaySelected(cb *func(Calendar)) uint32 { | |||
| 325 | 332 | return gobject.SignalConnect(x.GoPointer(), "day-selected", cbRefPtr) | |
| 326 | 333 | } | |
| 327 | 334 | ||
| 328 | - | // Emitted when the user switched to the next month. | |
| 335 | + | // Emitted when the user switches to the next month. | |
| 329 | 336 | func (x *Calendar) ConnectNextMonth(cb *func(Calendar)) uint32 { | |
| 330 | 337 | cbPtr := uintptr(unsafe.Pointer(cb)) | |
| 331 | 338 | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |
| @@ -345,7 +352,7 @@ func (x *Calendar) ConnectNextMonth(cb *func(Calendar)) uint32 { | |||
| 345 | 352 | return gobject.SignalConnect(x.GoPointer(), "next-month", cbRefPtr) | |
| 346 | 353 | } | |
| 347 | 354 | ||
| 348 | - | // Emitted when user switched to the next year. | |
| 355 | + | // Emitted when user switches to the next year. | |
| 349 | 356 | func (x *Calendar) ConnectNextYear(cb *func(Calendar)) uint32 { | |
| 350 | 357 | cbPtr := uintptr(unsafe.Pointer(cb)) | |
| 351 | 358 | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |
| @@ -365,7 +372,7 @@ func (x *Calendar) ConnectNextYear(cb *func(Calendar)) uint32 { | |||
| 365 | 372 | return gobject.SignalConnect(x.GoPointer(), "next-year", cbRefPtr) | |
| 366 | 373 | } | |
| 367 | 374 | ||
| 368 | - | // Emitted when the user switched to the previous month. | |
| 375 | + | // Emitted when the user switches to the previous month. | |
| 369 | 376 | func (x *Calendar) ConnectPrevMonth(cb *func(Calendar)) uint32 { | |
| 370 | 377 | cbPtr := uintptr(unsafe.Pointer(cb)) | |
| 371 | 378 | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |
| @@ -385,7 +392,7 @@ func (x *Calendar) ConnectPrevMonth(cb *func(Calendar)) uint32 { | |||
| 385 | 392 | return gobject.SignalConnect(x.GoPointer(), "prev-month", cbRefPtr) | |
| 386 | 393 | } | |
| 387 | 394 | ||
| 388 | - | // Emitted when user switched to the previous year. | |
| 395 | + | // Emitted when user switches to the previous year. | |
| 389 | 396 | func (x *Calendar) ConnectPrevYear(cb *func(Calendar)) uint32 { | |
| 390 | 397 | cbPtr := uintptr(unsafe.Pointer(cb)) | |
| 391 | 398 | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |
| @@ -710,6 +717,7 @@ func init() { | |||
| 710 | 717 | core.PuregoSafeRegister(&xCalendarGetYear, libs, "gtk_calendar_get_year") | |
| 711 | 718 | core.PuregoSafeRegister(&xCalendarMarkDay, libs, "gtk_calendar_mark_day") | |
| 712 | 719 | core.PuregoSafeRegister(&xCalendarSelectDay, libs, "gtk_calendar_select_day") | |
| 720 | + | core.PuregoSafeRegister(&xCalendarSetDate, libs, "gtk_calendar_set_date") | |
| 713 | 721 | core.PuregoSafeRegister(&xCalendarSetDay, libs, "gtk_calendar_set_day") | |
| 714 | 722 | core.PuregoSafeRegister(&xCalendarSetMonth, libs, "gtk_calendar_set_month") | |
| 715 | 723 | core.PuregoSafeRegister(&xCalendarSetShowDayNames, libs, "gtk_calendar_set_show_day_names") | |
M v4/gtk/gtkcolordialog.go +3 -0
| @@ -79,6 +79,9 @@ func (x *ColorDialog) ChooseRgba(ParentVar *Window, InitialColorVar *gdk.RGBA, C | |||
| 79 | 79 | var xColorDialogChooseRgbaFinish func(uintptr, uintptr, **glib.Error) *gdk.RGBA | |
| 80 | 80 | ||
| 81 | 81 | // Finishes the [method@Gtk.ColorDialog.choose_rgba] call | |
| 82 | + | // | |
| 83 | + | // Note that this function returns a [error@Gtk.DialogError.DISMISSED] | |
| 84 | + | // error if the user cancels the dialog. | |
| 82 | 85 | func (x *ColorDialog) ChooseRgbaFinish(ResultVar gio.AsyncResult) (*gdk.RGBA, error) { | |
| 83 | 86 | var cerr *glib.Error | |
| 84 | 87 | ||
M v4/gtk/gtkdebug.go +4 -2
| @@ -36,7 +36,7 @@ const ( | |||
| 36 | 36 | DebugIconthemeValue DebugFlags = 32 | |
| 37 | 37 | // Information about printing | |
| 38 | 38 | DebugPrintingValue DebugFlags = 64 | |
| 39 | - | ||
| 39 | + | // Trace GtkBuilder operation | |
| 40 | 40 | DebugBuilderTraceValue DebugFlags = 128 | |
| 41 | 41 | // Information about size requests | |
| 42 | 42 | DebugSizeRequestValue DebugFlags = 256 | |
| @@ -44,6 +44,8 @@ const ( | |||
| 44 | 44 | DebugNoCssCacheValue DebugFlags = 512 | |
| 45 | 45 | // Open the GTK inspector | |
| 46 | 46 | DebugInteractiveValue DebugFlags = 1024 | |
| 47 | + | // Show touch UI elements for pointer events. | |
| 48 | + | DebugTouchscreenValue DebugFlags = 2048 | |
| 47 | 49 | // Information about actions and menu models | |
| 48 | 50 | DebugActionsValue DebugFlags = 4096 | |
| 49 | 51 | // Information from layout managers | |
| @@ -62,7 +64,7 @@ const ( | |||
| 62 | 64 | DebugInvertTextDirValue DebugFlags = 524288 | |
| 63 | 65 | // Information about deprecated CSS features. | |
| 64 | 66 | DebugCssValue DebugFlags = 1048576 | |
| 65 | - | // Trace GtkBuilder operation | |
| 67 | + | // Information about deprecated GtkBuilder features. | |
| 66 | 68 | DebugBuilderValue DebugFlags = 2097152 | |
| 67 | 69 | ) | |
| 68 | 70 | ||
M v4/gtk/gtkentry.go +30 -0
| @@ -499,6 +499,20 @@ func (x *Entry) GetMaxLength() int { | |||
| 499 | 499 | return cret | |
| 500 | 500 | } | |
| 501 | 501 | ||
| 502 | + | var xEntryGetMenuEntryIconText func(uintptr, EntryIconPosition) string | |
| 503 | + | ||
| 504 | + | // Gets the text that will be used in the context menu of the `GtkEntry` | |
| 505 | + | // when the specified icon is activatable. Selecting this item in the menu | |
| 506 | + | // results, from all aspects, the same than clicking on the specified icon. | |
| 507 | + | // This greatly simplifies making accessible applications, because the icons | |
| 508 | + | // aren't focusable when using keyboard navigation. This is why Gtk recommends | |
| 509 | + | // to add the same action to the context menu. | |
| 510 | + | func (x *Entry) GetMenuEntryIconText(IconPosVar EntryIconPosition) string { | |
| 511 | + | ||
| 512 | + | cret := xEntryGetMenuEntryIconText(x.GoPointer(), IconPosVar) | |
| 513 | + | return cret | |
| 514 | + | } | |
| 515 | + | ||
| 502 | 516 | var xEntryGetOverwriteMode func(uintptr) bool | |
| 503 | 517 | ||
| 504 | 518 | // Gets whether the `GtkEntry` is in overwrite mode. | |
| @@ -868,6 +882,20 @@ func (x *Entry) SetMaxLength(MaxVar int) { | |||
| 868 | 882 | ||
| 869 | 883 | } | |
| 870 | 884 | ||
| 885 | + | var xEntrySetMenuEntryIconText func(uintptr, EntryIconPosition, string) | |
| 886 | + | ||
| 887 | + | // Sets the text that will be used in the context menu of the `GtkEntry` | |
| 888 | + | // when the specified icon is activatable. Selecting this item in the menu | |
| 889 | + | // results, from all aspects, the same than clicking on the specified icon. | |
| 890 | + | // This greatly simplifies making accessible applications, because the icons | |
| 891 | + | // aren't focusable when using keyboard navigation. This is why Gtk recommends | |
| 892 | + | // to add the same action to the context menu. | |
| 893 | + | func (x *Entry) SetMenuEntryIconText(IconPosVar EntryIconPosition, TextVar string) { | |
| 894 | + | ||
| 895 | + | xEntrySetMenuEntryIconText(x.GoPointer(), IconPosVar, TextVar) | |
| 896 | + | ||
| 897 | + | } | |
| 898 | + | ||
| 871 | 899 | var xEntrySetOverwriteMode func(uintptr, bool) | |
| 872 | 900 | ||
| 873 | 901 | // Sets whether the text is overwritten when typing in the `GtkEntry`. | |
| @@ -1647,6 +1675,7 @@ func init() { | |||
| 1647 | 1675 | core.PuregoSafeRegister(&xEntryGetInputPurpose, libs, "gtk_entry_get_input_purpose") | |
| 1648 | 1676 | core.PuregoSafeRegister(&xEntryGetInvisibleChar, libs, "gtk_entry_get_invisible_char") | |
| 1649 | 1677 | core.PuregoSafeRegister(&xEntryGetMaxLength, libs, "gtk_entry_get_max_length") | |
| 1678 | + | core.PuregoSafeRegister(&xEntryGetMenuEntryIconText, libs, "gtk_entry_get_menu_entry_icon_text") | |
| 1650 | 1679 | core.PuregoSafeRegister(&xEntryGetOverwriteMode, libs, "gtk_entry_get_overwrite_mode") | |
| 1651 | 1680 | core.PuregoSafeRegister(&xEntryGetPlaceholderText, libs, "gtk_entry_get_placeholder_text") | |
| 1652 | 1681 | core.PuregoSafeRegister(&xEntryGetProgressFraction, libs, "gtk_entry_get_progress_fraction") | |
| @@ -1676,6 +1705,7 @@ func init() { | |||
| 1676 | 1705 | core.PuregoSafeRegister(&xEntrySetInputPurpose, libs, "gtk_entry_set_input_purpose") | |
| 1677 | 1706 | core.PuregoSafeRegister(&xEntrySetInvisibleChar, libs, "gtk_entry_set_invisible_char") | |
| 1678 | 1707 | core.PuregoSafeRegister(&xEntrySetMaxLength, libs, "gtk_entry_set_max_length") | |
| 1708 | + | core.PuregoSafeRegister(&xEntrySetMenuEntryIconText, libs, "gtk_entry_set_menu_entry_icon_text") | |
| 1679 | 1709 | core.PuregoSafeRegister(&xEntrySetOverwriteMode, libs, "gtk_entry_set_overwrite_mode") | |
| 1680 | 1710 | core.PuregoSafeRegister(&xEntrySetPlaceholderText, libs, "gtk_entry_set_placeholder_text") | |
| 1681 | 1711 | core.PuregoSafeRegister(&xEntrySetProgressFraction, libs, "gtk_entry_set_progress_fraction") | |
M v4/gtk/gtkenums.go +62 -2
| @@ -360,7 +360,7 @@ const ( | |||
| 360 | 360 | // Value type: double | |
| 361 | 361 | AccessiblePropertyValueNowValue AccessibleProperty = 17 | |
| 362 | 362 | // Defines the human readable text alternative | |
| 363 | - | // of aria-valuenow for a range widget. Value type: string | |
| 363 | + | // of [enum@Gtk.AccessibleProperty.VALUE_NOW] for a range widget. Value type: string | |
| 364 | 364 | AccessiblePropertyValueTextValue AccessibleProperty = 18 | |
| 365 | 365 | // Defines a string value that provides a description of non-standard keyboard | |
| 366 | 366 | // interactions of the current element. Value type: string | |
| @@ -434,7 +434,7 @@ const ( | |||
| 434 | 434 | // Value type: integer | |
| 435 | 435 | AccessibleRelationRowIndexValue AccessibleRelation = 14 | |
| 436 | 436 | // Defines a human readable text | |
| 437 | - | // alternative of aria-rowindex. Value type: string | |
| 437 | + | // alternative of [enum@Gtk.AccessibleRelation.ROW_INDEX]. Value type: string | |
| 438 | 438 | AccessibleRelationRowIndexTextValue AccessibleRelation = 15 | |
| 439 | 439 | // Defines the number of rows spanned by a | |
| 440 | 440 | // cell or gridcell within a table, grid, or treegrid. Value type: integer | |
| @@ -1231,6 +1231,62 @@ const ( | |||
| 1231 | 1231 | InputPurposeTerminalValue InputPurpose = 10 | |
| 1232 | 1232 | ) | |
| 1233 | 1233 | ||
| 1234 | + | // Values for the [property@Gtk.Settings:gtk-interface-color-scheme] | |
| 1235 | + | // and [property@Gtk.CssProvider:prefers-color-scheme] properties | |
| 1236 | + | // that indicates what color scheme is used. | |
| 1237 | + | // | |
| 1238 | + | // This information can be used inside CSS via media queries. | |
| 1239 | + | // | |
| 1240 | + | // More values may be added to this enumeration. Unknown values | |
| 1241 | + | // should be treated the same as `GTK_INTERFACE_COLOR_SCHEME_DEFAULT`. | |
| 1242 | + | type InterfaceColorScheme int | |
| 1243 | + | ||
| 1244 | + | var xInterfaceColorSchemeGLibType func() types.GType | |
| 1245 | + | ||
| 1246 | + | func InterfaceColorSchemeGLibType() types.GType { | |
| 1247 | + | return xInterfaceColorSchemeGLibType() | |
| 1248 | + | } | |
| 1249 | + | ||
| 1250 | + | const ( | |
| 1251 | + | ||
| 1252 | + | // The system doesn't support color schemes | |
| 1253 | + | InterfaceColorSchemeUnsupportedValue InterfaceColorScheme = 0 | |
| 1254 | + | // The default color scheme is used | |
| 1255 | + | InterfaceColorSchemeDefaultValue InterfaceColorScheme = 1 | |
| 1256 | + | // A dark color scheme is used | |
| 1257 | + | InterfaceColorSchemeDarkValue InterfaceColorScheme = 2 | |
| 1258 | + | // A light color scheme is used | |
| 1259 | + | InterfaceColorSchemeLightValue InterfaceColorScheme = 3 | |
| 1260 | + | ) | |
| 1261 | + | ||
| 1262 | + | // Values for the [property@Gtk.Settings:gtk-interface-contrast] | |
| 1263 | + | // and [property@Gtk.CssProvider:prefers-contrast] properties | |
| 1264 | + | // that indicates the preferred level of contrast. | |
| 1265 | + | // | |
| 1266 | + | // This information can be used inside CSS via media queries. | |
| 1267 | + | // | |
| 1268 | + | // More values may be added to this enumeration. Unknown values | |
| 1269 | + | // should be treated the same as `GTK_INTERFACE_CONTRAST_NO_PREFERENCE`. | |
| 1270 | + | type InterfaceContrast int | |
| 1271 | + | ||
| 1272 | + | var xInterfaceContrastGLibType func() types.GType | |
| 1273 | + | ||
| 1274 | + | func InterfaceContrastGLibType() types.GType { | |
| 1275 | + | return xInterfaceContrastGLibType() | |
| 1276 | + | } | |
| 1277 | + | ||
| 1278 | + | const ( | |
| 1279 | + | ||
| 1280 | + | // The system doesn't support contrast levels | |
| 1281 | + | InterfaceContrastUnsupportedValue InterfaceContrast = 0 | |
| 1282 | + | // No particular preference for contrast | |
| 1283 | + | InterfaceContrastNoPreferenceValue InterfaceContrast = 1 | |
| 1284 | + | // More contrast is preferred | |
| 1285 | + | InterfaceContrastMoreValue InterfaceContrast = 2 | |
| 1286 | + | // Less contrast is preferred | |
| 1287 | + | InterfaceContrastLessValue InterfaceContrast = 3 | |
| 1288 | + | ) | |
| 1289 | + | ||
| 1234 | 1290 | // Used for justifying the text inside a [class@Label] widget. | |
| 1235 | 1291 | type Justification int | |
| 1236 | 1292 | ||
| @@ -2143,6 +2199,10 @@ func init() { | |||
| 2143 | 2199 | ||
| 2144 | 2200 | core.PuregoSafeRegister(&xInputPurposeGLibType, libs, "gtk_input_purpose_get_type") | |
| 2145 | 2201 | ||
| 2202 | + | core.PuregoSafeRegister(&xInterfaceColorSchemeGLibType, libs, "gtk_interface_color_scheme_get_type") | |
| 2203 | + | ||
| 2204 | + | core.PuregoSafeRegister(&xInterfaceContrastGLibType, libs, "gtk_interface_contrast_get_type") | |
| 2205 | + | ||
| 2146 | 2206 | core.PuregoSafeRegister(&xJustificationGLibType, libs, "gtk_justification_get_type") | |
| 2147 | 2207 | ||
| 2148 | 2208 | core.PuregoSafeRegister(&xLevelBarModeGLibType, libs, "gtk_level_bar_mode_get_type") | |
M v4/gtk/gtkeventcontrollerscroll.go +3 -0
| @@ -42,6 +42,9 @@ const ( | |||
| 42 | 42 | EventControllerScrollDiscreteValue EventControllerScrollFlags = 4 | |
| 43 | 43 | // Emit ::decelerate after continuous scroll finishes. | |
| 44 | 44 | EventControllerScrollKineticValue EventControllerScrollFlags = 8 | |
| 45 | + | // A #GtkEventControllerScrollFlags value to prefer physical direction over | |
| 46 | + | // logical direction (i.e. oblivious to natural scroll). | |
| 47 | + | EventControllerScrollPhysicalDirectionValue EventControllerScrollFlags = 16 | |
| 45 | 48 | // Emit scroll on both axes. | |
| 46 | 49 | EventControllerScrollBothAxesValue EventControllerScrollFlags = 3 | |
| 47 | 50 | ) | |
M v4/gtk/gtkexpander.go +4 -9
| @@ -74,22 +74,17 @@ import ( | |||
| 74 | 74 | // | |
| 75 | 75 | // # GtkExpander as GtkBuildable | |
| 76 | 76 | // | |
| 77 | - | // The `GtkExpander` implementation of the `GtkBuildable` interface supports | |
| 78 | - | // placing a child in the label position by specifying “label” as the | |
| 79 | - | // “type” attribute of a `<child>` element. A normal content child can be | |
| 80 | - | // specified without specifying a `<child>` type attribute. | |
| 81 | - | // | |
| 82 | 77 | // An example of a UI definition fragment with GtkExpander: | |
| 83 | 78 | // | |
| 84 | 79 | // ```xml | |
| 85 | 80 | // <object class="GtkExpander"> | |
| 86 | 81 | // | |
| 87 | - | // <child type="label"> | |
| 82 | + | // <property name="label-widget"> | |
| 88 | 83 | // <object class="GtkLabel" id="expander-label"/> | |
| 89 | - | // </child> | |
| 90 | - | // <child> | |
| 84 | + | // </property> | |
| 85 | + | // <property name="child"> | |
| 91 | 86 | // <object class="GtkEntry" id="expander-content"/> | |
| 92 | - | // </child> | |
| 87 | + | // </property> | |
| 93 | 88 | // | |
| 94 | 89 | // </object> | |
| 95 | 90 | // ``` | |
M v4/gtk/gtkexpression.go +22 -0
| @@ -455,6 +455,28 @@ func (c *ConstantExpression) SetGoPointer(ptr uintptr) { | |||
| 455 | 455 | // | |
| 456 | 456 | // ``` | |
| 457 | 457 | // | |
| 458 | + | // String (`type='gchararray'`) constants can be marked for translation with the | |
| 459 | + | // `translatable=` attribute, and will then be looked up in the | |
| 460 | + | // [property@Gtk.Builder:translation-domain] when the expression is constructed. | |
| 461 | + | // | |
| 462 | + | // ```xml | |
| 463 | + | // | |
| 464 | + | // <constant type='gchararray' translatable='yes'>I'm translatable!</constant> | |
| 465 | + | // | |
| 466 | + | // ``` | |
| 467 | + | // | |
| 468 | + | // As with other translatable strings in [type@Gtk.Builder], constants can | |
| 469 | + | // also have a context and/or translation comment: | |
| 470 | + | // | |
| 471 | + | // ```xml | |
| 472 | + | // | |
| 473 | + | // <constant type='gchararray' | |
| 474 | + | // translatable='yes' | |
| 475 | + | // context='example' | |
| 476 | + | // comments='A sample string'>I'm translatable!</constant> | |
| 477 | + | // | |
| 478 | + | // ``` | |
| 479 | + | // | |
| 458 | 480 | // To create a closure expression, use the `<closure>` element. The `function` | |
| 459 | 481 | // attribute specifies what function to use for the closure, and the `type` | |
| 460 | 482 | // attribute specifies its return type. The content of the element contains the | |
M v4/gtk/gtkfilechooserdialog.go +1 -1
| @@ -138,7 +138,7 @@ import ( | |||
| 138 | 138 | // - To save a file under a different name, use %GTK_FILE_CHOOSER_ACTION_SAVE, | |
| 139 | 139 | // and set the existing file with [method@Gtk.FileChooser.set_file]. | |
| 140 | 140 | // | |
| 141 | - | // - To choose a folder instead of a filem use %GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER. | |
| 141 | + | // - To choose a folder instead of a file, use %GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER. | |
| 142 | 142 | // | |
| 143 | 143 | // In general, you should only cause the file chooser to show a specific | |
| 144 | 144 | // folder when it is appropriate to use [method@Gtk.FileChooser.set_file], | |
M v4/gtk/gtkfiledialog.go +32 -8
| @@ -178,7 +178,7 @@ var xFileDialogOpen func(uintptr, uintptr, uintptr, uintptr, uintptr) | |||
| 178 | 178 | // | |
| 179 | 179 | // The file chooser dialog will be set up to select a single file. | |
| 180 | 180 | // | |
| 181 | - | // The @callback will be called when the dialog is dismissed. | |
| 181 | + | // The @callback will be called when the dialog is closed. | |
| 182 | 182 | func (x *FileDialog) Open(ParentVar *Window, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) { | |
| 183 | 183 | ||
| 184 | 184 | xFileDialogOpen(x.GoPointer(), ParentVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar) | |
| @@ -188,6 +188,9 @@ func (x *FileDialog) Open(ParentVar *Window, CancellableVar *gio.Cancellable, Ca | |||
| 188 | 188 | var xFileDialogOpenFinish func(uintptr, uintptr, **glib.Error) uintptr | |
| 189 | 189 | ||
| 190 | 190 | // Finishes the [method@Gtk.FileDialog.open] call. | |
| 191 | + | // | |
| 192 | + | // Note that this function returns a [error@Gtk.DialogError.DISMISSED] | |
| 193 | + | // error if the user cancels the dialog. | |
| 191 | 194 | func (x *FileDialog) OpenFinish(ResultVar gio.AsyncResult) (*gio.FileBase, error) { | |
| 192 | 195 | var cls *gio.FileBase | |
| 193 | 196 | var cerr *glib.Error | |
| @@ -215,7 +218,7 @@ var xFileDialogOpenMultiple func(uintptr, uintptr, uintptr, uintptr, uintptr) | |||
| 215 | 218 | // The file chooser dialog will initially be opened in the directory | |
| 216 | 219 | // [property@Gtk.FileDialog:initial-folder]. | |
| 217 | 220 | // | |
| 218 | - | // The @callback will be called when the dialog is dismissed. | |
| 221 | + | // The @callback will be called when the dialog is closed. | |
| 219 | 222 | func (x *FileDialog) OpenMultiple(ParentVar *Window, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) { | |
| 220 | 223 | ||
| 221 | 224 | xFileDialogOpenMultiple(x.GoPointer(), ParentVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar) | |
| @@ -225,6 +228,9 @@ func (x *FileDialog) OpenMultiple(ParentVar *Window, CancellableVar *gio.Cancell | |||
| 225 | 228 | var xFileDialogOpenMultipleFinish func(uintptr, uintptr, **glib.Error) uintptr | |
| 226 | 229 | ||
| 227 | 230 | // Finishes the [method@Gtk.FileDialog.open] call. | |
| 231 | + | // | |
| 232 | + | // Note that this function returns a [error@Gtk.DialogError.DISMISSED] | |
| 233 | + | // error if the user cancels the dialog. | |
| 228 | 234 | func (x *FileDialog) OpenMultipleFinish(ResultVar gio.AsyncResult) (*gio.ListModelBase, error) { | |
| 229 | 235 | var cls *gio.ListModelBase | |
| 230 | 236 | var cerr *glib.Error | |
| @@ -255,7 +261,7 @@ var xFileDialogOpenMultipleTextFiles func(uintptr, uintptr, uintptr, uintptr, ui | |||
| 255 | 261 | // In contrast to [method@Gtk.FileDialog.open], this function | |
| 256 | 262 | // lets the user select the text encoding for the files, if possible. | |
| 257 | 263 | // | |
| 258 | - | // The @callback will be called when the dialog is dismissed. | |
| 264 | + | // The @callback will be called when the dialog is closed. | |
| 259 | 265 | func (x *FileDialog) OpenMultipleTextFiles(ParentVar *Window, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) { | |
| 260 | 266 | ||
| 261 | 267 | xFileDialogOpenMultipleTextFiles(x.GoPointer(), ParentVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar) | |
| @@ -265,6 +271,9 @@ func (x *FileDialog) OpenMultipleTextFiles(ParentVar *Window, CancellableVar *gi | |||
| 265 | 271 | var xFileDialogOpenMultipleTextFilesFinish func(uintptr, uintptr, string, **glib.Error) uintptr | |
| 266 | 272 | ||
| 267 | 273 | // Finishes the [method@Gtk.FileDialog.open] call. | |
| 274 | + | // | |
| 275 | + | // Note that this function returns a [error@Gtk.DialogError.DISMISSED] | |
| 276 | + | // error if the user cancels the dialog. | |
| 268 | 277 | func (x *FileDialog) OpenMultipleTextFilesFinish(ResultVar gio.AsyncResult, EncodingVar string) (*gio.ListModelBase, error) { | |
| 269 | 278 | var cls *gio.ListModelBase | |
| 270 | 279 | var cerr *glib.Error | |
| @@ -291,7 +300,7 @@ var xFileDialogOpenTextFile func(uintptr, uintptr, uintptr, uintptr, uintptr) | |||
| 291 | 300 | // In contrast to [method@Gtk.FileDialog.open], this function | |
| 292 | 301 | // lets the user select the text encoding for the file, if possible. | |
| 293 | 302 | // | |
| 294 | - | // The @callback will be called when the dialog is dismissed. | |
| 303 | + | // The @callback will be called when the dialog is closed. | |
| 295 | 304 | func (x *FileDialog) OpenTextFile(ParentVar *Window, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) { | |
| 296 | 305 | ||
| 297 | 306 | xFileDialogOpenTextFile(x.GoPointer(), ParentVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar) | |
| @@ -307,6 +316,9 @@ var xFileDialogOpenTextFileFinish func(uintptr, uintptr, string, **glib.Error) u | |||
| 307 | 316 | // for the file, then @encoding will be set to a codeset name that | |
| 308 | 317 | // is suitable for passing to iconv_open(). Otherwise, it will | |
| 309 | 318 | // be `NULL`. | |
| 319 | + | // | |
| 320 | + | // Note that this function returns a [error@Gtk.DialogError.DISMISSED] | |
| 321 | + | // error if the user cancels the dialog. | |
| 310 | 322 | func (x *FileDialog) OpenTextFileFinish(ResultVar gio.AsyncResult, EncodingVar string) (*gio.FileBase, error) { | |
| 311 | 323 | var cls *gio.FileBase | |
| 312 | 324 | var cerr *glib.Error | |
| @@ -331,7 +343,7 @@ var xFileDialogSave func(uintptr, uintptr, uintptr, uintptr, uintptr) | |||
| 331 | 343 | // | |
| 332 | 344 | // The file chooser dialog will be save mode. | |
| 333 | 345 | // | |
| 334 | - | // The @callback will be called when the dialog is dismissed. | |
| 346 | + | // The @callback will be called when the dialog is closed. | |
| 335 | 347 | func (x *FileDialog) Save(ParentVar *Window, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) { | |
| 336 | 348 | ||
| 337 | 349 | xFileDialogSave(x.GoPointer(), ParentVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar) | |
| @@ -341,6 +353,9 @@ func (x *FileDialog) Save(ParentVar *Window, CancellableVar *gio.Cancellable, Ca | |||
| 341 | 353 | var xFileDialogSaveFinish func(uintptr, uintptr, **glib.Error) uintptr | |
| 342 | 354 | ||
| 343 | 355 | // Finishes the [method@Gtk.FileDialog.save] call. | |
| 356 | + | // | |
| 357 | + | // Note that this function returns a [error@Gtk.DialogError.DISMISSED] | |
| 358 | + | // error if the user cancels the dialog. | |
| 344 | 359 | func (x *FileDialog) SaveFinish(ResultVar gio.AsyncResult) (*gio.FileBase, error) { | |
| 345 | 360 | var cls *gio.FileBase | |
| 346 | 361 | var cerr *glib.Error | |
| @@ -368,7 +383,7 @@ var xFileDialogSaveTextFile func(uintptr, uintptr, uintptr, uintptr, uintptr) | |||
| 368 | 383 | // lets the user select the text encoding and line endings for | |
| 369 | 384 | // the text file, if possible. | |
| 370 | 385 | // | |
| 371 | - | // The @callback will be called when the dialog is dismissed. | |
| 386 | + | // The @callback will be called when the dialog is closed. | |
| 372 | 387 | func (x *FileDialog) SaveTextFile(ParentVar *Window, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) { | |
| 373 | 388 | ||
| 374 | 389 | xFileDialogSaveTextFile(x.GoPointer(), ParentVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar) | |
| @@ -387,6 +402,9 @@ var xFileDialogSaveTextFileFinish func(uintptr, uintptr, string, string, **glib. | |||
| 387 | 402 | // | |
| 388 | 403 | // The @line_ending will be set to one of "\n", "\r\n", "\r" or "", | |
| 389 | 404 | // where the latter means to preserve existing line endings. | |
| 405 | + | // | |
| 406 | + | // Note that this function returns a [error@Gtk.DialogError.DISMISSED] | |
| 407 | + | // error if the user cancels the dialog. | |
| 390 | 408 | func (x *FileDialog) SaveTextFileFinish(ResultVar gio.AsyncResult, EncodingVar string, LineEndingVar string) (*gio.FileBase, error) { | |
| 391 | 409 | var cls *gio.FileBase | |
| 392 | 410 | var cerr *glib.Error | |
| @@ -415,7 +433,7 @@ var xFileDialogSelectFolder func(uintptr, uintptr, uintptr, uintptr, uintptr) | |||
| 415 | 433 | // be opened in the parent directory of that folder, otherwise, it | |
| 416 | 434 | // will be in the directory [property@Gtk.FileDialog:initial-folder]. | |
| 417 | 435 | // | |
| 418 | - | // The @callback will be called when the dialog is dismissed. | |
| 436 | + | // The @callback will be called when the dialog is closed. | |
| 419 | 437 | func (x *FileDialog) SelectFolder(ParentVar *Window, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) { | |
| 420 | 438 | ||
| 421 | 439 | xFileDialogSelectFolder(x.GoPointer(), ParentVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar) | |
| @@ -425,6 +443,9 @@ func (x *FileDialog) SelectFolder(ParentVar *Window, CancellableVar *gio.Cancell | |||
| 425 | 443 | var xFileDialogSelectFolderFinish func(uintptr, uintptr, **glib.Error) uintptr | |
| 426 | 444 | ||
| 427 | 445 | // Finishes the [method@Gtk.FileDialog.select_folder] call. | |
| 446 | + | // | |
| 447 | + | // Note that this function returns a [error@Gtk.DialogError.DISMISSED] | |
| 448 | + | // error if the user cancels the dialog. | |
| 428 | 449 | func (x *FileDialog) SelectFolderFinish(ResultVar gio.AsyncResult) (*gio.FileBase, error) { | |
| 429 | 450 | var cls *gio.FileBase | |
| 430 | 451 | var cerr *glib.Error | |
| @@ -453,7 +474,7 @@ var xFileDialogSelectMultipleFolders func(uintptr, uintptr, uintptr, uintptr, ui | |||
| 453 | 474 | // The file chooser dialog will initially be opened in the | |
| 454 | 475 | // directory [property@Gtk.FileDialog:initial-folder]. | |
| 455 | 476 | // | |
| 456 | - | // The @callback will be called when the dialog is dismissed. | |
| 477 | + | // The @callback will be called when the dialog is closed. | |
| 457 | 478 | func (x *FileDialog) SelectMultipleFolders(ParentVar *Window, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) { | |
| 458 | 479 | ||
| 459 | 480 | xFileDialogSelectMultipleFolders(x.GoPointer(), ParentVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar) | |
| @@ -463,6 +484,9 @@ func (x *FileDialog) SelectMultipleFolders(ParentVar *Window, CancellableVar *gi | |||
| 463 | 484 | var xFileDialogSelectMultipleFoldersFinish func(uintptr, uintptr, **glib.Error) uintptr | |
| 464 | 485 | ||
| 465 | 486 | // Finishes the [method@Gtk.FileDialog.select_multiple_folders] call. | |
| 487 | + | // | |
| 488 | + | // Note that this function returns a [error@Gtk.DialogError.DISMISSED] | |
| 489 | + | // error if the user cancels the dialog. | |
| 466 | 490 | func (x *FileDialog) SelectMultipleFoldersFinish(ResultVar gio.AsyncResult) (*gio.ListModelBase, error) { | |
| 467 | 491 | var cls *gio.ListModelBase | |
| 468 | 492 | var cerr *glib.Error | |
M v4/gtk/gtkfilter.go +17 -0
| @@ -278,6 +278,8 @@ func (x *FilterClass) GetGtkReserved8() func() { | |||
| 278 | 278 | // If you are writing an implementation and are not sure which | |
| 279 | 279 | // value to pass, `GTK_FILTER_CHANGE_DIFFERENT` is always a correct | |
| 280 | 280 | // choice. | |
| 281 | + | // | |
| 282 | + | // New values may be added in the future. | |
| 281 | 283 | type FilterChange int | |
| 282 | 284 | ||
| 283 | 285 | var xFilterChangeGLibType func() types.GType | |
| @@ -299,6 +301,21 @@ const ( | |||
| 299 | 301 | // it was before: All items that it used to return false | |
| 300 | 302 | // still return false, others now may, too. | |
| 301 | 303 | FilterChangeMoreStrictValue FilterChange = 2 | |
| 304 | + | // Similar to [enum@Gtk.FilterChange.DIFFERENT], | |
| 305 | + | // but signs that item watches should be recreated. This is used by | |
| 306 | + | // [class@Gtk.FilterListModel] to keep the list up-to-date when items | |
| 307 | + | // change. | |
| 308 | + | FilterChangeDifferentRewatchValue FilterChange = 3 | |
| 309 | + | // Similar to [enum@Gtk.FilterChange.LESS_STRICT], | |
| 310 | + | // but signs that item watches should be recreated. This is used by | |
| 311 | + | // [class@Gtk.FilterListModel] to keep the list up-to-date when items | |
| 312 | + | // change. | |
| 313 | + | FilterChangeLessStrictRewatchValue FilterChange = 4 | |
| 314 | + | // Similar to [enum@Gtk.FilterChange.MORE_STRICT], | |
| 315 | + | // but signs that item watches should be recreated. This is used by | |
| 316 | + | // [class@Gtk.FilterListModel] to keep the list up-to-date when items | |
| 317 | + | // change. | |
| 318 | + | FilterChangeMoreStrictRewatchValue FilterChange = 5 | |
| 302 | 319 | ) | |
| 303 | 320 | ||
| 304 | 321 | // Describes the known strictness of a filter. | |
M v4/gtk/gtkfilterlistmodel.go +28 -0
| @@ -134,6 +134,17 @@ func (x *FilterListModel) GetPending() uint { | |||
| 134 | 134 | return cret | |
| 135 | 135 | } | |
| 136 | 136 | ||
| 137 | + | var xFilterListModelGetWatchItems func(uintptr) bool | |
| 138 | + | ||
| 139 | + | // Returns whether watching items is enabled. | |
| 140 | + | // | |
| 141 | + | // See [method@Gtk.FilterListModel.set_watch_items]. | |
| 142 | + | func (x *FilterListModel) GetWatchItems() bool { | |
| 143 | + | ||
| 144 | + | cret := xFilterListModelGetWatchItems(x.GoPointer()) | |
| 145 | + | return cret | |
| 146 | + | } | |
| 147 | + | ||
| 137 | 148 | var xFilterListModelSetFilter func(uintptr, uintptr) | |
| 138 | 149 | ||
| 139 | 150 | // Sets the filter used to filter items. | |
| @@ -181,6 +192,21 @@ func (x *FilterListModel) SetModel(ModelVar gio.ListModel) { | |||
| 181 | 192 | ||
| 182 | 193 | } | |
| 183 | 194 | ||
| 195 | + | var xFilterListModelSetWatchItems func(uintptr, bool) | |
| 196 | + | ||
| 197 | + | // Sets the filter model to monitor properties of its items. | |
| 198 | + | // | |
| 199 | + | // This allows implementations of [class@Gtk.Filter] that support expression | |
| 200 | + | // watching to react to property changes. This property has no effect if the | |
| 201 | + | // current filter doesn't support watching items. | |
| 202 | + | // | |
| 203 | + | // By default, watching items is disabled. | |
| 204 | + | func (x *FilterListModel) SetWatchItems(WatchItemsVar bool) { | |
| 205 | + | ||
| 206 | + | xFilterListModelSetWatchItems(x.GoPointer(), WatchItemsVar) | |
| 207 | + | ||
| 208 | + | } | |
| 209 | + | ||
| 184 | 210 | func (c *FilterListModel) GoPointer() uintptr { | |
| 185 | 211 | if c == nil { | |
| 186 | 212 | return 0 | |
| @@ -335,8 +361,10 @@ func init() { | |||
| 335 | 361 | core.PuregoSafeRegister(&xFilterListModelGetIncremental, libs, "gtk_filter_list_model_get_incremental") | |
| 336 | 362 | core.PuregoSafeRegister(&xFilterListModelGetModel, libs, "gtk_filter_list_model_get_model") | |
| 337 | 363 | core.PuregoSafeRegister(&xFilterListModelGetPending, libs, "gtk_filter_list_model_get_pending") | |
| 364 | + | core.PuregoSafeRegister(&xFilterListModelGetWatchItems, libs, "gtk_filter_list_model_get_watch_items") | |
| 338 | 365 | core.PuregoSafeRegister(&xFilterListModelSetFilter, libs, "gtk_filter_list_model_set_filter") | |
| 339 | 366 | core.PuregoSafeRegister(&xFilterListModelSetIncremental, libs, "gtk_filter_list_model_set_incremental") | |
| 340 | 367 | core.PuregoSafeRegister(&xFilterListModelSetModel, libs, "gtk_filter_list_model_set_model") | |
| 368 | + | core.PuregoSafeRegister(&xFilterListModelSetWatchItems, libs, "gtk_filter_list_model_set_watch_items") | |
| 341 | 369 | ||
| 342 | 370 | } | |
M v4/gtk/gtkfontdialog.go +11 -3
| @@ -83,6 +83,9 @@ func (x *FontDialog) ChooseFace(ParentVar *Window, InitialValueVar *pango.FontFa | |||
| 83 | 83 | var xFontDialogChooseFaceFinish func(uintptr, uintptr, **glib.Error) uintptr | |
| 84 | 84 | ||
| 85 | 85 | // Finishes the [method@Gtk.FontDialog.choose_face] call. | |
| 86 | + | // | |
| 87 | + | // Note that this function returns a [error@Gtk.DialogError.DISMISSED] | |
| 88 | + | // error if the user cancels the dialog. | |
| 86 | 89 | func (x *FontDialog) ChooseFaceFinish(ResultVar gio.AsyncResult) (*pango.FontFace, error) { | |
| 87 | 90 | var cls *pango.FontFace | |
| 88 | 91 | var cerr *glib.Error | |
| @@ -116,9 +119,8 @@ var xFontDialogChooseFamilyFinish func(uintptr, uintptr, **glib.Error) uintptr | |||
| 116 | 119 | ||
| 117 | 120 | // Finishes the [method@Gtk.FontDialog.choose_family] call. | |
| 118 | 121 | // | |
| 119 | - | // This function never returns an error. If the operation is | |
| 120 | - | // not finished successfully, the value passed as @initial_value | |
| 121 | - | // to [method@Gtk.FontDialog.choose_family] is returned. | |
| 122 | + | // Note that this function returns a [error@Gtk.DialogError.DISMISSED] | |
| 123 | + | // error if the user cancels the dialog. | |
| 122 | 124 | func (x *FontDialog) ChooseFamilyFinish(ResultVar gio.AsyncResult) (*pango.FontFamily, error) { | |
| 123 | 125 | var cls *pango.FontFamily | |
| 124 | 126 | var cerr *glib.Error | |
| @@ -172,6 +174,9 @@ var xFontDialogChooseFontAndFeaturesFinish func(uintptr, uintptr, **pango.FontDe | |||
| 172 | 174 | // | |
| 173 | 175 | // The selected font and features are returned in @font_desc and | |
| 174 | 176 | // @font_features. | |
| 177 | + | // | |
| 178 | + | // Note that this function returns a [error@Gtk.DialogError.DISMISSED] | |
| 179 | + | // error if the user cancels the dialog. | |
| 175 | 180 | func (x *FontDialog) ChooseFontAndFeaturesFinish(ResultVar gio.AsyncResult, FontDescVar **pango.FontDescription, FontFeaturesVar string, LanguageVar **pango.Language) (bool, error) { | |
| 176 | 181 | var cerr *glib.Error | |
| 177 | 182 | ||
| @@ -186,6 +191,9 @@ func (x *FontDialog) ChooseFontAndFeaturesFinish(ResultVar gio.AsyncResult, Font | |||
| 186 | 191 | var xFontDialogChooseFontFinish func(uintptr, uintptr, **glib.Error) *pango.FontDescription | |
| 187 | 192 | ||
| 188 | 193 | // Finishes the [method@Gtk.FontDialog.choose_font] call. | |
| 194 | + | // | |
| 195 | + | // Note that this function returns a [error@Gtk.DialogError.DISMISSED] | |
| 196 | + | // error if the user cancels the dialog. | |
| 189 | 197 | func (x *FontDialog) ChooseFontFinish(ResultVar gio.AsyncResult) (*pango.FontDescription, error) { | |
| 190 | 198 | var cerr *glib.Error | |
| 191 | 199 | ||
M v4/gtk/gtkframe.go +5 -9
| @@ -66,21 +66,17 @@ func (x *FrameClass) GetComputeChildAllocation() func(*Frame, *Allocation) { | |||
| 66 | 66 | // | |
| 67 | 67 | // # GtkFrame as GtkBuildable | |
| 68 | 68 | // | |
| 69 | - | // The `GtkFrame` implementation of the `GtkBuildable` interface supports | |
| 70 | - | // placing a child in the label position by specifying “label” as the | |
| 71 | - | // “type” attribute of a `<child>` element. A normal content child can | |
| 72 | - | // be specified without specifying a `<child>` type attribute. | |
| 73 | - | // | |
| 74 | 69 | // An example of a UI definition fragment with GtkFrame: | |
| 70 | + | // | |
| 75 | 71 | // ```xml | |
| 76 | 72 | // <object class="GtkFrame"> | |
| 77 | 73 | // | |
| 78 | - | // <child type="label"> | |
| 74 | + | // <property name="label-widget"> | |
| 79 | 75 | // <object class="GtkLabel" id="frame_label"/> | |
| 80 | - | // </child> | |
| 81 | - | // <child> | |
| 76 | + | // </property> | |
| 77 | + | // <property name="child"> | |
| 82 | 78 | // <object class="GtkEntry" id="frame_content"/> | |
| 83 | - | // </child> | |
| 79 | + | // </property> | |
| 84 | 80 | // | |
| 85 | 81 | // </object> | |
| 86 | 82 | // ``` | |
A v4/gtk/gtkiconpaintable.go +296 -0
| @@ -0,0 +1,296 @@ | |||
| 1 | + | // Package gtk was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT | |
| 2 | + | package gtk | |
| 3 | + | ||
| 4 | + | import ( | |
| 5 | + | "structs" | |
| 6 | + | "unsafe" | |
| 7 | + | ||
| 8 | + | "github.com/jwijenbergh/purego" | |
| 9 | + | "github.com/jwijenbergh/puregotk/pkg/core" | |
| 10 | + | "github.com/jwijenbergh/puregotk/v4/gdk" | |
| 11 | + | "github.com/jwijenbergh/puregotk/v4/gio" | |
| 12 | + | "github.com/jwijenbergh/puregotk/v4/gobject" | |
| 13 | + | "github.com/jwijenbergh/puregotk/v4/gobject/types" | |
| 14 | + | ) | |
| 15 | + | ||
| 16 | + | type IconPaintableClass struct { | |
| 17 | + | _ structs.HostLayout | |
| 18 | + | ||
| 19 | + | ParentClass gobject.ObjectClass | |
| 20 | + | } | |
| 21 | + | ||
| 22 | + | func (x *IconPaintableClass) GoPointer() uintptr { | |
| 23 | + | return uintptr(unsafe.Pointer(x)) | |
| 24 | + | } | |
| 25 | + | ||
| 26 | + | // Contains information found when looking up an icon in `GtkIconTheme` | |
| 27 | + | // or loading it from a file. | |
| 28 | + | // | |
| 29 | + | // `GtkIconPaintable` implements `GdkPaintable` and `GtkSymbolicPaintable`. | |
| 30 | + | type IconPaintable struct { | |
| 31 | + | gobject.Object | |
| 32 | + | } | |
| 33 | + | ||
| 34 | + | var xIconPaintableGLibType func() types.GType | |
| 35 | + | ||
| 36 | + | func IconPaintableGLibType() types.GType { | |
| 37 | + | return xIconPaintableGLibType() | |
| 38 | + | } | |
| 39 | + | ||
| 40 | + | func IconPaintableNewFromInternalPtr(ptr uintptr) *IconPaintable { | |
| 41 | + | cls := &IconPaintable{} | |
| 42 | + | cls.Ptr = ptr | |
| 43 | + | return cls | |
| 44 | + | } | |
| 45 | + | ||
| 46 | + | var xNewIconPaintableForFile func(uintptr, int, int) uintptr | |
| 47 | + | ||
| 48 | + | // Creates a `GtkIconPaintable` for a file with a given size and scale. | |
| 49 | + | // | |
| 50 | + | // The icon can then be rendered by using it as a `GdkPaintable`. | |
| 51 | + | func NewIconPaintableForFile(FileVar gio.File, SizeVar int, ScaleVar int) *IconPaintable { | |
| 52 | + | var cls *IconPaintable | |
| 53 | + | ||
| 54 | + | cret := xNewIconPaintableForFile(FileVar.GoPointer(), SizeVar, ScaleVar) | |
| 55 | + | ||
| 56 | + | if cret == 0 { | |
| 57 | + | return nil | |
| 58 | + | } | |
| 59 | + | cls = &IconPaintable{} | |
| 60 | + | cls.Ptr = cret | |
| 61 | + | return cls | |
| 62 | + | } | |
| 63 | + | ||
| 64 | + | var xIconPaintableGetFile func(uintptr) uintptr | |
| 65 | + | ||
| 66 | + | // Gets the `GFile` that was used to load the icon. | |
| 67 | + | // | |
| 68 | + | // Returns %NULL if the icon was not loaded from a file. | |
| 69 | + | func (x *IconPaintable) GetFile() *gio.FileBase { | |
| 70 | + | var cls *gio.FileBase | |
| 71 | + | ||
| 72 | + | cret := xIconPaintableGetFile(x.GoPointer()) | |
| 73 | + | ||
| 74 | + | if cret == 0 { | |
| 75 | + | return nil | |
| 76 | + | } | |
| 77 | + | cls = &gio.FileBase{} | |
| 78 | + | cls.Ptr = cret | |
| 79 | + | return cls | |
| 80 | + | } | |
| 81 | + | ||
| 82 | + | var xIconPaintableGetIconName func(uintptr) string | |
| 83 | + | ||
| 84 | + | // Get the icon name being used for this icon. | |
| 85 | + | // | |
| 86 | + | // When an icon looked up in the icon theme was not available, the | |
| 87 | + | // icon theme may use fallback icons - either those specified to | |
| 88 | + | // gtk_icon_theme_lookup_icon() or the always-available | |
| 89 | + | // "image-missing". The icon chosen is returned by this function. | |
| 90 | + | // | |
| 91 | + | // If the icon was created without an icon theme, this function | |
| 92 | + | // returns %NULL. | |
| 93 | + | func (x *IconPaintable) GetIconName() string { | |
| 94 | + | ||
| 95 | + | cret := xIconPaintableGetIconName(x.GoPointer()) | |
| 96 | + | return cret | |
| 97 | + | } | |
| 98 | + | ||
| 99 | + | var xIconPaintableIsSymbolic func(uintptr) bool | |
| 100 | + | ||
| 101 | + | // Checks if the icon is symbolic or not. | |
| 102 | + | // | |
| 103 | + | // This currently uses only the file name and not the file contents | |
| 104 | + | // for determining this. This behaviour may change in the future. | |
| 105 | + | func (x *IconPaintable) IsSymbolic() bool { | |
| 106 | + | ||
| 107 | + | cret := xIconPaintableIsSymbolic(x.GoPointer()) | |
| 108 | + | return cret | |
| 109 | + | } | |
| 110 | + | ||
| 111 | + | func (c *IconPaintable) GoPointer() uintptr { | |
| 112 | + | if c == nil { | |
| 113 | + | return 0 | |
| 114 | + | } | |
| 115 | + | return c.Ptr | |
| 116 | + | } | |
| 117 | + | ||
| 118 | + | func (c *IconPaintable) SetGoPointer(ptr uintptr) { | |
| 119 | + | c.Ptr = ptr | |
| 120 | + | } | |
| 121 | + | ||
| 122 | + | // Compute a concrete size for the `GdkPaintable`. | |
| 123 | + | // | |
| 124 | + | // Applies the sizing algorithm outlined in the | |
| 125 | + | // [CSS Image spec](https://drafts.csswg.org/css-images-3/#default-sizing) | |
| 126 | + | // to the given @paintable. See that link for more details. | |
| 127 | + | // | |
| 128 | + | // It is not necessary to call this function when both @specified_width | |
| 129 | + | // and @specified_height are known, but it is useful to call this | |
| 130 | + | // function in GtkWidget:measure implementations to compute the | |
| 131 | + | // other dimension when only one dimension is given. | |
| 132 | + | func (x *IconPaintable) ComputeConcreteSize(SpecifiedWidthVar float64, SpecifiedHeightVar float64, DefaultWidthVar float64, DefaultHeightVar float64, ConcreteWidthVar float64, ConcreteHeightVar float64) { | |
| 133 | + | ||
| 134 | + | gdk.XGdkPaintableComputeConcreteSize(x.GoPointer(), SpecifiedWidthVar, SpecifiedHeightVar, DefaultWidthVar, DefaultHeightVar, ConcreteWidthVar, ConcreteHeightVar) | |
| 135 | + | ||
| 136 | + | } | |
| 137 | + | ||
| 138 | + | // Gets an immutable paintable for the current contents displayed by @paintable. | |
| 139 | + | // | |
| 140 | + | // This is useful when you want to retain the current state of an animation, | |
| 141 | + | // for example to take a screenshot of a running animation. | |
| 142 | + | // | |
| 143 | + | // If the @paintable is already immutable, it will return itself. | |
| 144 | + | func (x *IconPaintable) GetCurrentImage() *gdk.PaintableBase { | |
| 145 | + | var cls *gdk.PaintableBase | |
| 146 | + | ||
| 147 | + | cret := gdk.XGdkPaintableGetCurrentImage(x.GoPointer()) | |
| 148 | + | ||
| 149 | + | if cret == 0 { | |
| 150 | + | return nil | |
| 151 | + | } | |
| 152 | + | cls = &gdk.PaintableBase{} | |
| 153 | + | cls.Ptr = cret | |
| 154 | + | return cls | |
| 155 | + | } | |
| 156 | + | ||
| 157 | + | // Get flags for the paintable. | |
| 158 | + | // | |
| 159 | + | // This is oftentimes useful for optimizations. | |
| 160 | + | // | |
| 161 | + | // See [flags@Gdk.PaintableFlags] for the flags and what they mean. | |
| 162 | + | func (x *IconPaintable) GetFlags() gdk.PaintableFlags { | |
| 163 | + | ||
| 164 | + | cret := gdk.XGdkPaintableGetFlags(x.GoPointer()) | |
| 165 | + | return cret | |
| 166 | + | } | |
| 167 | + | ||
| 168 | + | // Gets the preferred aspect ratio the @paintable would like to be displayed at. | |
| 169 | + | // | |
| 170 | + | // The aspect ratio is the width divided by the height, so a value of 0.5 | |
| 171 | + | // means that the @paintable prefers to be displayed twice as high as it | |
| 172 | + | // is wide. Consumers of this interface can use this to preserve aspect | |
| 173 | + | // ratio when displaying the paintable. | |
| 174 | + | // | |
| 175 | + | // This is a purely informational value and does not in any way limit the | |
| 176 | + | // values that may be passed to [method@Gdk.Paintable.snapshot]. | |
| 177 | + | // | |
| 178 | + | // Usually when a @paintable returns nonzero values from | |
| 179 | + | // [method@Gdk.Paintable.get_intrinsic_width] and | |
| 180 | + | // [method@Gdk.Paintable.get_intrinsic_height] the aspect ratio | |
| 181 | + | // should conform to those values, though that is not required. | |
| 182 | + | // | |
| 183 | + | // If the @paintable does not have a preferred aspect ratio, | |
| 184 | + | // it returns 0. Negative values are never returned. | |
| 185 | + | func (x *IconPaintable) GetIntrinsicAspectRatio() float64 { | |
| 186 | + | ||
| 187 | + | cret := gdk.XGdkPaintableGetIntrinsicAspectRatio(x.GoPointer()) | |
| 188 | + | return cret | |
| 189 | + | } | |
| 190 | + | ||
| 191 | + | // Gets the preferred height the @paintable would like to be displayed at. | |
| 192 | + | // | |
| 193 | + | // Consumers of this interface can use this to reserve enough space to draw | |
| 194 | + | // the paintable. | |
| 195 | + | // | |
| 196 | + | // This is a purely informational value and does not in any way limit the | |
| 197 | + | // values that may be passed to [method@Gdk.Paintable.snapshot]. | |
| 198 | + | // | |
| 199 | + | // If the @paintable does not have a preferred height, it returns 0. | |
| 200 | + | // Negative values are never returned. | |
| 201 | + | func (x *IconPaintable) GetIntrinsicHeight() int { | |
| 202 | + | ||
| 203 | + | cret := gdk.XGdkPaintableGetIntrinsicHeight(x.GoPointer()) | |
| 204 | + | return cret | |
| 205 | + | } | |
| 206 | + | ||
| 207 | + | // Gets the preferred width the @paintable would like to be displayed at. | |
| 208 | + | // | |
| 209 | + | // Consumers of this interface can use this to reserve enough space to draw | |
| 210 | + | // the paintable. | |
| 211 | + | // | |
| 212 | + | // This is a purely informational value and does not in any way limit the | |
| 213 | + | // values that may be passed to [method@Gdk.Paintable.snapshot]. | |
| 214 | + | // | |
| 215 | + | // If the @paintable does not have a preferred width, it returns 0. | |
| 216 | + | // Negative values are never returned. | |
| 217 | + | func (x *IconPaintable) GetIntrinsicWidth() int { | |
| 218 | + | ||
| 219 | + | cret := gdk.XGdkPaintableGetIntrinsicWidth(x.GoPointer()) | |
| 220 | + | return cret | |
| 221 | + | } | |
| 222 | + | ||
| 223 | + | // Called by implementations of `GdkPaintable` to invalidate their contents. | |
| 224 | + | // | |
| 225 | + | // Unless the contents are invalidated, implementations must guarantee that | |
| 226 | + | // multiple calls of [method@Gdk.Paintable.snapshot] produce the same output. | |
| 227 | + | // | |
| 228 | + | // This function will emit the [signal@Gdk.Paintable::invalidate-contents] | |
| 229 | + | // signal. | |
| 230 | + | // | |
| 231 | + | // If a @paintable reports the %GDK_PAINTABLE_STATIC_CONTENTS flag, | |
| 232 | + | // it must not call this function. | |
| 233 | + | func (x *IconPaintable) InvalidateContents() { | |
| 234 | + | ||
| 235 | + | gdk.XGdkPaintableInvalidateContents(x.GoPointer()) | |
| 236 | + | ||
| 237 | + | } | |
| 238 | + | ||
| 239 | + | // Called by implementations of `GdkPaintable` to invalidate their size. | |
| 240 | + | // | |
| 241 | + | // As long as the size is not invalidated, @paintable must return the same | |
| 242 | + | // values for its intrinsic width, height and aspect ratio. | |
| 243 | + | // | |
| 244 | + | // This function will emit the [signal@Gdk.Paintable::invalidate-size] | |
| 245 | + | // signal. | |
| 246 | + | // | |
| 247 | + | // If a @paintable reports the %GDK_PAINTABLE_STATIC_SIZE flag, | |
| 248 | + | // it must not call this function. | |
| 249 | + | func (x *IconPaintable) InvalidateSize() { | |
| 250 | + | ||
| 251 | + | gdk.XGdkPaintableInvalidateSize(x.GoPointer()) | |
| 252 | + | ||
| 253 | + | } | |
| 254 | + | ||
| 255 | + | // Snapshots the given paintable with the given @width and @height. | |
| 256 | + | // | |
| 257 | + | // The paintable is drawn at the current (0,0) offset of the @snapshot. | |
| 258 | + | // If @width and @height are not larger than zero, this function will | |
| 259 | + | // do nothing. | |
| 260 | + | func (x *IconPaintable) Snapshot(SnapshotVar *gdk.Snapshot, WidthVar float64, HeightVar float64) { | |
| 261 | + | ||
| 262 | + | gdk.XGdkPaintableSnapshot(x.GoPointer(), SnapshotVar.GoPointer(), WidthVar, HeightVar) | |
| 263 | + | ||
| 264 | + | } | |
| 265 | + | ||
| 266 | + | // Snapshots the paintable with the given colors. | |
| 267 | + | // | |
| 268 | + | // If less than 4 colors are provided, GTK will pad the array with default | |
| 269 | + | // colors. | |
| 270 | + | func (x *IconPaintable) SnapshotSymbolic(SnapshotVar *gdk.Snapshot, WidthVar float64, HeightVar float64, ColorsVar []gdk.RGBA, NColorsVar uint) { | |
| 271 | + | ||
| 272 | + | XGtkSymbolicPaintableSnapshotSymbolic(x.GoPointer(), SnapshotVar.GoPointer(), WidthVar, HeightVar, ColorsVar, NColorsVar) | |
| 273 | + | ||
| 274 | + | } | |
| 275 | + | ||
| 276 | + | func init() { | |
| 277 | + | core.SetPackageName("GTK", "gtk4") | |
| 278 | + | core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"}) | |
| 279 | + | var libs []uintptr | |
| 280 | + | for _, libPath := range core.GetPaths("GTK") { | |
| 281 | + | lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) | |
| 282 | + | if err != nil { | |
| 283 | + | panic(err) | |
| 284 | + | } | |
| 285 | + | libs = append(libs, lib) | |
| 286 | + | } | |
| 287 | + | ||
| 288 | + | core.PuregoSafeRegister(&xIconPaintableGLibType, libs, "gtk_icon_paintable_get_type") | |
| 289 | + | ||
| 290 | + | core.PuregoSafeRegister(&xNewIconPaintableForFile, libs, "gtk_icon_paintable_new_for_file") | |
| 291 | + | ||
| 292 | + | core.PuregoSafeRegister(&xIconPaintableGetFile, libs, "gtk_icon_paintable_get_file") | |
| 293 | + | core.PuregoSafeRegister(&xIconPaintableGetIconName, libs, "gtk_icon_paintable_get_icon_name") | |
| 294 | + | core.PuregoSafeRegister(&xIconPaintableIsSymbolic, libs, "gtk_icon_paintable_is_symbolic") | |
| 295 | + | ||
| 296 | + | } | |
M v4/gtk/gtkicontheme.go +0 -257
| @@ -63,255 +63,6 @@ func IconThemeErrorQuark() glib.Quark { | |||
| 63 | 63 | return cret | |
| 64 | 64 | } | |
| 65 | 65 | ||
| 66 | - | // Contains information found when looking up an icon in `GtkIconTheme`. | |
| 67 | - | // | |
| 68 | - | // `GtkIconPaintable` implements `GdkPaintable`. | |
| 69 | - | type IconPaintable struct { | |
| 70 | - | gobject.Object | |
| 71 | - | } | |
| 72 | - | ||
| 73 | - | var xIconPaintableGLibType func() types.GType | |
| 74 | - | ||
| 75 | - | func IconPaintableGLibType() types.GType { | |
| 76 | - | return xIconPaintableGLibType() | |
| 77 | - | } | |
| 78 | - | ||
| 79 | - | func IconPaintableNewFromInternalPtr(ptr uintptr) *IconPaintable { | |
| 80 | - | cls := &IconPaintable{} | |
| 81 | - | cls.Ptr = ptr | |
| 82 | - | return cls | |
| 83 | - | } | |
| 84 | - | ||
| 85 | - | var xNewIconPaintableForFile func(uintptr, int, int) uintptr | |
| 86 | - | ||
| 87 | - | // Creates a `GtkIconPaintable` for a file with a given size and scale. | |
| 88 | - | // | |
| 89 | - | // The icon can then be rendered by using it as a `GdkPaintable`. | |
| 90 | - | func NewIconPaintableForFile(FileVar gio.File, SizeVar int, ScaleVar int) *IconPaintable { | |
| 91 | - | var cls *IconPaintable | |
| 92 | - | ||
| 93 | - | cret := xNewIconPaintableForFile(FileVar.GoPointer(), SizeVar, ScaleVar) | |
| 94 | - | ||
| 95 | - | if cret == 0 { | |
| 96 | - | return nil | |
| 97 | - | } | |
| 98 | - | cls = &IconPaintable{} | |
| 99 | - | cls.Ptr = cret | |
| 100 | - | return cls | |
| 101 | - | } | |
| 102 | - | ||
| 103 | - | var xIconPaintableGetFile func(uintptr) uintptr | |
| 104 | - | ||
| 105 | - | // Gets the `GFile` that was used to load the icon. | |
| 106 | - | // | |
| 107 | - | // Returns %NULL if the icon was not loaded from a file. | |
| 108 | - | func (x *IconPaintable) GetFile() *gio.FileBase { | |
| 109 | - | var cls *gio.FileBase | |
| 110 | - | ||
| 111 | - | cret := xIconPaintableGetFile(x.GoPointer()) | |
| 112 | - | ||
| 113 | - | if cret == 0 { | |
| 114 | - | return nil | |
| 115 | - | } | |
| 116 | - | cls = &gio.FileBase{} | |
| 117 | - | cls.Ptr = cret | |
| 118 | - | return cls | |
| 119 | - | } | |
| 120 | - | ||
| 121 | - | var xIconPaintableGetIconName func(uintptr) string | |
| 122 | - | ||
| 123 | - | // Get the icon name being used for this icon. | |
| 124 | - | // | |
| 125 | - | // When an icon looked up in the icon theme was not available, the | |
| 126 | - | // icon theme may use fallback icons - either those specified to | |
| 127 | - | // gtk_icon_theme_lookup_icon() or the always-available | |
| 128 | - | // "image-missing". The icon chosen is returned by this function. | |
| 129 | - | // | |
| 130 | - | // If the icon was created without an icon theme, this function | |
| 131 | - | // returns %NULL. | |
| 132 | - | func (x *IconPaintable) GetIconName() string { | |
| 133 | - | ||
| 134 | - | cret := xIconPaintableGetIconName(x.GoPointer()) | |
| 135 | - | return cret | |
| 136 | - | } | |
| 137 | - | ||
| 138 | - | var xIconPaintableIsSymbolic func(uintptr) bool | |
| 139 | - | ||
| 140 | - | // Checks if the icon is symbolic or not. | |
| 141 | - | // | |
| 142 | - | // This currently uses only the file name and not the file contents | |
| 143 | - | // for determining this. This behaviour may change in the future. | |
| 144 | - | func (x *IconPaintable) IsSymbolic() bool { | |
| 145 | - | ||
| 146 | - | cret := xIconPaintableIsSymbolic(x.GoPointer()) | |
| 147 | - | return cret | |
| 148 | - | } | |
| 149 | - | ||
| 150 | - | func (c *IconPaintable) GoPointer() uintptr { | |
| 151 | - | if c == nil { | |
| 152 | - | return 0 | |
| 153 | - | } | |
| 154 | - | return c.Ptr | |
| 155 | - | } | |
| 156 | - | ||
| 157 | - | func (c *IconPaintable) SetGoPointer(ptr uintptr) { | |
| 158 | - | c.Ptr = ptr | |
| 159 | - | } | |
| 160 | - | ||
| 161 | - | // Compute a concrete size for the `GdkPaintable`. | |
| 162 | - | // | |
| 163 | - | // Applies the sizing algorithm outlined in the | |
| 164 | - | // [CSS Image spec](https://drafts.csswg.org/css-images-3/#default-sizing) | |
| 165 | - | // to the given @paintable. See that link for more details. | |
| 166 | - | // | |
| 167 | - | // It is not necessary to call this function when both @specified_width | |
| 168 | - | // and @specified_height are known, but it is useful to call this | |
| 169 | - | // function in GtkWidget:measure implementations to compute the | |
| 170 | - | // other dimension when only one dimension is given. | |
| 171 | - | func (x *IconPaintable) ComputeConcreteSize(SpecifiedWidthVar float64, SpecifiedHeightVar float64, DefaultWidthVar float64, DefaultHeightVar float64, ConcreteWidthVar float64, ConcreteHeightVar float64) { | |
| 172 | - | ||
| 173 | - | gdk.XGdkPaintableComputeConcreteSize(x.GoPointer(), SpecifiedWidthVar, SpecifiedHeightVar, DefaultWidthVar, DefaultHeightVar, ConcreteWidthVar, ConcreteHeightVar) | |
| 174 | - | ||
| 175 | - | } | |
| 176 | - | ||
| 177 | - | // Gets an immutable paintable for the current contents displayed by @paintable. | |
| 178 | - | // | |
| 179 | - | // This is useful when you want to retain the current state of an animation, | |
| 180 | - | // for example to take a screenshot of a running animation. | |
| 181 | - | // | |
| 182 | - | // If the @paintable is already immutable, it will return itself. | |
| 183 | - | func (x *IconPaintable) GetCurrentImage() *gdk.PaintableBase { | |
| 184 | - | var cls *gdk.PaintableBase | |
| 185 | - | ||
| 186 | - | cret := gdk.XGdkPaintableGetCurrentImage(x.GoPointer()) | |
| 187 | - | ||
| 188 | - | if cret == 0 { | |
| 189 | - | return nil | |
| 190 | - | } | |
| 191 | - | cls = &gdk.PaintableBase{} | |
| 192 | - | cls.Ptr = cret | |
| 193 | - | return cls | |
| 194 | - | } | |
| 195 | - | ||
| 196 | - | // Get flags for the paintable. | |
| 197 | - | // | |
| 198 | - | // This is oftentimes useful for optimizations. | |
| 199 | - | // | |
| 200 | - | // See [flags@Gdk.PaintableFlags] for the flags and what they mean. | |
| 201 | - | func (x *IconPaintable) GetFlags() gdk.PaintableFlags { | |
| 202 | - | ||
| 203 | - | cret := gdk.XGdkPaintableGetFlags(x.GoPointer()) | |
| 204 | - | return cret | |
| 205 | - | } | |
| 206 | - | ||
| 207 | - | // Gets the preferred aspect ratio the @paintable would like to be displayed at. | |
| 208 | - | // | |
| 209 | - | // The aspect ratio is the width divided by the height, so a value of 0.5 | |
| 210 | - | // means that the @paintable prefers to be displayed twice as high as it | |
| 211 | - | // is wide. Consumers of this interface can use this to preserve aspect | |
| 212 | - | // ratio when displaying the paintable. | |
| 213 | - | // | |
| 214 | - | // This is a purely informational value and does not in any way limit the | |
| 215 | - | // values that may be passed to [method@Gdk.Paintable.snapshot]. | |
| 216 | - | // | |
| 217 | - | // Usually when a @paintable returns nonzero values from | |
| 218 | - | // [method@Gdk.Paintable.get_intrinsic_width] and | |
| 219 | - | // [method@Gdk.Paintable.get_intrinsic_height] the aspect ratio | |
| 220 | - | // should conform to those values, though that is not required. | |
| 221 | - | // | |
| 222 | - | // If the @paintable does not have a preferred aspect ratio, | |
| 223 | - | // it returns 0. Negative values are never returned. | |
| 224 | - | func (x *IconPaintable) GetIntrinsicAspectRatio() float64 { | |
| 225 | - | ||
| 226 | - | cret := gdk.XGdkPaintableGetIntrinsicAspectRatio(x.GoPointer()) | |
| 227 | - | return cret | |
| 228 | - | } | |
| 229 | - | ||
| 230 | - | // Gets the preferred height the @paintable would like to be displayed at. | |
| 231 | - | // | |
| 232 | - | // Consumers of this interface can use this to reserve enough space to draw | |
| 233 | - | // the paintable. | |
| 234 | - | // | |
| 235 | - | // This is a purely informational value and does not in any way limit the | |
| 236 | - | // values that may be passed to [method@Gdk.Paintable.snapshot]. | |
| 237 | - | // | |
| 238 | - | // If the @paintable does not have a preferred height, it returns 0. | |
| 239 | - | // Negative values are never returned. | |
| 240 | - | func (x *IconPaintable) GetIntrinsicHeight() int { | |
| 241 | - | ||
| 242 | - | cret := gdk.XGdkPaintableGetIntrinsicHeight(x.GoPointer()) | |
| 243 | - | return cret | |
| 244 | - | } | |
| 245 | - | ||
| 246 | - | // Gets the preferred width the @paintable would like to be displayed at. | |
| 247 | - | // | |
| 248 | - | // Consumers of this interface can use this to reserve enough space to draw | |
| 249 | - | // the paintable. | |
| 250 | - | // | |
| 251 | - | // This is a purely informational value and does not in any way limit the | |
| 252 | - | // values that may be passed to [method@Gdk.Paintable.snapshot]. | |
| 253 | - | // | |
| 254 | - | // If the @paintable does not have a preferred width, it returns 0. | |
| 255 | - | // Negative values are never returned. | |
| 256 | - | func (x *IconPaintable) GetIntrinsicWidth() int { | |
| 257 | - | ||
| 258 | - | cret := gdk.XGdkPaintableGetIntrinsicWidth(x.GoPointer()) | |
| 259 | - | return cret | |
| 260 | - | } | |
| 261 | - | ||
| 262 | - | // Called by implementations of `GdkPaintable` to invalidate their contents. | |
| 263 | - | // | |
| 264 | - | // Unless the contents are invalidated, implementations must guarantee that | |
| 265 | - | // multiple calls of [method@Gdk.Paintable.snapshot] produce the same output. | |
| 266 | - | // | |
| 267 | - | // This function will emit the [signal@Gdk.Paintable::invalidate-contents] | |
| 268 | - | // signal. | |
| 269 | - | // | |
| 270 | - | // If a @paintable reports the %GDK_PAINTABLE_STATIC_CONTENTS flag, | |
| 271 | - | // it must not call this function. | |
| 272 | - | func (x *IconPaintable) InvalidateContents() { | |
| 273 | - | ||
| 274 | - | gdk.XGdkPaintableInvalidateContents(x.GoPointer()) | |
| 275 | - | ||
| 276 | - | } | |
| 277 | - | ||
| 278 | - | // Called by implementations of `GdkPaintable` to invalidate their size. | |
| 279 | - | // | |
| 280 | - | // As long as the size is not invalidated, @paintable must return the same | |
| 281 | - | // values for its intrinsic width, height and aspect ratio. | |
| 282 | - | // | |
| 283 | - | // This function will emit the [signal@Gdk.Paintable::invalidate-size] | |
| 284 | - | // signal. | |
| 285 | - | // | |
| 286 | - | // If a @paintable reports the %GDK_PAINTABLE_STATIC_SIZE flag, | |
| 287 | - | // it must not call this function. | |
| 288 | - | func (x *IconPaintable) InvalidateSize() { | |
| 289 | - | ||
| 290 | - | gdk.XGdkPaintableInvalidateSize(x.GoPointer()) | |
| 291 | - | ||
| 292 | - | } | |
| 293 | - | ||
| 294 | - | // Snapshots the given paintable with the given @width and @height. | |
| 295 | - | // | |
| 296 | - | // The paintable is drawn at the current (0,0) offset of the @snapshot. | |
| 297 | - | // If @width and @height are not larger than zero, this function will | |
| 298 | - | // do nothing. | |
| 299 | - | func (x *IconPaintable) Snapshot(SnapshotVar *gdk.Snapshot, WidthVar float64, HeightVar float64) { | |
| 300 | - | ||
| 301 | - | gdk.XGdkPaintableSnapshot(x.GoPointer(), SnapshotVar.GoPointer(), WidthVar, HeightVar) | |
| 302 | - | ||
| 303 | - | } | |
| 304 | - | ||
| 305 | - | // Snapshots the paintable with the given colors. | |
| 306 | - | // | |
| 307 | - | // If less than 4 colors are provided, GTK will pad the array with default | |
| 308 | - | // colors. | |
| 309 | - | func (x *IconPaintable) SnapshotSymbolic(SnapshotVar *gdk.Snapshot, WidthVar float64, HeightVar float64, ColorsVar []gdk.RGBA, NColorsVar uint) { | |
| 310 | - | ||
| 311 | - | XGtkSymbolicPaintableSnapshotSymbolic(x.GoPointer(), SnapshotVar.GoPointer(), WidthVar, HeightVar, ColorsVar, NColorsVar) | |
| 312 | - | ||
| 313 | - | } | |
| 314 | - | ||
| 315 | 66 | // Loads themed icons. | |
| 316 | 67 | // | |
| 317 | 68 | // The main reason for using a name rather than simply providing a filename | |
| @@ -682,14 +433,6 @@ func init() { | |||
| 682 | 433 | ||
| 683 | 434 | core.PuregoSafeRegister(&xIconThemeErrorQuark, libs, "gtk_icon_theme_error_quark") | |
| 684 | 435 | ||
| 685 | - | core.PuregoSafeRegister(&xIconPaintableGLibType, libs, "gtk_icon_paintable_get_type") | |
| 686 | - | ||
| 687 | - | core.PuregoSafeRegister(&xNewIconPaintableForFile, libs, "gtk_icon_paintable_new_for_file") | |
| 688 | - | ||
| 689 | - | core.PuregoSafeRegister(&xIconPaintableGetFile, libs, "gtk_icon_paintable_get_file") | |
| 690 | - | core.PuregoSafeRegister(&xIconPaintableGetIconName, libs, "gtk_icon_paintable_get_icon_name") | |
| 691 | - | core.PuregoSafeRegister(&xIconPaintableIsSymbolic, libs, "gtk_icon_paintable_is_symbolic") | |
| 692 | - | ||
| 693 | 436 | core.PuregoSafeRegister(&xIconThemeGLibType, libs, "gtk_icon_theme_get_type") | |
| 694 | 437 | ||
| 695 | 438 | core.PuregoSafeRegister(&xNewIconTheme, libs, "gtk_icon_theme_new") | |
M v4/gtk/gtkimage.go +25 -11
| @@ -41,7 +41,7 @@ const ( | |||
| 41 | 41 | ||
| 42 | 42 | // Displays an image. | |
| 43 | 43 | // | |
| 44 | - | // picture> | |
| 44 | + | // <picture> | |
| 45 | 45 | // | |
| 46 | 46 | // <source srcset="image-dark.png" media="(prefers-color-scheme: dark)"> | |
| 47 | 47 | // <img alt="An example GtkImage" src="image.png"> | |
| @@ -59,9 +59,9 @@ const ( | |||
| 59 | 59 | // If the file isn’t loaded successfully, the image will contain a | |
| 60 | 60 | // “broken image” icon similar to that used in many web browsers. | |
| 61 | 61 | // | |
| 62 | - | // If you want to handle errors in loading the file yourself, | |
| 63 | - | // for example by displaying an error message, then load the image with | |
| 64 | - | // [ctor@Gdk.Texture.new_from_file], then create the `GtkImage` with | |
| 62 | + | // If you want to handle errors in loading the file yourself, for example | |
| 63 | + | // by displaying an error message, then load the image with an image | |
| 64 | + | // loading framework such as libglycin, then create the `GtkImage` with | |
| 65 | 65 | // [ctor@Gtk.Image.new_from_paintable]. | |
| 66 | 66 | // | |
| 67 | 67 | // Sometimes an application will want to avoid depending on external data | |
| @@ -124,9 +124,9 @@ var xNewImageFromFile func(string) uintptr | |||
| 124 | 124 | // will display a “broken image” icon. This function never returns %NULL, | |
| 125 | 125 | // it always returns a valid `GtkImage` widget. | |
| 126 | 126 | // | |
| 127 | - | // If you need to detect failures to load the file, use | |
| 128 | - | // [ctor@Gdk.Texture.new_from_file] to load the file yourself, | |
| 129 | - | // then create the `GtkImage` from the texture. | |
| 127 | + | // If you need to detect failures to load the file, use an | |
| 128 | + | // image loading framework such as libglycin to load the file | |
| 129 | + | // yourself, then create the `GtkImage` from the texture. | |
| 130 | 130 | // | |
| 131 | 131 | // The storage type (see [method@Gtk.Image.get_storage_type]) | |
| 132 | 132 | // of the returned image is not defined, it will be whatever | |
| @@ -197,6 +197,13 @@ var xNewImageFromPaintable func(uintptr) uintptr | |||
| 197 | 197 | // | |
| 198 | 198 | // The `GtkImage` will track changes to the @paintable and update | |
| 199 | 199 | // its size and contents in response to it. | |
| 200 | + | // | |
| 201 | + | // Note that paintables are still subject to the icon size that is | |
| 202 | + | // set on the image. If you want to display a paintable at its intrinsic | |
| 203 | + | // size, use [class@Gtk.Picture] instead. | |
| 204 | + | // | |
| 205 | + | // If @paintable is a [iface@Gtk.SymbolicPaintable], then it will be | |
| 206 | + | // recolored with the symbolic palette from the theme. | |
| 200 | 207 | func NewImageFromPaintable(PaintableVar gdk.Paintable) *Image { | |
| 201 | 208 | var cls *Image | |
| 202 | 209 | ||
| @@ -247,9 +254,9 @@ var xNewImageFromResource func(string) uintptr | |||
| 247 | 254 | // display a “broken image” icon. This function never returns %NULL, | |
| 248 | 255 | // it always returns a valid `GtkImage` widget. | |
| 249 | 256 | // | |
| 250 | - | // If you need to detect failures to load the file, use | |
| 251 | - | // [ctor@GdkPixbuf.Pixbuf.new_from_file] to load the file yourself, | |
| 252 | - | // then create the `GtkImage` from the pixbuf. | |
| 257 | + | // If you need to detect failures to load the file, use an | |
| 258 | + | // image loading framework such as libglycin to load the file | |
| 259 | + | // yourself, then create the `GtkImage` from the texture. | |
| 253 | 260 | // | |
| 254 | 261 | // The storage type (see [method@Gtk.Image.get_storage_type]) of | |
| 255 | 262 | // the returned image is not defined, it will be whatever is | |
| @@ -371,6 +378,13 @@ var xImageSetFromFile func(uintptr, string) | |||
| 371 | 378 | // Sets a `GtkImage` to show a file. | |
| 372 | 379 | // | |
| 373 | 380 | // See [ctor@Gtk.Image.new_from_file] for details. | |
| 381 | + | // | |
| 382 | + | // ::: warning | |
| 383 | + | // | |
| 384 | + | // Note that this function should not be used with untrusted data. | |
| 385 | + | // Use a proper image loading framework such as libglycin, which can | |
| 386 | + | // load many image formats into a `GdkTexture`, and then use | |
| 387 | + | // [method@Gtk.Image.set_from_paintable]. | |
| 374 | 388 | func (x *Image) SetFromFile(FilenameVar string) { | |
| 375 | 389 | ||
| 376 | 390 | xImageSetFromFile(x.GoPointer(), FilenameVar) | |
| @@ -450,7 +464,7 @@ var xImageSetPixelSize func(uintptr, int) | |||
| 450 | 464 | // Sets the pixel size to use for named icons. | |
| 451 | 465 | // | |
| 452 | 466 | // If the pixel size is set to a value != -1, it is used instead | |
| 453 | - | // of the icon size set by [method@Gtk.Image.set_from_icon_name]. | |
| 467 | + | // of the icon size set by [method@Gtk.Image.set_icon_size]. | |
| 454 | 468 | func (x *Image) SetPixelSize(PixelSizeVar int) { | |
| 455 | 469 | ||
| 456 | 470 | xImageSetPixelSize(x.GoPointer(), PixelSizeVar) | |
M v4/gtk/gtklistview.go +1 -1
| @@ -124,7 +124,7 @@ func (x *ListViewClass) GoPointer() uintptr { | |||
| 124 | 124 | // rubberband selection, a node with name `rubberband` is used. | |
| 125 | 125 | // | |
| 126 | 126 | // The main listview node may also carry style classes to select | |
| 127 | - | // the style of [list presentation](ListContainers.html#list-styles): | |
| 127 | + | // the style of [list presentation](section-list-widget.html#list-styles): | |
| 128 | 128 | // .rich-list, .navigation-sidebar or .data-table. | |
| 129 | 129 | // | |
| 130 | 130 | // # Accessibility | |
M v4/gtk/gtkmenubutton.go +1 -1
| @@ -435,7 +435,7 @@ var xMenuButtonSetPopover func(uintptr, uintptr) | |||
| 435 | 435 | // | |
| 436 | 436 | // If [property@Gtk.MenuButton:menu-model] is set, the menu model is dissociated | |
| 437 | 437 | // from the @menu_button, and the property is set to %NULL. | |
| 438 | - | func (x *MenuButton) SetPopover(PopoverVar *Widget) { | |
| 438 | + | func (x *MenuButton) SetPopover(PopoverVar *Popover) { | |
| 439 | 439 | ||
| 440 | 440 | xMenuButtonSetPopover(x.GoPointer(), PopoverVar.GoPointer()) | |
| 441 | 441 | ||
M v4/gtk/gtkpadcontroller.go +10 -1
| @@ -56,6 +56,8 @@ const ( | |||
| 56 | 56 | PadActionRingValue PadActionType = 1 | |
| 57 | 57 | // Action is triggered by a pad strip | |
| 58 | 58 | PadActionStripValue PadActionType = 2 | |
| 59 | + | // Action is triggered by a pad dial | |
| 60 | + | PadActionDialValue PadActionType = 3 | |
| 59 | 61 | ) | |
| 60 | 62 | ||
| 61 | 63 | // Handles input from the pads found in drawing tablets. | |
| @@ -102,9 +104,16 @@ const ( | |||
| 102 | 104 | // pad_controller = gtk_pad_controller_new (action_group, NULL); | |
| 103 | 105 | // ``` | |
| 104 | 106 | // | |
| 105 | - | // The actions belonging to rings/strips will be activated with a parameter | |
| 107 | + | // The actions belonging to rings/strips/dials will be activated with a parameter | |
| 106 | 108 | // of type %G_VARIANT_TYPE_DOUBLE bearing the value of the given axis, it | |
| 107 | 109 | // is required that those are made stateful and accepting this `GVariantType`. | |
| 110 | + | // For rings the value is the angle of the ring position in degrees with 0 | |
| 111 | + | // facing up. For strips the value is the absolute position on the strip, normalized | |
| 112 | + | // to the [0.0, 1.0] range. | |
| 113 | + | // For dials the value is the relative movement of the dial, normalized so that the | |
| 114 | + | // value 120 represents one logical scroll wheel detent in the positive direction. | |
| 115 | + | // Devices that support high-resolution scrolling may send events with fractions of | |
| 116 | + | // 120 to signify a smaller motion. | |
| 108 | 117 | type PadController struct { | |
| 109 | 118 | EventController | |
| 110 | 119 | } | |
M v4/gtk/gtkpicture.go +21 -7
| @@ -26,7 +26,7 @@ func (x *PictureClass) GoPointer() uintptr { | |||
| 26 | 26 | ||
| 27 | 27 | // Displays a `GdkPaintable`. | |
| 28 | 28 | // | |
| 29 | - | // picture> | |
| 29 | + | // <picture> | |
| 30 | 30 | // | |
| 31 | 31 | // <source srcset="picture-dark.png" media="(prefers-color-scheme: dark)"> | |
| 32 | 32 | // <img alt="An example GtkPicture" src="picture.png"> | |
| @@ -45,8 +45,8 @@ func (x *PictureClass) GoPointer() uintptr { | |||
| 45 | 45 | // “broken image” icon similar to that used in many web browsers. | |
| 46 | 46 | // If you want to handle errors in loading the file yourself, | |
| 47 | 47 | // for example by displaying an error message, then load the image with | |
| 48 | - | // [ctor@Gdk.Texture.new_from_file], then create the `GtkPicture` with | |
| 49 | - | // [ctor@Gtk.Picture.new_for_paintable]. | |
| 48 | + | // and image loading framework such as libglycin, then create the `GtkPicture` | |
| 49 | + | // with [ctor@Gtk.Picture.new_for_paintable]. | |
| 50 | 50 | // | |
| 51 | 51 | // Sometimes an application will want to avoid depending on external data | |
| 52 | 52 | // files, such as image files. See the documentation of `GResource` for details. | |
| @@ -115,9 +115,9 @@ var xNewPictureForFile func(uintptr) uintptr | |||
| 115 | 115 | // If the file isn’t found or can’t be loaded, the resulting | |
| 116 | 116 | // `GtkPicture` is empty. | |
| 117 | 117 | // | |
| 118 | - | // If you need to detect failures to load the file, use | |
| 119 | - | // [ctor@Gdk.Texture.new_from_file] to load the file yourself, | |
| 120 | - | // then create the `GtkPicture` from the texture. | |
| 118 | + | // If you need to detect failures to load the file, use an | |
| 119 | + | // image loading framework such as libglycin to load the file | |
| 120 | + | // yourself, then create the `GtkPicture` from the texture. | |
| 121 | 121 | func NewPictureForFile(FileVar gio.File) *Picture { | |
| 122 | 122 | var cls *Picture | |
| 123 | 123 | ||
| @@ -340,6 +340,13 @@ var xPictureSetFile func(uintptr, uintptr) | |||
| 340 | 340 | // Makes @self load and display @file. | |
| 341 | 341 | // | |
| 342 | 342 | // See [ctor@Gtk.Picture.new_for_file] for details. | |
| 343 | + | // | |
| 344 | + | // ::: warning | |
| 345 | + | // | |
| 346 | + | // Note that this function should not be used with untrusted data. | |
| 347 | + | // Use a proper image loading framework such as libglycin, which can | |
| 348 | + | // load many image formats into a `GdkTexture`, and then use | |
| 349 | + | // [method@Gtk.Image.set_from_paintable]. | |
| 343 | 350 | func (x *Picture) SetFile(FileVar gio.File) { | |
| 344 | 351 | ||
| 345 | 352 | xPictureSetFile(x.GoPointer(), FileVar.GoPointer()) | |
| @@ -351,6 +358,13 @@ var xPictureSetFilename func(uintptr, string) | |||
| 351 | 358 | // Makes @self load and display the given @filename. | |
| 352 | 359 | // | |
| 353 | 360 | // This is a utility function that calls [method@Gtk.Picture.set_file]. | |
| 361 | + | // | |
| 362 | + | // ::: warning | |
| 363 | + | // | |
| 364 | + | // Note that this function should not be used with untrusted data. | |
| 365 | + | // Use a proper image loading framework such as libglycin, which can | |
| 366 | + | // load many image formats into a `GdkTexture`, and then use | |
| 367 | + | // [method@Gtk.Image.set_from_paintable]. | |
| 354 | 368 | func (x *Picture) SetFilename(FilenameVar string) { | |
| 355 | 369 | ||
| 356 | 370 | xPictureSetFilename(x.GoPointer(), FilenameVar) | |
| @@ -377,7 +391,7 @@ var xPictureSetPaintable func(uintptr, uintptr) | |||
| 377 | 391 | ||
| 378 | 392 | // Makes @self display the given @paintable. | |
| 379 | 393 | // | |
| 380 | - | // If @paintable is %NULL, nothing will be displayed. | |
| 394 | + | // If @paintable is `NULL`, nothing will be displayed. | |
| 381 | 395 | // | |
| 382 | 396 | // See [ctor@Gtk.Picture.new_for_paintable] for details. | |
| 383 | 397 | func (x *Picture) SetPaintable(PaintableVar gdk.Paintable) { | |
M v4/gtk/gtkpopover.go +1 -1
| @@ -270,7 +270,7 @@ func (x *Popover) GetMnemonicsVisible() bool { | |||
| 270 | 270 | ||
| 271 | 271 | var xPopoverGetOffset func(uintptr, int, int) | |
| 272 | 272 | ||
| 273 | - | // Gets the offset previous set with [method@Gtk.Popover.set_offset()]. | |
| 273 | + | // Gets the offset previous set with [method@Gtk.Popover.set_offset]. | |
| 274 | 274 | func (x *Popover) GetOffset(XOffsetVar int, YOffsetVar int) { | |
| 275 | 275 | ||
| 276 | 276 | xPopoverGetOffset(x.GoPointer(), XOffsetVar, YOffsetVar) | |
M v4/gtk/gtkpopovermenu.go +5 -3
| @@ -99,8 +99,10 @@ import ( | |||
| 99 | 99 | // | |
| 100 | 100 | // The following attributes are used when constructing submenus: | |
| 101 | 101 | // | |
| 102 | - | // - "label": a user-visible string to display | |
| 103 | - | // - "icon": icon name to display | |
| 102 | + | // - "label": a user-visible string to display | |
| 103 | + | // - "icon": icon name to display | |
| 104 | + | // - "gtk-macos-special": (macOS only, ignored by others) Add special meaning to a menu | |
| 105 | + | // in the macOS menu bar. See [Using GTK on Apple macOS](osx.html). | |
| 104 | 106 | // | |
| 105 | 107 | // Menu items will also show accelerators, which are usually associated | |
| 106 | 108 | // with actions via [method@Gtk.Application.set_accels_for_action], | |
| @@ -241,7 +243,7 @@ func (x *PopoverMenu) GetMenuModel() *gio.MenuModel { | |||
| 241 | 243 | var xPopoverMenuRemoveChild func(uintptr, uintptr) bool | |
| 242 | 244 | ||
| 243 | 245 | // Removes a widget that has previously been added with | |
| 244 | - | // [method@Gtk.PopoverMenu.add_child()] | |
| 246 | + | // [method@Gtk.PopoverMenu.add_child] | |
| 245 | 247 | func (x *PopoverMenu) RemoveChild(ChildVar *Widget) bool { | |
| 246 | 248 | ||
| 247 | 249 | cret := xPopoverMenuRemoveChild(x.GoPointer(), ChildVar.GoPointer()) | |
M v4/gtk/gtkprintdialog.go +9 -0
| @@ -246,6 +246,9 @@ var xPrintDialogPrintFileFinish func(uintptr, uintptr, **glib.Error) bool | |||
| 246 | 246 | ||
| 247 | 247 | // Finishes the [method@Gtk.PrintDialog.print_file] call and | |
| 248 | 248 | // returns the results. | |
| 249 | + | // | |
| 250 | + | // Note that this function returns a [error@Gtk.DialogError.DISMISSED] | |
| 251 | + | // error if the user cancels the dialog. | |
| 249 | 252 | func (x *PrintDialog) PrintFileFinish(ResultVar gio.AsyncResult) (bool, error) { | |
| 250 | 253 | var cerr *glib.Error | |
| 251 | 254 | ||
| @@ -271,6 +274,9 @@ var xPrintDialogPrintFinish func(uintptr, uintptr, **glib.Error) uintptr | |||
| 271 | 274 | // closed automatically if you just unref it). Be aware that the close | |
| 272 | 275 | // call may not be instant as it operation will for the printer to finish | |
| 273 | 276 | // printing. | |
| 277 | + | // | |
| 278 | + | // Note that this function returns a [error@Gtk.DialogError.DISMISSED] | |
| 279 | + | // error if the user cancels the dialog. | |
| 274 | 280 | func (x *PrintDialog) PrintFinish(ResultVar gio.AsyncResult) (*gio.OutputStream, error) { | |
| 275 | 281 | var cls *gio.OutputStream | |
| 276 | 282 | var cerr *glib.Error | |
| @@ -364,6 +370,9 @@ var xPrintDialogSetupFinish func(uintptr, uintptr, **glib.Error) *PrintSetup | |||
| 364 | 370 | // If the call was successful, it returns a [struct@Gtk.PrintSetup] | |
| 365 | 371 | // which contains the print settings and page setup information that | |
| 366 | 372 | // will be used to print. | |
| 373 | + | // | |
| 374 | + | // Note that this function returns a [error@Gtk.DialogError.DISMISSED] | |
| 375 | + | // error if the user cancels the dialog. | |
| 367 | 376 | func (x *PrintDialog) SetupFinish(ResultVar gio.AsyncResult) (*PrintSetup, error) { | |
| 368 | 377 | var cerr *glib.Error | |
| 369 | 378 | ||
M v4/gtk/gtkprogressbar.go +3 -1
| @@ -60,7 +60,9 @@ import ( | |||
| 60 | 60 | // | |
| 61 | 61 | // # Accessibility | |
| 62 | 62 | // | |
| 63 | - | // `GtkProgressBar` uses the [enum@Gtk.AccessibleRole.progress_bar] role. | |
| 63 | + | // `GtkProgressBar` uses the [enum@Gtk.AccessibleRole.progress_bar] role | |
| 64 | + | // and sets the [enum@Gtk.AccessibleProperty.value_min], [enum@Gtk.AccessibleProperty.value_max] and [enum@Gtk.AccessibleProperty.value_now] properties to reflect | |
| 65 | + | // the progress. | |
| 64 | 66 | type ProgressBar struct { | |
| 65 | 67 | Widget | |
| 66 | 68 | } | |
M v4/gtk/gtksignallistitemfactory.go +1 -1
| @@ -53,7 +53,7 @@ func (x *SignalListItemFactoryClass) GoPointer() uintptr { | |||
| 53 | 53 | // | |
| 54 | 54 | // Note that during the signal emissions, changing properties on the listitems | |
| 55 | 55 | // passed will not trigger notify signals as the listitem's notifications are | |
| 56 | - | // frozen. See [method@GObject.Object.freeze_notify()] for details. | |
| 56 | + | // frozen. See [method@GObject.Object.freeze_notify] for details. | |
| 57 | 57 | // | |
| 58 | 58 | // For tracking changes in other properties in the listitem, the | |
| 59 | 59 | // ::notify signal is recommended. The signal can be connected in the | |
M v4/gtk/gtksnapshot.go +16 -0
| @@ -379,6 +379,20 @@ func (x *Snapshot) PushColorMatrix(ColorMatrixVar *graphene.Matrix, ColorOffsetV | |||
| 379 | 379 | ||
| 380 | 380 | } | |
| 381 | 381 | ||
| 382 | + | var xSnapshotPushComponentTransfer func(uintptr, *gsk.ComponentTransfer, *gsk.ComponentTransfer, *gsk.ComponentTransfer, *gsk.ComponentTransfer) | |
| 383 | + | ||
| 384 | + | // Modifies the colors of an image by applying a transfer | |
| 385 | + | // function for each component. | |
| 386 | + | // | |
| 387 | + | // The transfer functions operate on unpremultiplied colors. | |
| 388 | + | // | |
| 389 | + | // The image is recorded until the next call to [method@Gtk.Snapshot.pop]. | |
| 390 | + | func (x *Snapshot) PushComponentTransfer(RedVar *gsk.ComponentTransfer, GreenVar *gsk.ComponentTransfer, BlueVar *gsk.ComponentTransfer, AlphaVar *gsk.ComponentTransfer) { | |
| 391 | + | ||
| 392 | + | xSnapshotPushComponentTransfer(x.GoPointer(), RedVar, GreenVar, BlueVar, AlphaVar) | |
| 393 | + | ||
| 394 | + | } | |
| 395 | + | ||
| 382 | 396 | var xSnapshotPushCrossFade func(uintptr, float64) | |
| 383 | 397 | ||
| 384 | 398 | // Snapshots a cross-fade operation between two images with the | |
| @@ -417,6 +431,7 @@ var xSnapshotPushFill func(uintptr, *gsk.Path, gsk.FillRule) | |||
| 417 | 431 | // The image is recorded until the next call to [method@Gtk.Snapshot.pop]. | |
| 418 | 432 | // | |
| 419 | 433 | // If you want to fill the path with a color, [method@Gtk.Snapshot.append_fill] | |
| 434 | + | // than rendering new ones, use [method@Gtk.Snapshot.append_fill] | |
| 420 | 435 | // may be more convenient. | |
| 421 | 436 | func (x *Snapshot) PushFill(PathVar *gsk.Path, FillRuleVar gsk.FillRule) { | |
| 422 | 437 | ||
| @@ -807,6 +822,7 @@ func init() { | |||
| 807 | 822 | core.PuregoSafeRegister(&xSnapshotPushBlur, libs, "gtk_snapshot_push_blur") | |
| 808 | 823 | core.PuregoSafeRegister(&xSnapshotPushClip, libs, "gtk_snapshot_push_clip") | |
| 809 | 824 | core.PuregoSafeRegister(&xSnapshotPushColorMatrix, libs, "gtk_snapshot_push_color_matrix") | |
| 825 | + | core.PuregoSafeRegister(&xSnapshotPushComponentTransfer, libs, "gtk_snapshot_push_component_transfer") | |
| 810 | 826 | core.PuregoSafeRegister(&xSnapshotPushCrossFade, libs, "gtk_snapshot_push_cross_fade") | |
| 811 | 827 | core.PuregoSafeRegister(&xSnapshotPushDebug, libs, "gtk_snapshot_push_debug") | |
| 812 | 828 | core.PuregoSafeRegister(&xSnapshotPushFill, libs, "gtk_snapshot_push_fill") | |
M v4/gtk/gtkspinner.go +4 -0
| @@ -28,6 +28,10 @@ import ( | |||
| 28 | 28 | // `GtkSpinner` has a single CSS node with the name spinner. | |
| 29 | 29 | // When the animation is active, the :checked pseudoclass is | |
| 30 | 30 | // added to this node. | |
| 31 | + | // | |
| 32 | + | // # Accessibility | |
| 33 | + | // | |
| 34 | + | // `GtkSpinner` uses the [enum@Gtk.AccessibleRole.progress_bar] role. | |
| 31 | 35 | type Spinner struct { | |
| 32 | 36 | Widget | |
| 33 | 37 | } | |
M v4/gtk/gtkstatusbar.go +1 -1
| @@ -14,7 +14,7 @@ import ( | |||
| 14 | 14 | // A `GtkStatusbar` widget is usually placed along the bottom of an application's | |
| 15 | 15 | // main [class@Gtk.Window]. | |
| 16 | 16 | // | |
| 17 | - | // picture> | |
| 17 | + | // <picture> | |
| 18 | 18 | // | |
| 19 | 19 | // <source srcset="statusbar-dark.png" media="(prefers-color-scheme: dark)"> | |
| 20 | 20 | // <img alt="An example GtkStatusbar" src="statusbar.png"> | |
M v4/gtk/gtktext.go +2 -0
| @@ -51,6 +51,7 @@ import ( | |||
| 51 | 51 | // - <kbd>Ctrl</kbd>+<kbd>Y</kbd> or <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Z</kbd> | |
| 52 | 52 | // redoes the last undone modification. | |
| 53 | 53 | // - <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>T</kbd> toggles the text direction. | |
| 54 | + | // - <kbd>Clear</kbd> clears the content. | |
| 54 | 55 | // | |
| 55 | 56 | // Additionally, the following signals have default keybindings: | |
| 56 | 57 | // | |
| @@ -80,6 +81,7 @@ import ( | |||
| 80 | 81 | // - `selection.select-all` selects all of the widgets content. | |
| 81 | 82 | // - `text.redo` redoes the last change to the contents. | |
| 82 | 83 | // - `text.undo` undoes the last change to the contents. | |
| 84 | + | // - `text.clear` removes all content. | |
| 83 | 85 | // | |
| 84 | 86 | // # CSS nodes | |
| 85 | 87 | // | |
M v4/gtk/gtktextview.go +3 -1
| @@ -538,6 +538,7 @@ const ( | |||
| 538 | 538 | // - <kbd>Ctrl</kbd>+<kbd>Z</kbd> undoes the last modification. | |
| 539 | 539 | // - <kbd>Ctrl</kbd>+<kbd>Y</kbd> or <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Z</kbd> | |
| 540 | 540 | // redoes the last undone modification. | |
| 541 | + | // - <kbd>Clear</kbd> clears the content. | |
| 541 | 542 | // | |
| 542 | 543 | // Additionally, the following signals have default keybindings: | |
| 543 | 544 | // | |
| @@ -566,6 +567,7 @@ const ( | |||
| 566 | 567 | // - `selection.select-all` selects all of the widgets content. | |
| 567 | 568 | // - `text.redo` redoes the last change to the contents. | |
| 568 | 569 | // - `text.undo` undoes the last change to the contents. | |
| 570 | + | // - `text.clear` clears the content. | |
| 569 | 571 | // | |
| 570 | 572 | // ## CSS nodes | |
| 571 | 573 | // | |
| @@ -1141,7 +1143,7 @@ var xTextViewGetVisibleOffset func(uintptr, float64, float64) | |||
| 1141 | 1143 | // the textview's text contents. | |
| 1142 | 1144 | // | |
| 1143 | 1145 | // This allows for more-precise positioning than what is provided by | |
| 1144 | - | // [method@Gtk.TextView.get_visible_rect()] as you can discover what | |
| 1146 | + | // [method@Gtk.TextView.get_visible_rect] as you can discover what | |
| 1145 | 1147 | // device pixel is being quantized for text positioning. | |
| 1146 | 1148 | // | |
| 1147 | 1149 | // You might want this when making ulterior widgets align with quantized | |
M v4/gtk/gtkurilauncher.go +14 -0
| @@ -66,6 +66,19 @@ func NewUriLauncher(UriVar string) *UriLauncher { | |||
| 66 | 66 | return cls | |
| 67 | 67 | } | |
| 68 | 68 | ||
| 69 | + | var xUriLauncherCanLaunch func(uintptr, uintptr) bool | |
| 70 | + | ||
| 71 | + | // Returns whether the launcher is likely to succeed | |
| 72 | + | // in launching an application for its uri. | |
| 73 | + | // | |
| 74 | + | // This can be used to disable controls that trigger | |
| 75 | + | // the launcher when they are known not to work. | |
| 76 | + | func (x *UriLauncher) CanLaunch(ParentVar *Window) bool { | |
| 77 | + | ||
| 78 | + | cret := xUriLauncherCanLaunch(x.GoPointer(), ParentVar.GoPointer()) | |
| 79 | + | return cret | |
| 80 | + | } | |
| 81 | + | ||
| 69 | 82 | var xUriLauncherGetUri func(uintptr) string | |
| 70 | 83 | ||
| 71 | 84 | // Gets the uri that will be opened. | |
| @@ -137,6 +150,7 @@ func init() { | |||
| 137 | 150 | ||
| 138 | 151 | core.PuregoSafeRegister(&xNewUriLauncher, libs, "gtk_uri_launcher_new") | |
| 139 | 152 | ||
| 153 | + | core.PuregoSafeRegister(&xUriLauncherCanLaunch, libs, "gtk_uri_launcher_can_launch") | |
| 140 | 154 | core.PuregoSafeRegister(&xUriLauncherGetUri, libs, "gtk_uri_launcher_get_uri") | |
| 141 | 155 | core.PuregoSafeRegister(&xUriLauncherLaunch, libs, "gtk_uri_launcher_launch") | |
| 142 | 156 | core.PuregoSafeRegister(&xUriLauncherLaunchFinish, libs, "gtk_uri_launcher_launch_finish") | |
M v4/gtk/gtkversion.go +4 -4
| @@ -10,11 +10,11 @@ const ( | |||
| 10 | 10 | // Like [func@get_binary_age], but from the headers used at | |
| 11 | 11 | // application compile time, rather than from the library linked | |
| 12 | 12 | // against at application run time. | |
| 13 | - | BINARY_AGE int = 1806 | |
| 13 | + | BINARY_AGE int = 2002 | |
| 14 | 14 | // Like [func@get_interface_age], but from the headers used at | |
| 15 | 15 | // application compile time, rather than from the library linked | |
| 16 | 16 | // against at application run time. | |
| 17 | - | INTERFACE_AGE int = 6 | |
| 17 | + | INTERFACE_AGE int = 2 | |
| 18 | 18 | // Like [func@get_major_version], but from the headers used at | |
| 19 | 19 | // application compile time, rather than from the library linked | |
| 20 | 20 | // against at application run time. | |
| @@ -22,11 +22,11 @@ const ( | |||
| 22 | 22 | // Like [func@get_micro_version], but from the headers used at | |
| 23 | 23 | // application compile time, rather than from the library linked | |
| 24 | 24 | // against at application run time. | |
| 25 | - | MICRO_VERSION int = 6 | |
| 25 | + | MICRO_VERSION int = 2 | |
| 26 | 26 | // Like [func@get_minor_version], but from the headers used at | |
| 27 | 27 | // application compile time, rather than from the library linked | |
| 28 | 28 | // against at application run time. | |
| 29 | - | MINOR_VERSION int = 18 | |
| 29 | + | MINOR_VERSION int = 20 | |
| 30 | 30 | ) | |
| 31 | 31 | ||
| 32 | 32 | var xCheckVersion func(uint, uint, uint) string | |
M v4/gtk/gtkwindow.go +74 -1
| @@ -176,6 +176,56 @@ func (x *WindowGroupPrivate) GoPointer() uintptr { | |||
| 176 | 176 | return uintptr(unsafe.Pointer(x)) | |
| 177 | 177 | } | |
| 178 | 178 | ||
| 179 | + | // Determines which point or edge of a window is meant to remain fixed | |
| 180 | + | // when a window changes size. | |
| 181 | + | type WindowGravity int | |
| 182 | + | ||
| 183 | + | var xWindowGravityGLibType func() types.GType | |
| 184 | + | ||
| 185 | + | func WindowGravityGLibType() types.GType { | |
| 186 | + | return xWindowGravityGLibType() | |
| 187 | + | } | |
| 188 | + | ||
| 189 | + | const ( | |
| 190 | + | ||
| 191 | + | // The top left corner | |
| 192 | + | WindowGravityTopLeftValue WindowGravity = 0 | |
| 193 | + | // The top edge | |
| 194 | + | WindowGravityTopValue WindowGravity = 1 | |
| 195 | + | // The top right corner | |
| 196 | + | WindowGravityTopRightValue WindowGravity = 2 | |
| 197 | + | // The left edge | |
| 198 | + | WindowGravityLeftValue WindowGravity = 3 | |
| 199 | + | // The center pointer | |
| 200 | + | WindowGravityCenterValue WindowGravity = 4 | |
| 201 | + | // The right edge | |
| 202 | + | WindowGravityRightValue WindowGravity = 5 | |
| 203 | + | // The bottom left corner | |
| 204 | + | WindowGravityBottomLeftValue WindowGravity = 6 | |
| 205 | + | // the bottom edge | |
| 206 | + | WindowGravityBottomValue WindowGravity = 7 | |
| 207 | + | // The bottom right corner | |
| 208 | + | WindowGravityBottomRightValue WindowGravity = 8 | |
| 209 | + | // The top left or top right corner, | |
| 210 | + | // depending on the text direction | |
| 211 | + | WindowGravityTopStartValue WindowGravity = 9 | |
| 212 | + | // The top right or top left corner, | |
| 213 | + | // depending on the text direction | |
| 214 | + | WindowGravityTopEndValue WindowGravity = 10 | |
| 215 | + | // The left or right edge, | |
| 216 | + | // depending on the text direction | |
| 217 | + | WindowGravityStartValue WindowGravity = 11 | |
| 218 | + | // The right or left edge, | |
| 219 | + | // depending on the text direction | |
| 220 | + | WindowGravityEndValue WindowGravity = 12 | |
| 221 | + | // The bottom left or top right corner, | |
| 222 | + | // depending on the text direction | |
| 223 | + | WindowGravityBottomStartValue WindowGravity = 13 | |
| 224 | + | // The bottom right or top left corner, | |
| 225 | + | // depending on the text direction | |
| 226 | + | WindowGravityBottomEndValue WindowGravity = 14 | |
| 227 | + | ) | |
| 228 | + | ||
| 179 | 229 | // A toplevel window which can contain other widgets. | |
| 180 | 230 | // | |
| 181 | 231 | // <picture> | |
| @@ -483,6 +533,15 @@ func (x *Window) GetFocusVisible() bool { | |||
| 483 | 533 | return cret | |
| 484 | 534 | } | |
| 485 | 535 | ||
| 536 | + | var xWindowGetGravity func(uintptr) WindowGravity | |
| 537 | + | ||
| 538 | + | // Returns the gravity that is used when changing the window size programmatically. | |
| 539 | + | func (x *Window) GetGravity() WindowGravity { | |
| 540 | + | ||
| 541 | + | cret := xWindowGetGravity(x.GoPointer()) | |
| 542 | + | return cret | |
| 543 | + | } | |
| 544 | + | ||
| 486 | 545 | var xWindowGetGroup func(uintptr) uintptr | |
| 487 | 546 | ||
| 488 | 547 | // Returns the group for the window. | |
| @@ -929,6 +988,15 @@ func (x *Window) SetFocusVisible(SettingVar bool) { | |||
| 929 | 988 | ||
| 930 | 989 | } | |
| 931 | 990 | ||
| 991 | + | var xWindowSetGravity func(uintptr, WindowGravity) | |
| 992 | + | ||
| 993 | + | // Sets the gravity that is used when changing the window size programmatically. | |
| 994 | + | func (x *Window) SetGravity(GravityVar WindowGravity) { | |
| 995 | + | ||
| 996 | + | xWindowSetGravity(x.GoPointer(), GravityVar) | |
| 997 | + | ||
| 998 | + | } | |
| 999 | + | ||
| 932 | 1000 | var xWindowSetHandleMenubarAccel func(uintptr, bool) | |
| 933 | 1001 | ||
| 934 | 1002 | // Sets whether this window should react to <kbd>F10</kbd> | |
| @@ -1017,7 +1085,8 @@ var xWindowSetStartupId func(uintptr, string) | |||
| 1017 | 1085 | // [method@Gtk.Window.present] or any equivalent function generating | |
| 1018 | 1086 | // a window map event. | |
| 1019 | 1087 | // | |
| 1020 | - | // This function is only useful on X11, not with other GTK targets. | |
| 1088 | + | // This function is only useful on Wayland or X11, not with other GDK | |
| 1089 | + | // backends. | |
| 1021 | 1090 | func (x *Window) SetStartupId(StartupIdVar string) { | |
| 1022 | 1091 | ||
| 1023 | 1092 | xWindowSetStartupId(x.GoPointer(), StartupIdVar) | |
| @@ -1743,6 +1812,8 @@ func init() { | |||
| 1743 | 1812 | libs = append(libs, lib) | |
| 1744 | 1813 | } | |
| 1745 | 1814 | ||
| 1815 | + | core.PuregoSafeRegister(&xWindowGravityGLibType, libs, "gtk_window_gravity_get_type") | |
| 1816 | + | ||
| 1746 | 1817 | core.PuregoSafeRegister(&xWindowGLibType, libs, "gtk_window_get_type") | |
| 1747 | 1818 | ||
| 1748 | 1819 | core.PuregoSafeRegister(&xNewWindow, libs, "gtk_window_new") | |
| @@ -1760,6 +1831,7 @@ func init() { | |||
| 1760 | 1831 | core.PuregoSafeRegister(&xWindowGetDestroyWithParent, libs, "gtk_window_get_destroy_with_parent") | |
| 1761 | 1832 | core.PuregoSafeRegister(&xWindowGetFocus, libs, "gtk_window_get_focus") | |
| 1762 | 1833 | core.PuregoSafeRegister(&xWindowGetFocusVisible, libs, "gtk_window_get_focus_visible") | |
| 1834 | + | core.PuregoSafeRegister(&xWindowGetGravity, libs, "gtk_window_get_gravity") | |
| 1763 | 1835 | core.PuregoSafeRegister(&xWindowGetGroup, libs, "gtk_window_get_group") | |
| 1764 | 1836 | core.PuregoSafeRegister(&xWindowGetHandleMenubarAccel, libs, "gtk_window_get_handle_menubar_accel") | |
| 1765 | 1837 | core.PuregoSafeRegister(&xWindowGetHideOnClose, libs, "gtk_window_get_hide_on_close") | |
| @@ -1789,6 +1861,7 @@ func init() { | |||
| 1789 | 1861 | core.PuregoSafeRegister(&xWindowSetDisplay, libs, "gtk_window_set_display") | |
| 1790 | 1862 | core.PuregoSafeRegister(&xWindowSetFocus, libs, "gtk_window_set_focus") | |
| 1791 | 1863 | core.PuregoSafeRegister(&xWindowSetFocusVisible, libs, "gtk_window_set_focus_visible") | |
| 1864 | + | core.PuregoSafeRegister(&xWindowSetGravity, libs, "gtk_window_set_gravity") | |
| 1792 | 1865 | core.PuregoSafeRegister(&xWindowSetHandleMenubarAccel, libs, "gtk_window_set_handle_menubar_accel") | |
| 1793 | 1866 | core.PuregoSafeRegister(&xWindowSetHideOnClose, libs, "gtk_window_set_hide_on_close") | |
| 1794 | 1867 | core.PuregoSafeRegister(&xWindowSetIconName, libs, "gtk_window_set_icon_name") | |
M v4/pango/pango-features.go +3 -3
| @@ -5,9 +5,9 @@ const ( | |||
| 5 | 5 | // The major component of the version of Pango available at compile-time. | |
| 6 | 6 | VERSION_MAJOR int = 1 | |
| 7 | 7 | // The micro component of the version of Pango available at compile-time. | |
| 8 | - | VERSION_MICRO int = 3 | |
| 8 | + | VERSION_MICRO int = 0 | |
| 9 | 9 | // The minor component of the version of Pango available at compile-time. | |
| 10 | - | VERSION_MINOR int = 56 | |
| 10 | + | VERSION_MINOR int = 57 | |
| 11 | 11 | // A string literal containing the version of Pango available at compile-time. | |
| 12 | - | VERSION_STRING string = "1.56.3" | |
| 12 | + | VERSION_STRING string = "1.57.0" | |
| 13 | 13 | ) | |
M v4/pango/pango-font.go +55 -0
| @@ -338,6 +338,18 @@ func (x *FontDescription) Free() { | |||
| 338 | 338 | ||
| 339 | 339 | } | |
| 340 | 340 | ||
| 341 | + | var xFontDescriptionGetColor func(uintptr) FontColor | |
| 342 | + | ||
| 343 | + | // Returns the color field of the font description. | |
| 344 | + | // | |
| 345 | + | // This field determines whether the font description should | |
| 346 | + | // match fonts that have color glyphs, or fonts that don't. | |
| 347 | + | func (x *FontDescription) GetColor() FontColor { | |
| 348 | + | ||
| 349 | + | cret := xFontDescriptionGetColor(x.GoPointer()) | |
| 350 | + | return cret | |
| 351 | + | } | |
| 352 | + | ||
| 341 | 353 | var xFontDescriptionGetFamily func(uintptr) string | |
| 342 | 354 | ||
| 343 | 355 | // Gets the family name field of a font description. | |
| @@ -514,6 +526,18 @@ func (x *FontDescription) SetAbsoluteSize(SizeVar float64) { | |||
| 514 | 526 | ||
| 515 | 527 | } | |
| 516 | 528 | ||
| 529 | + | var xFontDescriptionSetColor func(uintptr, FontColor) | |
| 530 | + | ||
| 531 | + | // Sets the color field of a font description. | |
| 532 | + | // | |
| 533 | + | // This field determines whether the font description should | |
| 534 | + | // match fonts that have color glyphs, or fonts that don't. | |
| 535 | + | func (x *FontDescription) SetColor(ColorVar FontColor) { | |
| 536 | + | ||
| 537 | + | xFontDescriptionSetColor(x.GoPointer(), ColorVar) | |
| 538 | + | ||
| 539 | + | } | |
| 540 | + | ||
| 517 | 541 | var xFontDescriptionSetFamily func(uintptr, string) | |
| 518 | 542 | ||
| 519 | 543 | // Sets the family name field of a font description. | |
| @@ -1355,6 +1379,27 @@ const ( | |||
| 1355 | 1379 | FontMaskVariationsValue FontMask = 128 | |
| 1356 | 1380 | // OpenType font features are specified. | |
| 1357 | 1381 | FontMaskFeaturesValue FontMask = 256 | |
| 1382 | + | // Font color is specified. | |
| 1383 | + | FontMaskColorValue FontMask = 512 | |
| 1384 | + | ) | |
| 1385 | + | ||
| 1386 | + | // Specifies whether a font should or should not have color glyphs. | |
| 1387 | + | type FontColor int | |
| 1388 | + | ||
| 1389 | + | var xFontColorGLibType func() types.GType | |
| 1390 | + | ||
| 1391 | + | func FontColorGLibType() types.GType { | |
| 1392 | + | return xFontColorGLibType() | |
| 1393 | + | } | |
| 1394 | + | ||
| 1395 | + | const ( | |
| 1396 | + | ||
| 1397 | + | // The font should not have color glyphs | |
| 1398 | + | FontColorForbiddenValue FontColor = 0 | |
| 1399 | + | // The font should have color glyphs | |
| 1400 | + | FontColorRequiredValue FontColor = 1 | |
| 1401 | + | // The font may or may not use color | |
| 1402 | + | FontColorDontCareValue FontColor = 2 | |
| 1358 | 1403 | ) | |
| 1359 | 1404 | ||
| 1360 | 1405 | // An enumeration specifying the width of the font relative to other designs | |
| @@ -1518,6 +1563,9 @@ var xFontDescriptionFromString func(string) *FontDescription | |||
| 1518 | 1563 | // "Not-Rotated", "South", "Upside-Down", "North", "Rotated-Left", | |
| 1519 | 1564 | // "East", "Rotated-Right", "West". | |
| 1520 | 1565 | // | |
| 1566 | + | // The following words are understood as color values: | |
| 1567 | + | // "With-Color", "Without-Color". | |
| 1568 | + | // | |
| 1521 | 1569 | // VARIATIONS is a comma-separated list of font variations | |
| 1522 | 1570 | // of the form @<U+200D>axis1=value,axis2=value,... | |
| 1523 | 1571 | // | |
| @@ -1601,6 +1649,9 @@ func (x *Font) GetCoverage(LanguageVar *Language) *Coverage { | |||
| 1601 | 1649 | var xFontGetFace func(uintptr) uintptr | |
| 1602 | 1650 | ||
| 1603 | 1651 | // Gets the `PangoFontFace` to which @font belongs. | |
| 1652 | + | // | |
| 1653 | + | // Note that this function can return `NULL` in cases | |
| 1654 | + | // where the font outlives its font map. | |
| 1604 | 1655 | func (x *Font) GetFace() *FontFace { | |
| 1605 | 1656 | var cls *FontFace | |
| 1606 | 1657 | ||
| @@ -2113,6 +2164,8 @@ func init() { | |||
| 2113 | 2164 | ||
| 2114 | 2165 | core.PuregoSafeRegister(&xFontMaskGLibType, libs, "pango_font_mask_get_type") | |
| 2115 | 2166 | ||
| 2167 | + | core.PuregoSafeRegister(&xFontColorGLibType, libs, "pango_font_color_get_type") | |
| 2168 | + | ||
| 2116 | 2169 | core.PuregoSafeRegister(&xStretchGLibType, libs, "pango_stretch_get_type") | |
| 2117 | 2170 | ||
| 2118 | 2171 | core.PuregoSafeRegister(&xStyleGLibType, libs, "pango_style_get_type") | |
| @@ -2132,6 +2185,7 @@ func init() { | |||
| 2132 | 2185 | core.PuregoSafeRegister(&xFontDescriptionCopyStatic, libs, "pango_font_description_copy_static") | |
| 2133 | 2186 | core.PuregoSafeRegister(&xFontDescriptionEqual, libs, "pango_font_description_equal") | |
| 2134 | 2187 | core.PuregoSafeRegister(&xFontDescriptionFree, libs, "pango_font_description_free") | |
| 2188 | + | core.PuregoSafeRegister(&xFontDescriptionGetColor, libs, "pango_font_description_get_color") | |
| 2135 | 2189 | core.PuregoSafeRegister(&xFontDescriptionGetFamily, libs, "pango_font_description_get_family") | |
| 2136 | 2190 | core.PuregoSafeRegister(&xFontDescriptionGetFeatures, libs, "pango_font_description_get_features") | |
| 2137 | 2191 | core.PuregoSafeRegister(&xFontDescriptionGetGravity, libs, "pango_font_description_get_gravity") | |
| @@ -2147,6 +2201,7 @@ func init() { | |||
| 2147 | 2201 | core.PuregoSafeRegister(&xFontDescriptionMerge, libs, "pango_font_description_merge") | |
| 2148 | 2202 | core.PuregoSafeRegister(&xFontDescriptionMergeStatic, libs, "pango_font_description_merge_static") | |
| 2149 | 2203 | core.PuregoSafeRegister(&xFontDescriptionSetAbsoluteSize, libs, "pango_font_description_set_absolute_size") | |
| 2204 | + | core.PuregoSafeRegister(&xFontDescriptionSetColor, libs, "pango_font_description_set_color") | |
| 2150 | 2205 | core.PuregoSafeRegister(&xFontDescriptionSetFamily, libs, "pango_font_description_set_family") | |
| 2151 | 2206 | core.PuregoSafeRegister(&xFontDescriptionSetFamilyStatic, libs, "pango_font_description_set_family_static") | |
| 2152 | 2207 | core.PuregoSafeRegister(&xFontDescriptionSetFeatures, libs, "pango_font_description_set_features") | |
M v4/pango/pango-fontmap.go +2 -2
| @@ -300,13 +300,13 @@ func (x *FontMap) AddFontFile(FilenameVar string) (bool, error) { | |||
| 300 | 300 | ||
| 301 | 301 | var xFontMapChanged func(uintptr) | |
| 302 | 302 | ||
| 303 | - | // Forces a change in the context, which will cause any `PangoContext` | |
| 303 | + | // Forces a change in the fontmap, which will cause any `PangoContext` | |
| 304 | 304 | // using this fontmap to change. | |
| 305 | 305 | // | |
| 306 | 306 | // This function is only useful when implementing a new backend | |
| 307 | 307 | // for Pango, something applications won't do. Backends should | |
| 308 | 308 | // call this function if they have attached extra data to the | |
| 309 | - | // context and such data is changed. | |
| 309 | + | // fontmap and such data is changed. | |
| 310 | 310 | func (x *FontMap) Changed() { | |
| 311 | 311 | ||
| 312 | 312 | xFontMapChanged(x.GoPointer()) | |