v0.2.1 c0399be

gtkfilechooserdialog.go RawHistoryFolder

1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
3
4import (
5	"github.com/ebitengine/purego"
6
7	"github.com/bnema/puregotk/pkg/core"
8	"github.com/bnema/puregotk/v4/gdk"
9	"github.com/bnema/puregotk/v4/gio"
10	"github.com/bnema/puregotk/v4/glib"
11	"github.com/bnema/puregotk/v4/gobject"
12	"github.com/bnema/puregotk/v4/gobject/types"
13	"github.com/bnema/puregotk/v4/gsk"
14)
15
16// `GtkFileChooserDialog` is a dialog suitable for use with
17// “File Open” or “File Save” commands.
18//
19// ![An example GtkFileChooserDialog](filechooser.png)
20//
21// This widget works by putting a [class@Gtk.FileChooserWidget]
22// inside a [class@Gtk.Dialog]. It exposes the [iface@Gtk.FileChooser]
23// interface, so you can use all of the [iface@Gtk.FileChooser] functions
24// on the file chooser dialog as well as those for [class@Gtk.Dialog].
25//
26// Note that `GtkFileChooserDialog` does not have any methods of its
27// own. Instead, you should use the functions that work on a
28// [iface@Gtk.FileChooser].
29//
30// If you want to integrate well with the platform you should use the
31// [class@Gtk.FileChooserNative] API, which will use a platform-specific
32// dialog if available and fall back to `GtkFileChooserDialog`
33// otherwise.
34//
35// ## Typical usage
36//
37// In the simplest of cases, you can the following code to use
38// `GtkFileChooserDialog` to select a file for opening:
39//
40// ```c
41// static void
42// on_open_response (GtkDialog *dialog,
43//
44//	int        response)
45//
46//	{
47//	  if (response == GTK_RESPONSE_ACCEPT)
48//	    {
49//	      GtkFileChooser *chooser = GTK_FILE_CHOOSER (dialog);
50//
51//	      g_autoptr(GFile) file = gtk_file_chooser_get_file (chooser);
52//
53//	      open_file (file);
54//	    }
55//
56//	  gtk_window_destroy (GTK_WINDOW (dialog));
57//	}
58//
59//	// ...
60//	GtkWidget *dialog;
61//	GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_OPEN;
62//
63//	dialog = gtk_file_chooser_dialog_new ("Open File",
64//	                                      parent_window,
65//	                                      action,
66//	                                      _("_Cancel"),
67//	                                      GTK_RESPONSE_CANCEL,
68//	                                      _("_Open"),
69//	                                      GTK_RESPONSE_ACCEPT,
70//	                                      NULL);
71//
72//	gtk_window_present (GTK_WINDOW (dialog));
73//
74//	g_signal_connect (dialog, "response",
75//	                  G_CALLBACK (on_open_response),
76//	                  NULL);
77//
78// ```
79//
80// To use a dialog for saving, you can use this:
81//
82// ```c
83// static void
84// on_save_response (GtkDialog *dialog,
85//
86//	int        response)
87//
88//	{
89//	  if (response == GTK_RESPONSE_ACCEPT)
90//	    {
91//	      GtkFileChooser *chooser = GTK_FILE_CHOOSER (dialog);
92//
93//	      g_autoptr(GFile) file = gtk_file_chooser_get_file (chooser);
94//
95//	      save_to_file (file);
96//	    }
97//
98//	  gtk_window_destroy (GTK_WINDOW (dialog));
99//	}
100//
101//	// ...
102//	GtkWidget *dialog;
103//	GtkFileChooser *chooser;
104//	GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_SAVE;
105//
106//	dialog = gtk_file_chooser_dialog_new ("Save File",
107//	                                      parent_window,
108//	                                      action,
109//	                                      _("_Cancel"),
110//	                                      GTK_RESPONSE_CANCEL,
111//	                                      _("_Save"),
112//	                                      GTK_RESPONSE_ACCEPT,
113//	                                      NULL);
114//	chooser = GTK_FILE_CHOOSER (dialog);
115//
116//	if (user_edited_a_new_document)
117//	  gtk_file_chooser_set_current_name (chooser, _("Untitled document"));
118//	else
119//	  gtk_file_chooser_set_file (chooser, existing_filename);
120//
121//	gtk_window_present (GTK_WINDOW (dialog));
122//
123//	g_signal_connect (dialog, "response",
124//	                  G_CALLBACK (on_save_response),
125//	                  NULL);
126//
127// ```
128//
129// ## Setting up a file chooser dialog
130//
131// There are various cases in which you may need to use a `GtkFileChooserDialog`:
132//
133// - To select a file for opening, use %GTK_FILE_CHOOSER_ACTION_OPEN.
134//
135//   - To save a file for the first time, use %GTK_FILE_CHOOSER_ACTION_SAVE,
136//     and suggest a name such as “Untitled” with
137//     [method@Gtk.FileChooser.set_current_name].
138//
139//   - To save a file under a different name, use %GTK_FILE_CHOOSER_ACTION_SAVE,
140//     and set the existing file with [method@Gtk.FileChooser.set_file].
141//
142// - To choose a folder instead of a file, use %GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER.
143//
144// In general, you should only cause the file chooser to show a specific
145// folder when it is appropriate to use [method@Gtk.FileChooser.set_file],
146// i.e. when you are doing a “Save As” command and you already have a file
147// saved somewhere.
148//
149// ## Response Codes
150//
151// `GtkFileChooserDialog` inherits from [class@Gtk.Dialog], so buttons that
152// go in its action area have response codes such as %GTK_RESPONSE_ACCEPT and
153// %GTK_RESPONSE_CANCEL. For example, you could call
154// [ctor@Gtk.FileChooserDialog.new] as follows:
155//
156// ```c
157// GtkWidget *dialog;
158// GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_OPEN;
159//
160// dialog = gtk_file_chooser_dialog_new ("Open File",
161//
162//	parent_window,
163//	action,
164//	_("_Cancel"),
165//	GTK_RESPONSE_CANCEL,
166//	_("_Open"),
167//	GTK_RESPONSE_ACCEPT,
168//	NULL);
169//
170// ```
171//
172// This will create buttons for “Cancel” and “Open” that use predefined
173// response identifiers from [enum@Gtk.ResponseType].  For most dialog
174// boxes you can use your own custom response codes rather than the
175// ones in [enum@Gtk.ResponseType], but `GtkFileChooserDialog` assumes that
176// its “accept”-type action, e.g. an “Open” or “Save” button,
177// will have one of the following response codes:
178//
179// - %GTK_RESPONSE_ACCEPT
180// - %GTK_RESPONSE_OK
181// - %GTK_RESPONSE_YES
182// - %GTK_RESPONSE_APPLY
183//
184// This is because `GtkFileChooserDialog` must intercept responses and switch
185// to folders if appropriate, rather than letting the dialog terminate — the
186// implementation uses these known response codes to know which responses can
187// be blocked if appropriate.
188//
189// To summarize, make sure you use a predefined response code
190// when you use `GtkFileChooserDialog` to ensure proper operation.
191//
192// ## CSS nodes
193//
194// `GtkFileChooserDialog` has a single CSS node with the name `window` and style
195// class `.filechooser`.
196type FileChooserDialog struct {
197	Dialog
198}
199
200var xFileChooserDialogGLibType func() types.GType
201
202func FileChooserDialogGLibType() types.GType {
203	return xFileChooserDialogGLibType()
204}
205
206func FileChooserDialogNewFromInternalPtr(ptr uintptr) *FileChooserDialog {
207	cls := &FileChooserDialog{}
208	cls.Ptr = ptr
209	return cls
210}
211
212var xNewFileChooserDialog func(uintptr, uintptr, FileChooserAction, uintptr, ...interface{}) uintptr
213
214// Creates a new `GtkFileChooserDialog`.
215//
216// This function is analogous to [ctor@Gtk.Dialog.new_with_buttons].
217func NewFileChooserDialog(TitleVar *string, ParentVar *Window, ActionVar FileChooserAction, FirstButtonTextVar *string, varArgs ...interface{}) *FileChooserDialog {
218	var cls *FileChooserDialog
219
220	TitleVarPtr := core.GStrdupNullable(TitleVar)
221	defer core.GFreeNullable(TitleVarPtr)
222
223	FirstButtonTextVarPtr := core.GStrdupNullable(FirstButtonTextVar)
224	defer core.GFreeNullable(FirstButtonTextVarPtr)
225
226	cret := xNewFileChooserDialog(TitleVarPtr, ParentVar.GoPointer(), ActionVar, FirstButtonTextVarPtr, varArgs...)
227
228	if cret == 0 {
229		return nil
230	}
231	gobject.IncreaseRef(cret)
232	cls = &FileChooserDialog{}
233	cls.Ptr = cret
234	return cls
235}
236
237func (c *FileChooserDialog) GoPointer() uintptr {
238	if c == nil {
239		return 0
240	}
241	return c.Ptr
242}
243
244func (c *FileChooserDialog) SetGoPointer(ptr uintptr) {
245	c.Ptr = ptr
246}
247
248// Requests the user's screen reader to announce the given message.
249//
250// This kind of notification is useful for messages that
251// either have only a visual representation or that are not
252// exposed visually at all, e.g. a notification about a
253// successful operation.
254//
255// Also, by using this API, you can ensure that the message
256// does not interrupts the user's current screen reader output.
257func (x *FileChooserDialog) Announce(MessageVar string, PriorityVar AccessibleAnnouncementPriority) {
258
259	XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar)
260
261}
262
263// Retrieves the accessible parent for an accessible object.
264//
265// This function returns `NULL` for top level widgets.
266func (x *FileChooserDialog) GetAccessibleParent() *AccessibleBase {
267	var cls *AccessibleBase
268
269	cret := XGtkAccessibleGetAccessibleParent(x.GoPointer())
270
271	if cret == 0 {
272		return nil
273	}
274	cls = &AccessibleBase{}
275	cls.Ptr = cret
276	return cls
277}
278
279// Retrieves the accessible role of an accessible object.
280func (x *FileChooserDialog) GetAccessibleRole() AccessibleRole {
281
282	cret := XGtkAccessibleGetAccessibleRole(x.GoPointer())
283	return cret
284}
285
286// Retrieves the implementation for the given accessible object.
287func (x *FileChooserDialog) GetAtContext() *ATContext {
288	var cls *ATContext
289
290	cret := XGtkAccessibleGetAtContext(x.GoPointer())
291
292	if cret == 0 {
293		return nil
294	}
295	cls = &ATContext{}
296	cls.Ptr = cret
297	return cls
298}
299
300// Queries the coordinates and dimensions of this accessible
301//
302// This functionality can be overridden by `GtkAccessible`
303// implementations, e.g. to get the bounds from an ignored
304// child widget.
305func (x *FileChooserDialog) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool {
306
307	cret := XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
308	return cret
309}
310
311// Retrieves the first accessible child of an accessible object.
312func (x *FileChooserDialog) GetFirstAccessibleChild() *AccessibleBase {
313	var cls *AccessibleBase
314
315	cret := XGtkAccessibleGetFirstAccessibleChild(x.GoPointer())
316
317	if cret == 0 {
318		return nil
319	}
320	cls = &AccessibleBase{}
321	cls.Ptr = cret
322	return cls
323}
324
325// Retrieves the next accessible sibling of an accessible object
326func (x *FileChooserDialog) GetNextAccessibleSibling() *AccessibleBase {
327	var cls *AccessibleBase
328
329	cret := XGtkAccessibleGetNextAccessibleSibling(x.GoPointer())
330
331	if cret == 0 {
332		return nil
333	}
334	cls = &AccessibleBase{}
335	cls.Ptr = cret
336	return cls
337}
338
339// Queries a platform state, such as focus.
340//
341// This functionality can be overridden by `GtkAccessible`
342// implementations, e.g. to get platform state from an ignored
343// child widget, as is the case for `GtkText` wrappers.
344func (x *FileChooserDialog) GetPlatformState(StateVar AccessiblePlatformState) bool {
345
346	cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar)
347	return cret
348}
349
350// Resets the accessible property to its default value.
351func (x *FileChooserDialog) ResetProperty(PropertyVar AccessibleProperty) {
352
353	XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar)
354
355}
356
357// Resets the accessible relation to its default value.
358func (x *FileChooserDialog) ResetRelation(RelationVar AccessibleRelation) {
359
360	XGtkAccessibleResetRelation(x.GoPointer(), RelationVar)
361
362}
363
364// Resets the accessible state to its default value.
365func (x *FileChooserDialog) ResetState(StateVar AccessibleState) {
366
367	XGtkAccessibleResetState(x.GoPointer(), StateVar)
368
369}
370
371// Sets the parent and sibling of an accessible object.
372//
373// This function is meant to be used by accessible implementations that are
374// not part of the widget hierarchy, and but act as a logical bridge between
375// widgets. For instance, if a widget creates an object that holds metadata
376// for each child, and you want that object to implement the `GtkAccessible`
377// interface, you will use this function to ensure that the parent of each
378// child widget is the metadata object, and the parent of each metadata
379// object is the container widget.
380func (x *FileChooserDialog) SetAccessibleParent(ParentVar Accessible, NextSiblingVar Accessible) {
381
382	XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer())
383
384}
385
386// Updates the next accessible sibling.
387//
388// That might be useful when a new child of a custom accessible
389// is created, and it needs to be linked to a previous child.
390func (x *FileChooserDialog) UpdateNextAccessibleSibling(NewSiblingVar Accessible) {
391
392	XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer())
393
394}
395
396// Informs ATs that the platform state has changed.
397//
398// This function should be used by `GtkAccessible` implementations that
399// have a platform state but are not widgets. Widgets handle platform
400// states automatically.
401func (x *FileChooserDialog) UpdatePlatformState(StateVar AccessiblePlatformState) {
402
403	XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar)
404
405}
406
407// Updates a list of accessible properties.
408//
409// See the [enum@Gtk.AccessibleProperty] documentation for the
410// value types of accessible properties.
411//
412// This function should be called by `GtkWidget` types whenever
413// an accessible property change must be communicated to assistive
414// technologies.
415//
416// Example:
417// ```c
418// value = gtk_adjustment_get_value (adjustment);
419// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
420//
421//	GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
422//	-1);
423//
424// ```
425func (x *FileChooserDialog) UpdateProperty(FirstPropertyVar AccessibleProperty, varArgs ...interface{}) {
426
427	XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...)
428
429}
430
431// Updates an array of accessible properties.
432//
433// This function should be called by `GtkWidget` types whenever an accessible
434// property change must be communicated to assistive technologies.
435//
436// This function is meant to be used by language bindings.
437func (x *FileChooserDialog) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []AccessibleProperty, ValuesVar []gobject.Value) {
438
439	XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar)
440
441}
442
443// Updates a list of accessible relations.
444//
445// This function should be called by `GtkWidget` types whenever an accessible
446// relation change must be communicated to assistive technologies.
447//
448// If the [enum@Gtk.AccessibleRelation] requires a list of references,
449// you should pass each reference individually, followed by `NULL`, e.g.
450//
451// ```c
452// gtk_accessible_update_relation (accessible,
453//
454//	GTK_ACCESSIBLE_RELATION_CONTROLS,
455//	  ref1, NULL,
456//	GTK_ACCESSIBLE_RELATION_LABELLED_BY,
457//	  ref1, ref2, ref3, NULL,
458//	-1);
459//
460// ```
461func (x *FileChooserDialog) UpdateRelation(FirstRelationVar AccessibleRelation, varArgs ...interface{}) {
462
463	XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...)
464
465}
466
467// Updates an array of accessible relations.
468//
469// This function should be called by `GtkWidget` types whenever an accessible
470// relation change must be communicated to assistive technologies.
471//
472// This function is meant to be used by language bindings.
473func (x *FileChooserDialog) UpdateRelationValue(NRelationsVar int, RelationsVar []AccessibleRelation, ValuesVar []gobject.Value) {
474
475	XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar)
476
477}
478
479// Updates a list of accessible states.
480//
481// See the [enum@Gtk.AccessibleState] documentation for the
482// value types of accessible states.
483//
484// This function should be called by `GtkWidget` types whenever
485// an accessible state change must be communicated to assistive
486// technologies.
487//
488// Example:
489//
490// ```c
491// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
492// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
493//
494//	GTK_ACCESSIBLE_STATE_CHECKED, value,
495//	-1);
496//
497// ```
498func (x *FileChooserDialog) UpdateState(FirstStateVar AccessibleState, varArgs ...interface{}) {
499
500	XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...)
501
502}
503
504// Updates an array of accessible states.
505//
506// This function should be called by `GtkWidget` types whenever an accessible
507// state change must be communicated to assistive technologies.
508//
509// This function is meant to be used by language bindings.
510func (x *FileChooserDialog) UpdateStateValue(NStatesVar int, StatesVar []AccessibleState, ValuesVar []gobject.Value) {
511
512	XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar)
513
514}
515
516// Gets the ID of the @buildable object.
517//
518// `GtkBuilder` sets the name based on the ID attribute
519// of the `<object>` tag used to construct the @buildable.
520func (x *FileChooserDialog) GetBuildableId() string {
521
522	cret := XGtkBuildableGetBuildableId(x.GoPointer())
523	return cret
524}
525
526// Adds a 'choice' to the file chooser.
527//
528// This is typically implemented as a combobox or, for boolean choices,
529// as a checkbutton. You can select a value using
530// [method@Gtk.FileChooser.set_choice] before the dialog is shown,
531// and you can obtain the user-selected value in the
532// [signal@Gtk.Dialog::response] signal handler using
533// [method@Gtk.FileChooser.get_choice].
534func (x *FileChooserDialog) AddChoice(IdVar string, LabelVar string, OptionsVar []string, OptionLabelsVar []string) {
535
536	XGtkFileChooserAddChoice(x.GoPointer(), IdVar, LabelVar, OptionsVar, OptionLabelsVar)
537
538}
539
540// Adds @filter to the list of filters that the user can select between.
541//
542// When a filter is selected, only files that are passed by that
543// filter are displayed.
544//
545// Note that the @chooser takes ownership of the filter if it is floating,
546// so you have to ref and sink it if you want to keep a reference.
547func (x *FileChooserDialog) AddFilter(FilterVar *FileFilter) {
548
549	XGtkFileChooserAddFilter(x.GoPointer(), FilterVar.GoPointer())
550
551}
552
553// Adds a folder to be displayed with the shortcut folders
554// in a file chooser.
555func (x *FileChooserDialog) AddShortcutFolder(FolderVar gio.File) (bool, error) {
556	var cerr *glib.Error
557
558	cret := XGtkFileChooserAddShortcutFolder(x.GoPointer(), FolderVar.GoPointer(), &cerr)
559	if cerr == nil {
560		return cret, nil
561	}
562	return cret, cerr
563
564}
565
566// Gets the type of operation that the file chooser is performing.
567func (x *FileChooserDialog) GetAction() FileChooserAction {
568
569	cret := XGtkFileChooserGetAction(x.GoPointer())
570	return cret
571}
572
573// Gets the currently selected option in the 'choice' with the given ID.
574func (x *FileChooserDialog) GetChoice(IdVar string) string {
575
576	cret := XGtkFileChooserGetChoice(x.GoPointer(), IdVar)
577	return cret
578}
579
580// Gets whether file chooser will offer to create new folders.
581func (x *FileChooserDialog) GetCreateFolders() bool {
582
583	cret := XGtkFileChooserGetCreateFolders(x.GoPointer())
584	return cret
585}
586
587// Gets the current folder of @chooser as `GFile`.
588func (x *FileChooserDialog) GetCurrentFolder() *gio.FileBase {
589	var cls *gio.FileBase
590
591	cret := XGtkFileChooserGetCurrentFolder(x.GoPointer())
592
593	if cret == 0 {
594		return nil
595	}
596	cls = &gio.FileBase{}
597	cls.Ptr = cret
598	return cls
599}
600
601// Gets the current name in the file selector, as entered by the user.
602//
603// This is meant to be used in save dialogs, to get the currently typed
604// filename when the file itself does not exist yet.
605func (x *FileChooserDialog) GetCurrentName() string {
606
607	cret := XGtkFileChooserGetCurrentName(x.GoPointer())
608	return cret
609}
610
611// Gets the `GFile` for the currently selected file in
612// the file selector.
613//
614// If multiple files are selected, one of the files will be
615// returned at random.
616//
617// If the file chooser is in folder mode, this function returns
618// the selected folder.
619func (x *FileChooserDialog) GetFile() *gio.FileBase {
620	var cls *gio.FileBase
621
622	cret := XGtkFileChooserGetFile(x.GoPointer())
623
624	if cret == 0 {
625		return nil
626	}
627	cls = &gio.FileBase{}
628	cls.Ptr = cret
629	return cls
630}
631
632// Lists all the selected files and subfolders in the current folder
633// of @chooser as `GFile`.
634func (x *FileChooserDialog) GetFiles() *gio.ListModelBase {
635	var cls *gio.ListModelBase
636
637	cret := XGtkFileChooserGetFiles(x.GoPointer())
638
639	if cret == 0 {
640		return nil
641	}
642	cls = &gio.ListModelBase{}
643	cls.Ptr = cret
644	return cls
645}
646
647// Gets the current filter.
648func (x *FileChooserDialog) GetFilter() *FileFilter {
649	var cls *FileFilter
650
651	cret := XGtkFileChooserGetFilter(x.GoPointer())
652
653	if cret == 0 {
654		return nil
655	}
656	gobject.IncreaseRef(cret)
657	cls = &FileFilter{}
658	cls.Ptr = cret
659	return cls
660}
661
662// Gets the current set of user-selectable filters, as a list model.
663//
664// See [method@Gtk.FileChooser.add_filter] and
665// [method@Gtk.FileChooser.remove_filter] for changing individual filters.
666//
667// You should not modify the returned list model. Future changes to
668// @chooser may or may not affect the returned model.
669func (x *FileChooserDialog) GetFilters() *gio.ListModelBase {
670	var cls *gio.ListModelBase
671
672	cret := XGtkFileChooserGetFilters(x.GoPointer())
673
674	if cret == 0 {
675		return nil
676	}
677	cls = &gio.ListModelBase{}
678	cls.Ptr = cret
679	return cls
680}
681
682// Gets whether multiple files can be selected in the file
683// chooser.
684func (x *FileChooserDialog) GetSelectMultiple() bool {
685
686	cret := XGtkFileChooserGetSelectMultiple(x.GoPointer())
687	return cret
688}
689
690// Queries the list of shortcut folders in the file chooser.
691//
692// You should not modify the returned list model. Future changes to
693// @chooser may or may not affect the returned model.
694func (x *FileChooserDialog) GetShortcutFolders() *gio.ListModelBase {
695	var cls *gio.ListModelBase
696
697	cret := XGtkFileChooserGetShortcutFolders(x.GoPointer())
698
699	if cret == 0 {
700		return nil
701	}
702	cls = &gio.ListModelBase{}
703	cls.Ptr = cret
704	return cls
705}
706
707// Removes a 'choice' that has been added with gtk_file_chooser_add_choice().
708func (x *FileChooserDialog) RemoveChoice(IdVar string) {
709
710	XGtkFileChooserRemoveChoice(x.GoPointer(), IdVar)
711
712}
713
714// Removes @filter from the list of filters that the user can select between.
715func (x *FileChooserDialog) RemoveFilter(FilterVar *FileFilter) {
716
717	XGtkFileChooserRemoveFilter(x.GoPointer(), FilterVar.GoPointer())
718
719}
720
721// Removes a folder from the shortcut folders in a file chooser.
722func (x *FileChooserDialog) RemoveShortcutFolder(FolderVar gio.File) (bool, error) {
723	var cerr *glib.Error
724
725	cret := XGtkFileChooserRemoveShortcutFolder(x.GoPointer(), FolderVar.GoPointer(), &cerr)
726	if cerr == nil {
727		return cret, nil
728	}
729	return cret, cerr
730
731}
732
733// Sets the type of operation that the chooser is performing.
734//
735// The user interface is adapted to suit the selected action.
736//
737// For example, an option to create a new folder might be shown
738// if the action is %GTK_FILE_CHOOSER_ACTION_SAVE but not if the
739// action is %GTK_FILE_CHOOSER_ACTION_OPEN.
740func (x *FileChooserDialog) SetAction(ActionVar FileChooserAction) {
741
742	XGtkFileChooserSetAction(x.GoPointer(), ActionVar)
743
744}
745
746// Selects an option in a 'choice' that has been added with
747// gtk_file_chooser_add_choice().
748//
749// For a boolean choice, the possible options are "true" and "false".
750func (x *FileChooserDialog) SetChoice(IdVar string, OptionVar string) {
751
752	XGtkFileChooserSetChoice(x.GoPointer(), IdVar, OptionVar)
753
754}
755
756// Sets whether file chooser will offer to create new folders.
757//
758// This is only relevant if the action is not set to be
759// %GTK_FILE_CHOOSER_ACTION_OPEN.
760func (x *FileChooserDialog) SetCreateFolders(CreateFoldersVar bool) {
761
762	XGtkFileChooserSetCreateFolders(x.GoPointer(), CreateFoldersVar)
763
764}
765
766// Sets the current folder for @chooser from a `GFile`.
767func (x *FileChooserDialog) SetCurrentFolder(FileVar gio.File) (bool, error) {
768	var cerr *glib.Error
769
770	cret := XGtkFileChooserSetCurrentFolder(x.GoPointer(), FileVar.GoPointer(), &cerr)
771	if cerr == nil {
772		return cret, nil
773	}
774	return cret, cerr
775
776}
777
778// Sets the current name in the file selector, as if entered
779// by the user.
780//
781// Note that the name passed in here is a UTF-8 string rather
782// than a filename. This function is meant for such uses as a
783// suggested name in a “Save As...” dialog.  You can pass
784// “Untitled.doc” or a similarly suitable suggestion for the @name.
785//
786// If you want to preselect a particular existing file, you should
787// use [method@Gtk.FileChooser.set_file] instead.
788//
789// Please see the documentation for those functions for an example
790// of using [method@Gtk.FileChooser.set_current_name] as well.
791func (x *FileChooserDialog) SetCurrentName(NameVar string) {
792
793	XGtkFileChooserSetCurrentName(x.GoPointer(), NameVar)
794
795}
796
797// Sets @file as the current filename for the file chooser.
798//
799// This includes changing to the file’s parent folder and actually selecting
800// the file in list. If the @chooser is in %GTK_FILE_CHOOSER_ACTION_SAVE mode,
801// the file’s base name will also appear in the dialog’s file name entry.
802//
803// If the file name isn’t in the current folder of @chooser, then the current
804// folder of @chooser will be changed to the folder containing @file.
805//
806// Note that the file must exist, or nothing will be done except
807// for the directory change.
808//
809// If you are implementing a save dialog, you should use this function if
810// you already have a file name to which the user may save; for example,
811// when the user opens an existing file and then does “Save As…”. If you
812// don’t have a file name already — for example, if the user just created
813// a new file and is saving it for the first time, do not call this function.
814//
815// Instead, use something similar to this:
816//
817// ```c
818// static void
819// prepare_file_chooser (GtkFileChooser *chooser,
820//
821//	GFile          *existing_file)
822//
823//	{
824//	  gboolean document_is_new = (existing_file == NULL);
825//
826//	  if (document_is_new)
827//	    {
828//	      GFile *default_file_for_saving = g_file_new_for_path ("./out.txt");
829//	      // the user just created a new document
830//	      gtk_file_chooser_set_current_folder (chooser, default_file_for_saving, NULL);
831//	      gtk_file_chooser_set_current_name (chooser, "Untitled document");
832//	      g_object_unref (default_file_for_saving);
833//	    }
834//	  else
835//	    {
836//	      // the user edited an existing document
837//	      gtk_file_chooser_set_file (chooser, existing_file, NULL);
838//	    }
839//	}
840//
841// ```
842func (x *FileChooserDialog) SetFile(FileVar gio.File) (bool, error) {
843	var cerr *glib.Error
844
845	cret := XGtkFileChooserSetFile(x.GoPointer(), FileVar.GoPointer(), &cerr)
846	if cerr == nil {
847		return cret, nil
848	}
849	return cret, cerr
850
851}
852
853// Sets the current filter.
854//
855// Only the files that pass the filter will be displayed.
856// If the user-selectable list of filters is non-empty, then
857// the filter should be one of the filters in that list.
858//
859// Setting the current filter when the list of filters is
860// empty is useful if you want to restrict the displayed
861// set of files without letting the user change it.
862func (x *FileChooserDialog) SetFilter(FilterVar *FileFilter) {
863
864	XGtkFileChooserSetFilter(x.GoPointer(), FilterVar.GoPointer())
865
866}
867
868// Sets whether multiple files can be selected in the file chooser.
869//
870// This is only relevant if the action is set to be
871// %GTK_FILE_CHOOSER_ACTION_OPEN or
872// %GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER.
873func (x *FileChooserDialog) SetSelectMultiple(SelectMultipleVar bool) {
874
875	XGtkFileChooserSetSelectMultiple(x.GoPointer(), SelectMultipleVar)
876
877}
878
879// Returns the renderer that is used for this `GtkNative`.
880func (x *FileChooserDialog) GetRenderer() *gsk.Renderer {
881	var cls *gsk.Renderer
882
883	cret := XGtkNativeGetRenderer(x.GoPointer())
884
885	if cret == 0 {
886		return nil
887	}
888	gobject.IncreaseRef(cret)
889	cls = &gsk.Renderer{}
890	cls.Ptr = cret
891	return cls
892}
893
894// Returns the surface of this `GtkNative`.
895func (x *FileChooserDialog) GetSurface() *gdk.Surface {
896	var cls *gdk.Surface
897
898	cret := XGtkNativeGetSurface(x.GoPointer())
899
900	if cret == 0 {
901		return nil
902	}
903	gobject.IncreaseRef(cret)
904	cls = &gdk.Surface{}
905	cls.Ptr = cret
906	return cls
907}
908
909// Retrieves the surface transform of @self.
910//
911// This is the translation from @self's surface coordinates into
912// @self's widget coordinates.
913func (x *FileChooserDialog) GetSurfaceTransform(XVar *float64, YVar *float64) {
914
915	XGtkNativeGetSurfaceTransform(x.GoPointer(), XVar, YVar)
916
917}
918
919// Realizes a `GtkNative`.
920//
921// This should only be used by subclasses.
922func (x *FileChooserDialog) Realize() {
923
924	XGtkNativeRealize(x.GoPointer())
925
926}
927
928// Unrealizes a `GtkNative`.
929//
930// This should only be used by subclasses.
931func (x *FileChooserDialog) Unrealize() {
932
933	XGtkNativeUnrealize(x.GoPointer())
934
935}
936
937// Returns the display that this `GtkRoot` is on.
938func (x *FileChooserDialog) GetDisplay() *gdk.Display {
939	var cls *gdk.Display
940
941	cret := XGtkRootGetDisplay(x.GoPointer())
942
943	if cret == 0 {
944		return nil
945	}
946	gobject.IncreaseRef(cret)
947	cls = &gdk.Display{}
948	cls.Ptr = cret
949	return cls
950}
951
952// Retrieves the current focused widget within the root.
953//
954// Note that this is the widget that would have the focus
955// if the root is active; if the root is not focused then
956// `gtk_widget_has_focus (widget)` will be %FALSE for the
957// widget.
958func (x *FileChooserDialog) GetFocus() *Widget {
959	var cls *Widget
960
961	cret := XGtkRootGetFocus(x.GoPointer())
962
963	if cret == 0 {
964		return nil
965	}
966	gobject.IncreaseRef(cret)
967	cls = &Widget{}
968	cls.Ptr = cret
969	return cls
970}
971
972// If @focus is not the current focus widget, and is focusable, sets
973// it as the focus widget for the root.
974//
975// If @focus is %NULL, unsets the focus widget for the root.
976//
977// To set the focus to a particular widget in the root, it is usually
978// more convenient to use [method@Gtk.Widget.grab_focus] instead of
979// this function.
980func (x *FileChooserDialog) SetFocus(FocusVar *Widget) {
981
982	XGtkRootSetFocus(x.GoPointer(), FocusVar.GoPointer())
983
984}
985
986func init() {
987	core.SetPackageName("GTK", "gtk4")
988	core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
989	var libs []uintptr
990	for _, libPath := range core.GetPaths("GTK") {
991		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
992		if err != nil {
993			panic(err)
994		}
995		libs = append(libs, lib)
996	}
997
998	core.PuregoSafeRegister(&xFileChooserDialogGLibType, libs, "gtk_file_chooser_dialog_get_type")
999
1000	core.PuregoSafeRegister(&xNewFileChooserDialog, libs, "gtk_file_chooser_dialog_new")
1001
1002}

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