v0.2.1 c0399be

gtkfiledialog.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 FileDialogClass struct {
18	_ structs.HostLayout
19
20	ParentClass gobject.ObjectClass
21}
22
23func (x *FileDialogClass) GoPointer() uintptr {
24	return uintptr(unsafe.Pointer(x))
25}
26
27// Asynchronous API to present a file chooser dialog.
28//
29// `GtkFileDialog` collects the arguments that are needed to present
30// the dialog to the user, such as a title for the dialog and whether
31// it should be modal.
32//
33// The dialog is shown with [method@Gtk.FileDialog.open],
34// [method@Gtk.FileDialog.save], etc.
35type FileDialog struct {
36	gobject.Object
37}
38
39var xFileDialogGLibType func() types.GType
40
41func FileDialogGLibType() types.GType {
42	return xFileDialogGLibType()
43}
44
45func FileDialogNewFromInternalPtr(ptr uintptr) *FileDialog {
46	cls := &FileDialog{}
47	cls.Ptr = ptr
48	return cls
49}
50
51var xNewFileDialog func() uintptr
52
53// Creates a new `GtkFileDialog` object.
54func NewFileDialog() *FileDialog {
55	var cls *FileDialog
56
57	cret := xNewFileDialog()
58
59	if cret == 0 {
60		return nil
61	}
62	cls = &FileDialog{}
63	cls.Ptr = cret
64	return cls
65}
66
67var xFileDialogGetAcceptLabel func(uintptr) string
68
69// Retrieves the text used by the dialog on its accept button.
70func (x *FileDialog) GetAcceptLabel() string {
71
72	cret := xFileDialogGetAcceptLabel(x.GoPointer())
73	return cret
74}
75
76var xFileDialogGetDefaultFilter func(uintptr) uintptr
77
78// Gets the filter that will be selected by default
79// in the file chooser dialog.
80func (x *FileDialog) GetDefaultFilter() *FileFilter {
81	var cls *FileFilter
82
83	cret := xFileDialogGetDefaultFilter(x.GoPointer())
84
85	if cret == 0 {
86		return nil
87	}
88	gobject.IncreaseRef(cret)
89	cls = &FileFilter{}
90	cls.Ptr = cret
91	return cls
92}
93
94var xFileDialogGetFilters func(uintptr) uintptr
95
96// Gets the filters that will be offered to the user
97// in the file chooser dialog.
98func (x *FileDialog) GetFilters() *gio.ListModelBase {
99	var cls *gio.ListModelBase
100
101	cret := xFileDialogGetFilters(x.GoPointer())
102
103	if cret == 0 {
104		return nil
105	}
106	gobject.IncreaseRef(cret)
107	cls = &gio.ListModelBase{}
108	cls.Ptr = cret
109	return cls
110}
111
112var xFileDialogGetInitialFile func(uintptr) uintptr
113
114// Gets the file that will be initially selected in
115// the file chooser dialog.
116func (x *FileDialog) GetInitialFile() *gio.FileBase {
117	var cls *gio.FileBase
118
119	cret := xFileDialogGetInitialFile(x.GoPointer())
120
121	if cret == 0 {
122		return nil
123	}
124	gobject.IncreaseRef(cret)
125	cls = &gio.FileBase{}
126	cls.Ptr = cret
127	return cls
128}
129
130var xFileDialogGetInitialFolder func(uintptr) uintptr
131
132// Gets the folder that will be set as the
133// initial folder in the file chooser dialog.
134func (x *FileDialog) GetInitialFolder() *gio.FileBase {
135	var cls *gio.FileBase
136
137	cret := xFileDialogGetInitialFolder(x.GoPointer())
138
139	if cret == 0 {
140		return nil
141	}
142	gobject.IncreaseRef(cret)
143	cls = &gio.FileBase{}
144	cls.Ptr = cret
145	return cls
146}
147
148var xFileDialogGetInitialName func(uintptr) string
149
150// Gets the filename that will be initially selected.
151func (x *FileDialog) GetInitialName() string {
152
153	cret := xFileDialogGetInitialName(x.GoPointer())
154	return cret
155}
156
157var xFileDialogGetModal func(uintptr) bool
158
159// Returns whether the file chooser dialog blocks interaction
160// with the parent window while it is presented.
161func (x *FileDialog) GetModal() bool {
162
163	cret := xFileDialogGetModal(x.GoPointer())
164	return cret
165}
166
167var xFileDialogGetTitle func(uintptr) string
168
169// Returns the title that will be shown on the file chooser dialog.
170func (x *FileDialog) GetTitle() string {
171
172	cret := xFileDialogGetTitle(x.GoPointer())
173	return cret
174}
175
176var xFileDialogOpen func(uintptr, uintptr, uintptr, uintptr, uintptr)
177
178// Presents a file chooser dialog to the user.
179//
180// The file chooser dialog will be set up to select a single file.
181//
182// The @callback will be called when the dialog is closed.
183func (x *FileDialog) Open(ParentVar *Window, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) {
184
185	var CallbackVarRef uintptr
186	if CallbackVar != nil {
187		CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar))
188		if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok {
189			CallbackVarRef = cbRefPtr
190		} else {
191			fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) {
192				cbFn := *CallbackVar
193				cbFn(arg0, arg1, arg2)
194			}
195			CallbackVarRef = purego.NewCallback(fcb)
196			glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar)
197		}
198	}
199
200	xFileDialogOpen(x.GoPointer(), ParentVar.GoPointer(), CancellableVar.GoPointer(), CallbackVarRef, UserDataVar)
201
202}
203
204var xFileDialogOpenFinish func(uintptr, uintptr, **glib.Error) uintptr
205
206// Finishes the [method@Gtk.FileDialog.open] call.
207//
208// Note that this function returns a [error@Gtk.DialogError.DISMISSED]
209// error if the user cancels the dialog.
210func (x *FileDialog) OpenFinish(ResultVar gio.AsyncResult) (*gio.FileBase, error) {
211	var cls *gio.FileBase
212	var cerr *glib.Error
213
214	cret := xFileDialogOpenFinish(x.GoPointer(), ResultVar.GoPointer(), &cerr)
215
216	if cret == 0 {
217		return nil, cerr
218	}
219	cls = &gio.FileBase{}
220	cls.Ptr = cret
221	if cerr == nil {
222		return cls, nil
223	}
224	return cls, cerr
225
226}
227
228var xFileDialogOpenMultiple func(uintptr, uintptr, uintptr, uintptr, uintptr)
229
230// Presents a file chooser dialog to the user.
231//
232// The file chooser dialog will be set up to select multiple files.
233//
234// The file chooser dialog will initially be opened in the directory
235// [property@Gtk.FileDialog:initial-folder].
236//
237// The @callback will be called when the dialog is closed.
238func (x *FileDialog) OpenMultiple(ParentVar *Window, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) {
239
240	var CallbackVarRef uintptr
241	if CallbackVar != nil {
242		CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar))
243		if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok {
244			CallbackVarRef = cbRefPtr
245		} else {
246			fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) {
247				cbFn := *CallbackVar
248				cbFn(arg0, arg1, arg2)
249			}
250			CallbackVarRef = purego.NewCallback(fcb)
251			glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar)
252		}
253	}
254
255	xFileDialogOpenMultiple(x.GoPointer(), ParentVar.GoPointer(), CancellableVar.GoPointer(), CallbackVarRef, UserDataVar)
256
257}
258
259var xFileDialogOpenMultipleFinish func(uintptr, uintptr, **glib.Error) uintptr
260
261// Finishes the [method@Gtk.FileDialog.open] call.
262//
263// Note that this function returns a [error@Gtk.DialogError.DISMISSED]
264// error if the user cancels the dialog.
265func (x *FileDialog) OpenMultipleFinish(ResultVar gio.AsyncResult) (*gio.ListModelBase, error) {
266	var cls *gio.ListModelBase
267	var cerr *glib.Error
268
269	cret := xFileDialogOpenMultipleFinish(x.GoPointer(), ResultVar.GoPointer(), &cerr)
270
271	if cret == 0 {
272		return nil, cerr
273	}
274	cls = &gio.ListModelBase{}
275	cls.Ptr = cret
276	if cerr == nil {
277		return cls, nil
278	}
279	return cls, cerr
280
281}
282
283var xFileDialogOpenMultipleTextFiles func(uintptr, uintptr, uintptr, uintptr, uintptr)
284
285// Presents a file chooser dialog to the user.
286//
287// The file chooser dialog will be set up to select multiple files.
288//
289// The file chooser dialog will initially be opened in the directory
290// [property@Gtk.FileDialog:initial-folder].
291//
292// In contrast to [method@Gtk.FileDialog.open], this function
293// lets the user select the text encoding for the files, if possible.
294//
295// The @callback will be called when the dialog is closed.
296func (x *FileDialog) OpenMultipleTextFiles(ParentVar *Window, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) {
297
298	var CallbackVarRef uintptr
299	if CallbackVar != nil {
300		CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar))
301		if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok {
302			CallbackVarRef = cbRefPtr
303		} else {
304			fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) {
305				cbFn := *CallbackVar
306				cbFn(arg0, arg1, arg2)
307			}
308			CallbackVarRef = purego.NewCallback(fcb)
309			glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar)
310		}
311	}
312
313	xFileDialogOpenMultipleTextFiles(x.GoPointer(), ParentVar.GoPointer(), CancellableVar.GoPointer(), CallbackVarRef, UserDataVar)
314
315}
316
317var xFileDialogOpenMultipleTextFilesFinish func(uintptr, uintptr, *string, **glib.Error) uintptr
318
319// Finishes the [method@Gtk.FileDialog.open] call.
320//
321// Note that this function returns a [error@Gtk.DialogError.DISMISSED]
322// error if the user cancels the dialog.
323func (x *FileDialog) OpenMultipleTextFilesFinish(ResultVar gio.AsyncResult, EncodingVar *string) (*gio.ListModelBase, error) {
324	var cls *gio.ListModelBase
325	var cerr *glib.Error
326
327	cret := xFileDialogOpenMultipleTextFilesFinish(x.GoPointer(), ResultVar.GoPointer(), EncodingVar, &cerr)
328
329	if cret == 0 {
330		return nil, cerr
331	}
332	cls = &gio.ListModelBase{}
333	cls.Ptr = cret
334	if cerr == nil {
335		return cls, nil
336	}
337	return cls, cerr
338
339}
340
341var xFileDialogOpenTextFile func(uintptr, uintptr, uintptr, uintptr, uintptr)
342
343// Initiates a file selection operation by presenting a file chooser
344// dialog to the user.
345//
346// In contrast to [method@Gtk.FileDialog.open], this function
347// lets the user select the text encoding for the file, if possible.
348//
349// The @callback will be called when the dialog is closed.
350func (x *FileDialog) OpenTextFile(ParentVar *Window, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) {
351
352	var CallbackVarRef uintptr
353	if CallbackVar != nil {
354		CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar))
355		if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok {
356			CallbackVarRef = cbRefPtr
357		} else {
358			fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) {
359				cbFn := *CallbackVar
360				cbFn(arg0, arg1, arg2)
361			}
362			CallbackVarRef = purego.NewCallback(fcb)
363			glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar)
364		}
365	}
366
367	xFileDialogOpenTextFile(x.GoPointer(), ParentVar.GoPointer(), CancellableVar.GoPointer(), CallbackVarRef, UserDataVar)
368
369}
370
371var xFileDialogOpenTextFileFinish func(uintptr, uintptr, *string, **glib.Error) uintptr
372
373// Finishes the [method@Gtk.FileDialog.open_text_file] call
374// and returns the resulting file and text encoding.
375//
376// If the user has explicitly selected a text encoding to use
377// for the file, then @encoding will be set to a codeset name that
378// is suitable for passing to iconv_open(). Otherwise, it will
379// be `NULL`.
380//
381// Note that this function returns a [error@Gtk.DialogError.DISMISSED]
382// error if the user cancels the dialog.
383func (x *FileDialog) OpenTextFileFinish(ResultVar gio.AsyncResult, EncodingVar *string) (*gio.FileBase, error) {
384	var cls *gio.FileBase
385	var cerr *glib.Error
386
387	cret := xFileDialogOpenTextFileFinish(x.GoPointer(), ResultVar.GoPointer(), EncodingVar, &cerr)
388
389	if cret == 0 {
390		return nil, cerr
391	}
392	cls = &gio.FileBase{}
393	cls.Ptr = cret
394	if cerr == nil {
395		return cls, nil
396	}
397	return cls, cerr
398
399}
400
401var xFileDialogSave func(uintptr, uintptr, uintptr, uintptr, uintptr)
402
403// Presents a file chooser dialog to the user.
404//
405// The file chooser dialog will be save mode.
406//
407// The @callback will be called when the dialog is closed.
408func (x *FileDialog) Save(ParentVar *Window, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) {
409
410	var CallbackVarRef uintptr
411	if CallbackVar != nil {
412		CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar))
413		if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok {
414			CallbackVarRef = cbRefPtr
415		} else {
416			fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) {
417				cbFn := *CallbackVar
418				cbFn(arg0, arg1, arg2)
419			}
420			CallbackVarRef = purego.NewCallback(fcb)
421			glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar)
422		}
423	}
424
425	xFileDialogSave(x.GoPointer(), ParentVar.GoPointer(), CancellableVar.GoPointer(), CallbackVarRef, UserDataVar)
426
427}
428
429var xFileDialogSaveFinish func(uintptr, uintptr, **glib.Error) uintptr
430
431// Finishes the [method@Gtk.FileDialog.save] call.
432//
433// Note that this function returns a [error@Gtk.DialogError.DISMISSED]
434// error if the user cancels the dialog.
435func (x *FileDialog) SaveFinish(ResultVar gio.AsyncResult) (*gio.FileBase, error) {
436	var cls *gio.FileBase
437	var cerr *glib.Error
438
439	cret := xFileDialogSaveFinish(x.GoPointer(), ResultVar.GoPointer(), &cerr)
440
441	if cret == 0 {
442		return nil, cerr
443	}
444	cls = &gio.FileBase{}
445	cls.Ptr = cret
446	if cerr == nil {
447		return cls, nil
448	}
449	return cls, cerr
450
451}
452
453var xFileDialogSaveTextFile func(uintptr, uintptr, uintptr, uintptr, uintptr)
454
455// Initiates a file save operation by presenting a file chooser
456// dialog to the user.
457//
458// In contrast to [method@Gtk.FileDialog.save], this function
459// lets the user select the text encoding and line endings for
460// the text file, if possible.
461//
462// The @callback will be called when the dialog is closed.
463func (x *FileDialog) SaveTextFile(ParentVar *Window, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) {
464
465	var CallbackVarRef uintptr
466	if CallbackVar != nil {
467		CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar))
468		if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok {
469			CallbackVarRef = cbRefPtr
470		} else {
471			fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) {
472				cbFn := *CallbackVar
473				cbFn(arg0, arg1, arg2)
474			}
475			CallbackVarRef = purego.NewCallback(fcb)
476			glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar)
477		}
478	}
479
480	xFileDialogSaveTextFile(x.GoPointer(), ParentVar.GoPointer(), CancellableVar.GoPointer(), CallbackVarRef, UserDataVar)
481
482}
483
484var xFileDialogSaveTextFileFinish func(uintptr, uintptr, *string, *string, **glib.Error) uintptr
485
486// Finishes the [method@Gtk.FileDialog.save_text_file] call
487// and returns the resulting file, text encoding and line endings.
488//
489// If the user has explicitly selected a text encoding to use
490// for the file, then @encoding will be set to a codeset name that
491// is suitable for passing to iconv_open(). Otherwise, it will
492// be `NULL`.
493//
494// The @line_ending will be set to one of "\n", "\r\n", "\r" or "",
495// where the latter means to preserve existing line endings.
496//
497// Note that this function returns a [error@Gtk.DialogError.DISMISSED]
498// error if the user cancels the dialog.
499func (x *FileDialog) SaveTextFileFinish(ResultVar gio.AsyncResult, EncodingVar *string, LineEndingVar *string) (*gio.FileBase, error) {
500	var cls *gio.FileBase
501	var cerr *glib.Error
502
503	cret := xFileDialogSaveTextFileFinish(x.GoPointer(), ResultVar.GoPointer(), EncodingVar, LineEndingVar, &cerr)
504
505	if cret == 0 {
506		return nil, cerr
507	}
508	cls = &gio.FileBase{}
509	cls.Ptr = cret
510	if cerr == nil {
511		return cls, nil
512	}
513	return cls, cerr
514
515}
516
517var xFileDialogSelectFolder func(uintptr, uintptr, uintptr, uintptr, uintptr)
518
519// Presents a file chooser dialog to the user.
520//
521// The file chooser dialog will be set up to select a single folder.
522//
523// If you pass @initial_folder, the file chooser dialog will initially
524// be opened in the parent directory of that folder, otherwise, it
525// will be in the directory [property@Gtk.FileDialog:initial-folder].
526//
527// The @callback will be called when the dialog is closed.
528func (x *FileDialog) SelectFolder(ParentVar *Window, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) {
529
530	var CallbackVarRef uintptr
531	if CallbackVar != nil {
532		CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar))
533		if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok {
534			CallbackVarRef = cbRefPtr
535		} else {
536			fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) {
537				cbFn := *CallbackVar
538				cbFn(arg0, arg1, arg2)
539			}
540			CallbackVarRef = purego.NewCallback(fcb)
541			glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar)
542		}
543	}
544
545	xFileDialogSelectFolder(x.GoPointer(), ParentVar.GoPointer(), CancellableVar.GoPointer(), CallbackVarRef, UserDataVar)
546
547}
548
549var xFileDialogSelectFolderFinish func(uintptr, uintptr, **glib.Error) uintptr
550
551// Finishes the [method@Gtk.FileDialog.select_folder] call.
552//
553// Note that this function returns a [error@Gtk.DialogError.DISMISSED]
554// error if the user cancels the dialog.
555func (x *FileDialog) SelectFolderFinish(ResultVar gio.AsyncResult) (*gio.FileBase, error) {
556	var cls *gio.FileBase
557	var cerr *glib.Error
558
559	cret := xFileDialogSelectFolderFinish(x.GoPointer(), ResultVar.GoPointer(), &cerr)
560
561	if cret == 0 {
562		return nil, cerr
563	}
564	cls = &gio.FileBase{}
565	cls.Ptr = cret
566	if cerr == nil {
567		return cls, nil
568	}
569	return cls, cerr
570
571}
572
573var xFileDialogSelectMultipleFolders func(uintptr, uintptr, uintptr, uintptr, uintptr)
574
575// Presents a file chooser dialog to the user.
576//
577// The file chooser dialog will be set up to allow selecting
578// multiple folders.
579//
580// The file chooser dialog will initially be opened in the
581// directory [property@Gtk.FileDialog:initial-folder].
582//
583// The @callback will be called when the dialog is closed.
584func (x *FileDialog) SelectMultipleFolders(ParentVar *Window, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) {
585
586	var CallbackVarRef uintptr
587	if CallbackVar != nil {
588		CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar))
589		if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok {
590			CallbackVarRef = cbRefPtr
591		} else {
592			fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) {
593				cbFn := *CallbackVar
594				cbFn(arg0, arg1, arg2)
595			}
596			CallbackVarRef = purego.NewCallback(fcb)
597			glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar)
598		}
599	}
600
601	xFileDialogSelectMultipleFolders(x.GoPointer(), ParentVar.GoPointer(), CancellableVar.GoPointer(), CallbackVarRef, UserDataVar)
602
603}
604
605var xFileDialogSelectMultipleFoldersFinish func(uintptr, uintptr, **glib.Error) uintptr
606
607// Finishes the [method@Gtk.FileDialog.select_multiple_folders] call.
608//
609// Note that this function returns a [error@Gtk.DialogError.DISMISSED]
610// error if the user cancels the dialog.
611func (x *FileDialog) SelectMultipleFoldersFinish(ResultVar gio.AsyncResult) (*gio.ListModelBase, error) {
612	var cls *gio.ListModelBase
613	var cerr *glib.Error
614
615	cret := xFileDialogSelectMultipleFoldersFinish(x.GoPointer(), ResultVar.GoPointer(), &cerr)
616
617	if cret == 0 {
618		return nil, cerr
619	}
620	cls = &gio.ListModelBase{}
621	cls.Ptr = cret
622	if cerr == nil {
623		return cls, nil
624	}
625	return cls, cerr
626
627}
628
629var xFileDialogSetAcceptLabel func(uintptr, uintptr)
630
631// Sets the label shown on the file chooser's accept button.
632//
633// Leaving the accept label unset or setting it as `NULL` will
634// fall back to a default label, depending on what API is used
635// to launch the file dialog.
636func (x *FileDialog) SetAcceptLabel(AcceptLabelVar *string) {
637
638	AcceptLabelVarPtr := core.GStrdupNullable(AcceptLabelVar)
639	defer core.GFreeNullable(AcceptLabelVarPtr)
640
641	xFileDialogSetAcceptLabel(x.GoPointer(), AcceptLabelVarPtr)
642
643}
644
645var xFileDialogSetDefaultFilter func(uintptr, uintptr)
646
647// Sets the filter that will be selected by default
648// in the file chooser dialog.
649//
650// If set to `NULL`, the first item in [property@Gtk.FileDialog:filters]
651// will be used as the default filter. If that list is empty, the dialog
652// will be unfiltered.
653func (x *FileDialog) SetDefaultFilter(FilterVar *FileFilter) {
654
655	xFileDialogSetDefaultFilter(x.GoPointer(), FilterVar.GoPointer())
656
657}
658
659var xFileDialogSetFilters func(uintptr, uintptr)
660
661// Sets the filters that will be offered to the user
662// in the file chooser dialog.
663func (x *FileDialog) SetFilters(FiltersVar gio.ListModel) {
664
665	xFileDialogSetFilters(x.GoPointer(), FiltersVar.GoPointer())
666
667}
668
669var xFileDialogSetInitialFile func(uintptr, uintptr)
670
671// Sets the file that will be initially selected in
672// the file chooser dialog.
673//
674// This function is a shortcut for calling both
675// [method@Gtk.FileDialog.set_initial_folder] and
676// [method@Gtk.FileDialog.set_initial_name] with the
677// directory and name of @file, respectively.
678func (x *FileDialog) SetInitialFile(FileVar gio.File) {
679
680	xFileDialogSetInitialFile(x.GoPointer(), FileVar.GoPointer())
681
682}
683
684var xFileDialogSetInitialFolder func(uintptr, uintptr)
685
686// Sets the folder that will be set as the
687// initial folder in the file chooser dialog.
688func (x *FileDialog) SetInitialFolder(FolderVar gio.File) {
689
690	xFileDialogSetInitialFolder(x.GoPointer(), FolderVar.GoPointer())
691
692}
693
694var xFileDialogSetInitialName func(uintptr, uintptr)
695
696// Sets the filename that will be initially selected.
697//
698// For save dialogs, @name will usually be pre-entered into the
699// name field.
700//
701// If a file with this name already exists in the directory set
702// via [property@Gtk.FileDialog:initial-folder], the dialog will
703// preselect it.
704func (x *FileDialog) SetInitialName(NameVar *string) {
705
706	NameVarPtr := core.GStrdupNullable(NameVar)
707	defer core.GFreeNullable(NameVarPtr)
708
709	xFileDialogSetInitialName(x.GoPointer(), NameVarPtr)
710
711}
712
713var xFileDialogSetModal func(uintptr, bool)
714
715// Sets whether the file chooser dialog blocks interaction
716// with the parent window while it is presented.
717func (x *FileDialog) SetModal(ModalVar bool) {
718
719	xFileDialogSetModal(x.GoPointer(), ModalVar)
720
721}
722
723var xFileDialogSetTitle func(uintptr, string)
724
725// Sets the title that will be shown on the file chooser dialog.
726func (x *FileDialog) SetTitle(TitleVar string) {
727
728	xFileDialogSetTitle(x.GoPointer(), TitleVar)
729
730}
731
732func (c *FileDialog) GoPointer() uintptr {
733	if c == nil {
734		return 0
735	}
736	return c.Ptr
737}
738
739func (c *FileDialog) SetGoPointer(ptr uintptr) {
740	c.Ptr = ptr
741}
742
743// SetPropertyAcceptLabel sets the "accept-label" property.
744// Label for the file chooser's accept button.
745func (x *FileDialog) SetPropertyAcceptLabel(value string) {
746	var v gobject.Value
747	v.Init(gobject.TypeStringVal)
748	v.SetString(&value)
749	x.SetProperty("accept-label", &v)
750}
751
752// GetPropertyAcceptLabel gets the "accept-label" property.
753// Label for the file chooser's accept button.
754func (x *FileDialog) GetPropertyAcceptLabel() string {
755	var v gobject.Value
756	x.GetProperty("accept-label", &v)
757	return v.GetString()
758}
759
760// SetPropertyInitialName sets the "initial-name" property.
761// The initial name.
762//
763// This is the name of the file that is initially selected in the file chooser dialog.
764func (x *FileDialog) SetPropertyInitialName(value string) {
765	var v gobject.Value
766	v.Init(gobject.TypeStringVal)
767	v.SetString(&value)
768	x.SetProperty("initial-name", &v)
769}
770
771// GetPropertyInitialName gets the "initial-name" property.
772// The initial name.
773//
774// This is the name of the file that is initially selected in the file chooser dialog.
775func (x *FileDialog) GetPropertyInitialName() string {
776	var v gobject.Value
777	x.GetProperty("initial-name", &v)
778	return v.GetString()
779}
780
781// SetPropertyModal sets the "modal" property.
782// Whether the file chooser dialog is modal.
783func (x *FileDialog) SetPropertyModal(value bool) {
784	var v gobject.Value
785	v.Init(gobject.TypeBooleanVal)
786	v.SetBoolean(value)
787	x.SetProperty("modal", &v)
788}
789
790// GetPropertyModal gets the "modal" property.
791// Whether the file chooser dialog is modal.
792func (x *FileDialog) GetPropertyModal() bool {
793	var v gobject.Value
794	x.GetProperty("modal", &v)
795	return v.GetBoolean()
796}
797
798// SetPropertyTitle sets the "title" property.
799// A title that may be shown on the file chooser dialog.
800func (x *FileDialog) SetPropertyTitle(value string) {
801	var v gobject.Value
802	v.Init(gobject.TypeStringVal)
803	v.SetString(&value)
804	x.SetProperty("title", &v)
805}
806
807// GetPropertyTitle gets the "title" property.
808// A title that may be shown on the file chooser dialog.
809func (x *FileDialog) GetPropertyTitle() string {
810	var v gobject.Value
811	x.GetProperty("title", &v)
812	return v.GetString()
813}
814
815func init() {
816	core.SetPackageName("GTK", "gtk4")
817	core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
818	var libs []uintptr
819	for _, libPath := range core.GetPaths("GTK") {
820		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
821		if err != nil {
822			panic(err)
823		}
824		libs = append(libs, lib)
825	}
826
827	core.PuregoSafeRegister(&xFileDialogGLibType, libs, "gtk_file_dialog_get_type")
828
829	core.PuregoSafeRegister(&xNewFileDialog, libs, "gtk_file_dialog_new")
830
831	core.PuregoSafeRegister(&xFileDialogGetAcceptLabel, libs, "gtk_file_dialog_get_accept_label")
832	core.PuregoSafeRegister(&xFileDialogGetDefaultFilter, libs, "gtk_file_dialog_get_default_filter")
833	core.PuregoSafeRegister(&xFileDialogGetFilters, libs, "gtk_file_dialog_get_filters")
834	core.PuregoSafeRegister(&xFileDialogGetInitialFile, libs, "gtk_file_dialog_get_initial_file")
835	core.PuregoSafeRegister(&xFileDialogGetInitialFolder, libs, "gtk_file_dialog_get_initial_folder")
836	core.PuregoSafeRegister(&xFileDialogGetInitialName, libs, "gtk_file_dialog_get_initial_name")
837	core.PuregoSafeRegister(&xFileDialogGetModal, libs, "gtk_file_dialog_get_modal")
838	core.PuregoSafeRegister(&xFileDialogGetTitle, libs, "gtk_file_dialog_get_title")
839	core.PuregoSafeRegister(&xFileDialogOpen, libs, "gtk_file_dialog_open")
840	core.PuregoSafeRegister(&xFileDialogOpenFinish, libs, "gtk_file_dialog_open_finish")
841	core.PuregoSafeRegister(&xFileDialogOpenMultiple, libs, "gtk_file_dialog_open_multiple")
842	core.PuregoSafeRegister(&xFileDialogOpenMultipleFinish, libs, "gtk_file_dialog_open_multiple_finish")
843	core.PuregoSafeRegister(&xFileDialogOpenMultipleTextFiles, libs, "gtk_file_dialog_open_multiple_text_files")
844	core.PuregoSafeRegister(&xFileDialogOpenMultipleTextFilesFinish, libs, "gtk_file_dialog_open_multiple_text_files_finish")
845	core.PuregoSafeRegister(&xFileDialogOpenTextFile, libs, "gtk_file_dialog_open_text_file")
846	core.PuregoSafeRegister(&xFileDialogOpenTextFileFinish, libs, "gtk_file_dialog_open_text_file_finish")
847	core.PuregoSafeRegister(&xFileDialogSave, libs, "gtk_file_dialog_save")
848	core.PuregoSafeRegister(&xFileDialogSaveFinish, libs, "gtk_file_dialog_save_finish")
849	core.PuregoSafeRegister(&xFileDialogSaveTextFile, libs, "gtk_file_dialog_save_text_file")
850	core.PuregoSafeRegister(&xFileDialogSaveTextFileFinish, libs, "gtk_file_dialog_save_text_file_finish")
851	core.PuregoSafeRegister(&xFileDialogSelectFolder, libs, "gtk_file_dialog_select_folder")
852	core.PuregoSafeRegister(&xFileDialogSelectFolderFinish, libs, "gtk_file_dialog_select_folder_finish")
853	core.PuregoSafeRegister(&xFileDialogSelectMultipleFolders, libs, "gtk_file_dialog_select_multiple_folders")
854	core.PuregoSafeRegister(&xFileDialogSelectMultipleFoldersFinish, libs, "gtk_file_dialog_select_multiple_folders_finish")
855	core.PuregoSafeRegister(&xFileDialogSetAcceptLabel, libs, "gtk_file_dialog_set_accept_label")
856	core.PuregoSafeRegister(&xFileDialogSetDefaultFilter, libs, "gtk_file_dialog_set_default_filter")
857	core.PuregoSafeRegister(&xFileDialogSetFilters, libs, "gtk_file_dialog_set_filters")
858	core.PuregoSafeRegister(&xFileDialogSetInitialFile, libs, "gtk_file_dialog_set_initial_file")
859	core.PuregoSafeRegister(&xFileDialogSetInitialFolder, libs, "gtk_file_dialog_set_initial_folder")
860	core.PuregoSafeRegister(&xFileDialogSetInitialName, libs, "gtk_file_dialog_set_initial_name")
861	core.PuregoSafeRegister(&xFileDialogSetModal, libs, "gtk_file_dialog_set_modal")
862	core.PuregoSafeRegister(&xFileDialogSetTitle, libs, "gtk_file_dialog_set_title")
863
864}

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