1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
3
4import (
5 "structs"
6 "unsafe"
7
8 "github.com/ebitengine/purego"
9
10 "github.com/bnema/puregotk/pkg/core"
11 "github.com/bnema/puregotk/v4/gio"
12 "github.com/bnema/puregotk/v4/gobject"
13 "github.com/bnema/puregotk/v4/gobject/types"
14)
15
16type BookmarkListClass struct {
17 _ structs.HostLayout
18
19 ParentClass gobject.ObjectClass
20}
21
22func (x *BookmarkListClass) GoPointer() uintptr {
23 return uintptr(unsafe.Pointer(x))
24}
25
26// A list model that wraps `GBookmarkFile`.
27//
28// It presents a `GListModel` and fills it asynchronously with the
29// `GFileInfo`s returned from that function.
30//
31// The `GFileInfo`s in the list have some attributes in the recent
32// namespace added: `recent::private` (boolean) and `recent:applications`
33// (stringv).
34type BookmarkList struct {
35 gobject.Object
36}
37
38var xBookmarkListGLibType func() types.GType
39
40func BookmarkListGLibType() types.GType {
41 return xBookmarkListGLibType()
42}
43
44func BookmarkListNewFromInternalPtr(ptr uintptr) *BookmarkList {
45 cls := &BookmarkList{}
46 cls.Ptr = ptr
47 return cls
48}
49
50var xNewBookmarkList func(uintptr, uintptr) uintptr
51
52// Creates a new `GtkBookmarkList` with the given @attributes.
53func NewBookmarkList(FilenameVar *string, AttributesVar *string) *BookmarkList {
54 var cls *BookmarkList
55
56 FilenameVarPtr := core.GStrdupNullable(FilenameVar)
57 defer core.GFreeNullable(FilenameVarPtr)
58
59 AttributesVarPtr := core.GStrdupNullable(AttributesVar)
60 defer core.GFreeNullable(AttributesVarPtr)
61
62 cret := xNewBookmarkList(FilenameVarPtr, AttributesVarPtr)
63
64 if cret == 0 {
65 return nil
66 }
67 cls = &BookmarkList{}
68 cls.Ptr = cret
69 return cls
70}
71
72var xBookmarkListGetAttributes func(uintptr) string
73
74// Gets the attributes queried on the children.
75func (x *BookmarkList) GetAttributes() string {
76
77 cret := xBookmarkListGetAttributes(x.GoPointer())
78 return cret
79}
80
81var xBookmarkListGetFilename func(uintptr) string
82
83// Returns the filename of the bookmark file that
84// this list is loading.
85func (x *BookmarkList) GetFilename() string {
86
87 cret := xBookmarkListGetFilename(x.GoPointer())
88 return cret
89}
90
91var xBookmarkListGetIoPriority func(uintptr) int
92
93// Gets the IO priority to use while loading file.
94func (x *BookmarkList) GetIoPriority() int {
95
96 cret := xBookmarkListGetIoPriority(x.GoPointer())
97 return cret
98}
99
100var xBookmarkListIsLoading func(uintptr) bool
101
102// Returns %TRUE if the files are currently being loaded.
103//
104// Files will be added to @self from time to time while loading is
105// going on. The order in which are added is undefined and may change
106// in between runs.
107func (x *BookmarkList) IsLoading() bool {
108
109 cret := xBookmarkListIsLoading(x.GoPointer())
110 return cret
111}
112
113var xBookmarkListSetAttributes func(uintptr, uintptr)
114
115// Sets the @attributes to be enumerated and starts the enumeration.
116//
117// If @attributes is %NULL, no attributes will be queried, but a list
118// of `GFileInfo`s will still be created.
119func (x *BookmarkList) SetAttributes(AttributesVar *string) {
120
121 AttributesVarPtr := core.GStrdupNullable(AttributesVar)
122 defer core.GFreeNullable(AttributesVarPtr)
123
124 xBookmarkListSetAttributes(x.GoPointer(), AttributesVarPtr)
125
126}
127
128var xBookmarkListSetIoPriority func(uintptr, int)
129
130// Sets the IO priority to use while loading files.
131//
132// The default IO priority is %G_PRIORITY_DEFAULT.
133func (x *BookmarkList) SetIoPriority(IoPriorityVar int) {
134
135 xBookmarkListSetIoPriority(x.GoPointer(), IoPriorityVar)
136
137}
138
139func (c *BookmarkList) GoPointer() uintptr {
140 if c == nil {
141 return 0
142 }
143 return c.Ptr
144}
145
146func (c *BookmarkList) SetGoPointer(ptr uintptr) {
147 c.Ptr = ptr
148}
149
150// SetPropertyAttributes sets the "attributes" property.
151// The attributes to query.
152func (x *BookmarkList) SetPropertyAttributes(value string) {
153 var v gobject.Value
154 v.Init(gobject.TypeStringVal)
155 v.SetString(&value)
156 x.SetProperty("attributes", &v)
157}
158
159// GetPropertyAttributes gets the "attributes" property.
160// The attributes to query.
161func (x *BookmarkList) GetPropertyAttributes() string {
162 var v gobject.Value
163 x.GetProperty("attributes", &v)
164 return v.GetString()
165}
166
167// SetPropertyFilename sets the "filename" property.
168// The bookmark file to load.
169func (x *BookmarkList) SetPropertyFilename(value string) {
170 var v gobject.Value
171 v.Init(gobject.TypeStringVal)
172 v.SetString(&value)
173 x.SetProperty("filename", &v)
174}
175
176// GetPropertyFilename gets the "filename" property.
177// The bookmark file to load.
178func (x *BookmarkList) GetPropertyFilename() string {
179 var v gobject.Value
180 x.GetProperty("filename", &v)
181 return v.GetString()
182}
183
184// SetPropertyIoPriority sets the "io-priority" property.
185// Priority used when loading.
186func (x *BookmarkList) SetPropertyIoPriority(value int) {
187 var v gobject.Value
188 v.Init(gobject.TypeIntVal)
189 v.SetInt(value)
190 x.SetProperty("io-priority", &v)
191}
192
193// GetPropertyIoPriority gets the "io-priority" property.
194// Priority used when loading.
195func (x *BookmarkList) GetPropertyIoPriority() int {
196 var v gobject.Value
197 x.GetProperty("io-priority", &v)
198 return v.GetInt()
199}
200
201// GetPropertyLoading gets the "loading" property.
202// %TRUE if files are being loaded.
203func (x *BookmarkList) GetPropertyLoading() bool {
204 var v gobject.Value
205 x.GetProperty("loading", &v)
206 return v.GetBoolean()
207}
208
209// GetPropertyNItems gets the "n-items" property.
210// The number of items. See [method@Gio.ListModel.get_n_items].
211func (x *BookmarkList) GetPropertyNItems() uint {
212 var v gobject.Value
213 x.GetProperty("n-items", &v)
214 return v.GetUint()
215}
216
217// Get the item at @position.
218//
219// If @position is greater than the number of items in @list, %NULL is
220// returned.
221//
222// %NULL is never returned for an index that is smaller than the length
223// of the list.
224//
225// See also: g_list_model_get_n_items()
226func (x *BookmarkList) GetItem(PositionVar uint) uintptr {
227
228 cret := gio.XGListModelGetItem(x.GoPointer(), PositionVar)
229 return cret
230}
231
232// Gets the type of the items in @list.
233//
234// All items returned from g_list_model_get_item() are of the type
235// returned by this function, or a subtype, or if the type is an
236// interface, they are an implementation of that interface.
237//
238// The item type of a #GListModel can not change during the life of the
239// model.
240func (x *BookmarkList) GetItemType() types.GType {
241
242 cret := gio.XGListModelGetItemType(x.GoPointer())
243 return cret
244}
245
246// Gets the number of items in @list.
247//
248// Depending on the model implementation, calling this function may be
249// less efficient than iterating the list with increasing values for
250// @position until g_list_model_get_item() returns %NULL.
251func (x *BookmarkList) GetNItems() uint {
252
253 cret := gio.XGListModelGetNItems(x.GoPointer())
254 return cret
255}
256
257// Get the item at @position.
258//
259// If @position is greater than the number of items in @list, %NULL is
260// returned.
261//
262// %NULL is never returned for an index that is smaller than the length
263// of the list.
264//
265// This function is meant to be used by language bindings in place
266// of g_list_model_get_item().
267//
268// See also: g_list_model_get_n_items()
269func (x *BookmarkList) GetObject(PositionVar uint) *gobject.Object {
270 var cls *gobject.Object
271
272 cret := gio.XGListModelGetObject(x.GoPointer(), PositionVar)
273
274 if cret == 0 {
275 return nil
276 }
277 cls = &gobject.Object{}
278 cls.Ptr = cret
279 return cls
280}
281
282// Emits the #GListModel::items-changed signal on @list.
283//
284// This function should only be called by classes implementing
285// #GListModel. It has to be called after the internal representation
286// of @list has been updated, because handlers connected to this signal
287// might query the new state of the list.
288//
289// Implementations must only make changes to the model (as visible to
290// its consumer) in places that will not cause problems for that
291// consumer. For models that are driven directly by a write API (such
292// as #GListStore), changes can be reported in response to uses of that
293// API. For models that represent remote data, changes should only be
294// made from a fresh mainloop dispatch. It is particularly not
295// permitted to make changes in response to a call to the #GListModel
296// consumer API.
297//
298// Stated another way: in general, it is assumed that code making a
299// series of accesses to the model via the API, without returning to the
300// mainloop, and without calling other code, will continue to view the
301// same contents of the model.
302func (x *BookmarkList) ItemsChanged(PositionVar uint, RemovedVar uint, AddedVar uint) {
303
304 gio.XGListModelItemsChanged(x.GoPointer(), PositionVar, RemovedVar, AddedVar)
305
306}
307
308func init() {
309 core.SetPackageName("GTK", "gtk4")
310 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
311 var libs []uintptr
312 for _, libPath := range core.GetPaths("GTK") {
313 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
314 if err != nil {
315 panic(err)
316 }
317 libs = append(libs, lib)
318 }
319
320 core.PuregoSafeRegister(&xBookmarkListGLibType, libs, "gtk_bookmark_list_get_type")
321
322 core.PuregoSafeRegister(&xNewBookmarkList, libs, "gtk_bookmark_list_new")
323
324 core.PuregoSafeRegister(&xBookmarkListGetAttributes, libs, "gtk_bookmark_list_get_attributes")
325 core.PuregoSafeRegister(&xBookmarkListGetFilename, libs, "gtk_bookmark_list_get_filename")
326 core.PuregoSafeRegister(&xBookmarkListGetIoPriority, libs, "gtk_bookmark_list_get_io_priority")
327 core.PuregoSafeRegister(&xBookmarkListIsLoading, libs, "gtk_bookmark_list_is_loading")
328 core.PuregoSafeRegister(&xBookmarkListSetAttributes, libs, "gtk_bookmark_list_set_attributes")
329 core.PuregoSafeRegister(&xBookmarkListSetIoPriority, libs, "gtk_bookmark_list_set_io_priority")
330
331}