v0.2.1 c0399be

gtkdirectorylist.go RawHistoryFolder

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/glib"
13	"github.com/bnema/puregotk/v4/gobject"
14	"github.com/bnema/puregotk/v4/gobject/types"
15)
16
17type DirectoryListClass struct {
18	_ structs.HostLayout
19
20	ParentClass gobject.ObjectClass
21}
22
23func (x *DirectoryListClass) GoPointer() uintptr {
24	return uintptr(unsafe.Pointer(x))
25}
26
27// A list model that wraps [method@Gio.File.enumerate_children_async].
28//
29// It presents a `GListModel` and fills it asynchronously with the `GFileInfo`s
30// returned from that function.
31//
32// Enumeration will start automatically when the
33// [property@Gtk.DirectoryList:file] property is set.
34//
35// While the `GtkDirectoryList` is being filled, the
36// [property@Gtk.DirectoryList:loading] property will be set to %TRUE. You can
37// listen to that property if you want to show information like a `GtkSpinner`
38// or a "Loading..." text.
39//
40// If loading fails at any point, the [property@Gtk.DirectoryList:error]
41// property will be set to give more indication about the failure.
42//
43// The `GFileInfo`s returned from a `GtkDirectoryList` have the "standard::file"
44// attribute set to the `GFile` they refer to. This way you can get at the file
45// that is referred to in the same way you would via g_file_enumerator_get_child().
46// This means you do not need access to the `GtkDirectoryList`, but can access
47// the `GFile` directly from the `GFileInfo` when operating with a `GtkListView`
48// or similar.
49type DirectoryList struct {
50	gobject.Object
51}
52
53var xDirectoryListGLibType func() types.GType
54
55func DirectoryListGLibType() types.GType {
56	return xDirectoryListGLibType()
57}
58
59func DirectoryListNewFromInternalPtr(ptr uintptr) *DirectoryList {
60	cls := &DirectoryList{}
61	cls.Ptr = ptr
62	return cls
63}
64
65var xNewDirectoryList func(uintptr, uintptr) uintptr
66
67// Creates a new `GtkDirectoryList`.
68//
69// The `GtkDirectoryList` is querying the given @file
70// with the given @attributes.
71func NewDirectoryList(AttributesVar *string, FileVar gio.File) *DirectoryList {
72	var cls *DirectoryList
73
74	AttributesVarPtr := core.GStrdupNullable(AttributesVar)
75	defer core.GFreeNullable(AttributesVarPtr)
76
77	cret := xNewDirectoryList(AttributesVarPtr, FileVar.GoPointer())
78
79	if cret == 0 {
80		return nil
81	}
82	cls = &DirectoryList{}
83	cls.Ptr = cret
84	return cls
85}
86
87var xDirectoryListGetAttributes func(uintptr) string
88
89// Gets the attributes queried on the children.
90func (x *DirectoryList) GetAttributes() string {
91
92	cret := xDirectoryListGetAttributes(x.GoPointer())
93	return cret
94}
95
96var xDirectoryListGetError func(uintptr) *glib.Error
97
98// Gets the loading error, if any.
99//
100// If an error occurs during the loading process, the loading process
101// will finish and this property allows querying the error that happened.
102// This error will persist until a file is loaded again.
103//
104// An error being set does not mean that no files were loaded, and all
105// successfully queried files will remain in the list.
106func (x *DirectoryList) GetError() *glib.Error {
107
108	cret := xDirectoryListGetError(x.GoPointer())
109	return cret
110}
111
112var xDirectoryListGetFile func(uintptr) uintptr
113
114// Gets the file whose children are currently enumerated.
115func (x *DirectoryList) GetFile() *gio.FileBase {
116	var cls *gio.FileBase
117
118	cret := xDirectoryListGetFile(x.GoPointer())
119
120	if cret == 0 {
121		return nil
122	}
123	gobject.IncreaseRef(cret)
124	cls = &gio.FileBase{}
125	cls.Ptr = cret
126	return cls
127}
128
129var xDirectoryListGetIoPriority func(uintptr) int
130
131// Gets the IO priority set via gtk_directory_list_set_io_priority().
132func (x *DirectoryList) GetIoPriority() int {
133
134	cret := xDirectoryListGetIoPriority(x.GoPointer())
135	return cret
136}
137
138var xDirectoryListGetMonitored func(uintptr) bool
139
140// Returns whether the directory list is monitoring
141// the directory for changes.
142func (x *DirectoryList) GetMonitored() bool {
143
144	cret := xDirectoryListGetMonitored(x.GoPointer())
145	return cret
146}
147
148var xDirectoryListIsLoading func(uintptr) bool
149
150// Returns %TRUE if the children enumeration is currently in
151// progress.
152//
153// Files will be added to @self from time to time while loading is
154// going on. The order in which are added is undefined and may change
155// in between runs.
156func (x *DirectoryList) IsLoading() bool {
157
158	cret := xDirectoryListIsLoading(x.GoPointer())
159	return cret
160}
161
162var xDirectoryListSetAttributes func(uintptr, uintptr)
163
164// Sets the @attributes to be enumerated and starts the enumeration.
165//
166// If @attributes is %NULL, the list of file infos will still be created, it will just
167// not contain any extra attributes.
168func (x *DirectoryList) SetAttributes(AttributesVar *string) {
169
170	AttributesVarPtr := core.GStrdupNullable(AttributesVar)
171	defer core.GFreeNullable(AttributesVarPtr)
172
173	xDirectoryListSetAttributes(x.GoPointer(), AttributesVarPtr)
174
175}
176
177var xDirectoryListSetFile func(uintptr, uintptr)
178
179// Sets the @file to be enumerated and starts the enumeration.
180//
181// If @file is %NULL, the result will be an empty list.
182func (x *DirectoryList) SetFile(FileVar gio.File) {
183
184	xDirectoryListSetFile(x.GoPointer(), FileVar.GoPointer())
185
186}
187
188var xDirectoryListSetIoPriority func(uintptr, int)
189
190// Sets the IO priority to use while loading directories.
191//
192// Setting the priority while @self is loading will reprioritize the
193// ongoing load as soon as possible.
194//
195// The default IO priority is %G_PRIORITY_DEFAULT, which is higher than
196// the GTK redraw priority. If you are loading a lot of directories in
197// parallel, lowering it to something like %G_PRIORITY_DEFAULT_IDLE
198// may increase responsiveness.
199func (x *DirectoryList) SetIoPriority(IoPriorityVar int) {
200
201	xDirectoryListSetIoPriority(x.GoPointer(), IoPriorityVar)
202
203}
204
205var xDirectoryListSetMonitored func(uintptr, bool)
206
207// Sets whether the directory list will monitor the directory
208// for changes.
209//
210// If monitoring is enabled, the ::items-changed signal will
211// be emitted when the directory contents change.
212//
213// When monitoring is turned on after the initial creation
214// of the directory list, the directory is reloaded to avoid
215// missing files that appeared between the initial loading
216// and when monitoring was turned on.
217func (x *DirectoryList) SetMonitored(MonitoredVar bool) {
218
219	xDirectoryListSetMonitored(x.GoPointer(), MonitoredVar)
220
221}
222
223func (c *DirectoryList) GoPointer() uintptr {
224	if c == nil {
225		return 0
226	}
227	return c.Ptr
228}
229
230func (c *DirectoryList) SetGoPointer(ptr uintptr) {
231	c.Ptr = ptr
232}
233
234// SetPropertyAttributes sets the "attributes" property.
235// The attributes to query.
236func (x *DirectoryList) SetPropertyAttributes(value string) {
237	var v gobject.Value
238	v.Init(gobject.TypeStringVal)
239	v.SetString(&value)
240	x.SetProperty("attributes", &v)
241}
242
243// GetPropertyAttributes gets the "attributes" property.
244// The attributes to query.
245func (x *DirectoryList) GetPropertyAttributes() string {
246	var v gobject.Value
247	x.GetProperty("attributes", &v)
248	return v.GetString()
249}
250
251// GetPropertyError gets the "error" property.
252// Error encountered while loading files.
253func (x *DirectoryList) GetPropertyError() uintptr {
254	var v gobject.Value
255	x.GetProperty("error", &v)
256	return v.GetPointer()
257}
258
259// SetPropertyIoPriority sets the "io-priority" property.
260// Priority used when loading.
261func (x *DirectoryList) SetPropertyIoPriority(value int) {
262	var v gobject.Value
263	v.Init(gobject.TypeIntVal)
264	v.SetInt(value)
265	x.SetProperty("io-priority", &v)
266}
267
268// GetPropertyIoPriority gets the "io-priority" property.
269// Priority used when loading.
270func (x *DirectoryList) GetPropertyIoPriority() int {
271	var v gobject.Value
272	x.GetProperty("io-priority", &v)
273	return v.GetInt()
274}
275
276// GetPropertyLoading gets the "loading" property.
277// %TRUE if files are being loaded.
278func (x *DirectoryList) GetPropertyLoading() bool {
279	var v gobject.Value
280	x.GetProperty("loading", &v)
281	return v.GetBoolean()
282}
283
284// SetPropertyMonitored sets the "monitored" property.
285// %TRUE if the directory is monitored for changed.
286func (x *DirectoryList) SetPropertyMonitored(value bool) {
287	var v gobject.Value
288	v.Init(gobject.TypeBooleanVal)
289	v.SetBoolean(value)
290	x.SetProperty("monitored", &v)
291}
292
293// GetPropertyMonitored gets the "monitored" property.
294// %TRUE if the directory is monitored for changed.
295func (x *DirectoryList) GetPropertyMonitored() bool {
296	var v gobject.Value
297	x.GetProperty("monitored", &v)
298	return v.GetBoolean()
299}
300
301// GetPropertyNItems gets the "n-items" property.
302// The number of items. See [method@Gio.ListModel.get_n_items].
303func (x *DirectoryList) GetPropertyNItems() uint {
304	var v gobject.Value
305	x.GetProperty("n-items", &v)
306	return v.GetUint()
307}
308
309// Get the item at @position.
310//
311// If @position is greater than the number of items in @list, %NULL is
312// returned.
313//
314// %NULL is never returned for an index that is smaller than the length
315// of the list.
316//
317// See also: g_list_model_get_n_items()
318func (x *DirectoryList) GetItem(PositionVar uint) uintptr {
319
320	cret := gio.XGListModelGetItem(x.GoPointer(), PositionVar)
321	return cret
322}
323
324// Gets the type of the items in @list.
325//
326// All items returned from g_list_model_get_item() are of the type
327// returned by this function, or a subtype, or if the type is an
328// interface, they are an implementation of that interface.
329//
330// The item type of a #GListModel can not change during the life of the
331// model.
332func (x *DirectoryList) GetItemType() types.GType {
333
334	cret := gio.XGListModelGetItemType(x.GoPointer())
335	return cret
336}
337
338// Gets the number of items in @list.
339//
340// Depending on the model implementation, calling this function may be
341// less efficient than iterating the list with increasing values for
342// @position until g_list_model_get_item() returns %NULL.
343func (x *DirectoryList) GetNItems() uint {
344
345	cret := gio.XGListModelGetNItems(x.GoPointer())
346	return cret
347}
348
349// Get the item at @position.
350//
351// If @position is greater than the number of items in @list, %NULL is
352// returned.
353//
354// %NULL is never returned for an index that is smaller than the length
355// of the list.
356//
357// This function is meant to be used by language bindings in place
358// of g_list_model_get_item().
359//
360// See also: g_list_model_get_n_items()
361func (x *DirectoryList) GetObject(PositionVar uint) *gobject.Object {
362	var cls *gobject.Object
363
364	cret := gio.XGListModelGetObject(x.GoPointer(), PositionVar)
365
366	if cret == 0 {
367		return nil
368	}
369	cls = &gobject.Object{}
370	cls.Ptr = cret
371	return cls
372}
373
374// Emits the #GListModel::items-changed signal on @list.
375//
376// This function should only be called by classes implementing
377// #GListModel. It has to be called after the internal representation
378// of @list has been updated, because handlers connected to this signal
379// might query the new state of the list.
380//
381// Implementations must only make changes to the model (as visible to
382// its consumer) in places that will not cause problems for that
383// consumer.  For models that are driven directly by a write API (such
384// as #GListStore), changes can be reported in response to uses of that
385// API.  For models that represent remote data, changes should only be
386// made from a fresh mainloop dispatch.  It is particularly not
387// permitted to make changes in response to a call to the #GListModel
388// consumer API.
389//
390// Stated another way: in general, it is assumed that code making a
391// series of accesses to the model via the API, without returning to the
392// mainloop, and without calling other code, will continue to view the
393// same contents of the model.
394func (x *DirectoryList) ItemsChanged(PositionVar uint, RemovedVar uint, AddedVar uint) {
395
396	gio.XGListModelItemsChanged(x.GoPointer(), PositionVar, RemovedVar, AddedVar)
397
398}
399
400func init() {
401	core.SetPackageName("GTK", "gtk4")
402	core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
403	var libs []uintptr
404	for _, libPath := range core.GetPaths("GTK") {
405		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
406		if err != nil {
407			panic(err)
408		}
409		libs = append(libs, lib)
410	}
411
412	core.PuregoSafeRegister(&xDirectoryListGLibType, libs, "gtk_directory_list_get_type")
413
414	core.PuregoSafeRegister(&xNewDirectoryList, libs, "gtk_directory_list_new")
415
416	core.PuregoSafeRegister(&xDirectoryListGetAttributes, libs, "gtk_directory_list_get_attributes")
417	core.PuregoSafeRegister(&xDirectoryListGetError, libs, "gtk_directory_list_get_error")
418	core.PuregoSafeRegister(&xDirectoryListGetFile, libs, "gtk_directory_list_get_file")
419	core.PuregoSafeRegister(&xDirectoryListGetIoPriority, libs, "gtk_directory_list_get_io_priority")
420	core.PuregoSafeRegister(&xDirectoryListGetMonitored, libs, "gtk_directory_list_get_monitored")
421	core.PuregoSafeRegister(&xDirectoryListIsLoading, libs, "gtk_directory_list_is_loading")
422	core.PuregoSafeRegister(&xDirectoryListSetAttributes, libs, "gtk_directory_list_set_attributes")
423	core.PuregoSafeRegister(&xDirectoryListSetFile, libs, "gtk_directory_list_set_file")
424	core.PuregoSafeRegister(&xDirectoryListSetIoPriority, libs, "gtk_directory_list_set_io_priority")
425	core.PuregoSafeRegister(&xDirectoryListSetMonitored, libs, "gtk_directory_list_set_monitored")
426
427}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 102

↑↓ moveenter openesc close