v0.2.1 c0399be

gtkfilechooserwidget.go RawHistoryFolder

1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
3
4import (
5	"unsafe"
6
7	"github.com/ebitengine/purego"
8
9	"github.com/bnema/puregotk/pkg/core"
10	"github.com/bnema/puregotk/v4/gio"
11	"github.com/bnema/puregotk/v4/glib"
12	"github.com/bnema/puregotk/v4/gobject"
13	"github.com/bnema/puregotk/v4/gobject/types"
14)
15
16// `GtkFileChooserWidget` is a widget for choosing files.
17//
18// It exposes the [iface@Gtk.FileChooser] interface, and you should
19// use the methods of this interface to interact with the
20// widget.
21//
22// # Shortcuts and Gestures
23//
24// `GtkFileChooserWidget` supports the following keyboard shortcuts:
25//
26// - <kbd>Shift</kbd>+<kbd>F10</kbd> or <kbd>Menu</kbd> opens the context menu.
27//
28// The following signals have default keybindings:
29//
30// - [signal@Gtk.FileChooserWidget::desktop-folder]
31// - [signal@Gtk.FileChooserWidget::down-folder]
32// - [signal@Gtk.FileChooserWidget::home-folder]
33// - [signal@Gtk.FileChooserWidget::location-popup]
34// - [signal@Gtk.FileChooserWidget::location-popup-on-paste]
35// - [signal@Gtk.FileChooserWidget::location-toggle-popup]
36// - [signal@Gtk.FileChooserWidget::places-shortcut]
37// - [signal@Gtk.FileChooserWidget::quick-bookmark]
38// - [signal@Gtk.FileChooserWidget::recent-shortcut]
39// - [signal@Gtk.FileChooserWidget::search-shortcut]
40// - [signal@Gtk.FileChooserWidget::show-hidden]
41// - [signal@Gtk.FileChooserWidget::up-folder]
42//
43// # CSS nodes
44//
45// `GtkFileChooserWidget` has a single CSS node with name filechooser.
46type FileChooserWidget struct {
47	Widget
48}
49
50var xFileChooserWidgetGLibType func() types.GType
51
52func FileChooserWidgetGLibType() types.GType {
53	return xFileChooserWidgetGLibType()
54}
55
56func FileChooserWidgetNewFromInternalPtr(ptr uintptr) *FileChooserWidget {
57	cls := &FileChooserWidget{}
58	cls.Ptr = ptr
59	return cls
60}
61
62var xNewFileChooserWidget func(FileChooserAction) uintptr
63
64// Creates a new `GtkFileChooserWidget`.
65//
66// This is a file chooser widget that can be embedded in custom
67// windows, and it is the same widget that is used by
68// `GtkFileChooserDialog`.
69func NewFileChooserWidget(ActionVar FileChooserAction) *FileChooserWidget {
70	var cls *FileChooserWidget
71
72	cret := xNewFileChooserWidget(ActionVar)
73
74	if cret == 0 {
75		return nil
76	}
77	gobject.IncreaseRef(cret)
78	cls = &FileChooserWidget{}
79	cls.Ptr = cret
80	return cls
81}
82
83func (c *FileChooserWidget) GoPointer() uintptr {
84	if c == nil {
85		return 0
86	}
87	return c.Ptr
88}
89
90func (c *FileChooserWidget) SetGoPointer(ptr uintptr) {
91	c.Ptr = ptr
92}
93
94// SetPropertySearchMode sets the "search-mode" property.
95// Whether search mode is enabled.
96func (x *FileChooserWidget) SetPropertySearchMode(value bool) {
97	var v gobject.Value
98	v.Init(gobject.TypeBooleanVal)
99	v.SetBoolean(value)
100	x.SetProperty("search-mode", &v)
101}
102
103// GetPropertySearchMode gets the "search-mode" property.
104// Whether search mode is enabled.
105func (x *FileChooserWidget) GetPropertySearchMode() bool {
106	var v gobject.Value
107	x.GetProperty("search-mode", &v)
108	return v.GetBoolean()
109}
110
111// GetPropertyShowTime gets the "show-time" property.
112// Whether to show the time.
113func (x *FileChooserWidget) GetPropertyShowTime() bool {
114	var v gobject.Value
115	x.GetProperty("show-time", &v)
116	return v.GetBoolean()
117}
118
119// GetPropertySubtitle gets the "subtitle" property.
120// The subtitle of the file chooser widget.
121func (x *FileChooserWidget) GetPropertySubtitle() string {
122	var v gobject.Value
123	x.GetProperty("subtitle", &v)
124	return v.GetString()
125}
126
127// Emitted when the user asks for it.
128//
129// This is a [keybinding signal](class.SignalAction.html).
130//
131// This is used to make the file chooser show the user's Desktop
132// folder in the file list.
133//
134// The default binding for this signal is <kbd>Alt</kbd>-<kbd>D</kbd>.
135func (x *FileChooserWidget) ConnectDesktopFolder(cb *func(FileChooserWidget)) uint {
136	cbPtr := uintptr(unsafe.Pointer(cb))
137	if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
138		handlerID := gobject.SignalConnect(x.GoPointer(), "desktop-folder", cbRefPtr)
139		glib.SaveHandlerMapping(handlerID, cbPtr)
140		return handlerID
141	}
142
143	fcb := func(clsPtr uintptr) {
144		fa := FileChooserWidget{}
145		fa.Ptr = clsPtr
146		cbFn := *cb
147
148		cbFn(fa)
149
150	}
151	cbRefPtr := purego.NewCallback(fcb)
152	glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
153	handlerID := gobject.SignalConnect(x.GoPointer(), "desktop-folder", cbRefPtr)
154	glib.SaveHandlerMapping(handlerID, cbPtr)
155	return handlerID
156}
157
158// Emitted when the user asks for it.
159//
160// This is a [keybinding signal](class.SignalAction.html).
161//
162// This is used to make the file chooser go to a child of the
163// current folder in the file hierarchy. The subfolder that will
164// be used is displayed in the path bar widget of the file chooser.
165// For example, if the path bar is showing "/foo/bar/baz", with bar
166// currently displayed, then this will cause the file chooser to
167// switch to the "baz" subfolder.
168//
169// The default binding for this signal is <kbd>Alt</kbd>-<kbd>Down</kbd>.
170func (x *FileChooserWidget) ConnectDownFolder(cb *func(FileChooserWidget)) uint {
171	cbPtr := uintptr(unsafe.Pointer(cb))
172	if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
173		handlerID := gobject.SignalConnect(x.GoPointer(), "down-folder", cbRefPtr)
174		glib.SaveHandlerMapping(handlerID, cbPtr)
175		return handlerID
176	}
177
178	fcb := func(clsPtr uintptr) {
179		fa := FileChooserWidget{}
180		fa.Ptr = clsPtr
181		cbFn := *cb
182
183		cbFn(fa)
184
185	}
186	cbRefPtr := purego.NewCallback(fcb)
187	glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
188	handlerID := gobject.SignalConnect(x.GoPointer(), "down-folder", cbRefPtr)
189	glib.SaveHandlerMapping(handlerID, cbPtr)
190	return handlerID
191}
192
193// Emitted when the user asks for it.
194//
195// This is a [keybinding signal](class.SignalAction.html).
196//
197// This is used to make the file chooser show the user's home
198// folder in the file list.
199//
200// The default binding for this signal is <kbd>Alt</kbd>-<kbd>Home</kbd>.
201func (x *FileChooserWidget) ConnectHomeFolder(cb *func(FileChooserWidget)) uint {
202	cbPtr := uintptr(unsafe.Pointer(cb))
203	if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
204		handlerID := gobject.SignalConnect(x.GoPointer(), "home-folder", cbRefPtr)
205		glib.SaveHandlerMapping(handlerID, cbPtr)
206		return handlerID
207	}
208
209	fcb := func(clsPtr uintptr) {
210		fa := FileChooserWidget{}
211		fa.Ptr = clsPtr
212		cbFn := *cb
213
214		cbFn(fa)
215
216	}
217	cbRefPtr := purego.NewCallback(fcb)
218	glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
219	handlerID := gobject.SignalConnect(x.GoPointer(), "home-folder", cbRefPtr)
220	glib.SaveHandlerMapping(handlerID, cbPtr)
221	return handlerID
222}
223
224// Emitted when the user asks for it.
225//
226// This is a [keybinding signal](class.SignalAction.html).
227//
228// This is used to make the file chooser show a "Location" prompt which
229// the user can use to manually type the name of the file he wishes to select.
230//
231// The default bindings for this signal are <kbd>Control</kbd>-<kbd>L</kbd>
232// with a @path string of "" (the empty string). It is also bound to
233// <kbd>/</kbd> with a @path string of "`/`" (a slash):  this lets you
234// type `/` and immediately type a path name. On Unix systems, this is
235// bound to <kbd>~</kbd> (tilde) with a @path string of "~" itself for
236// access to home directories.
237func (x *FileChooserWidget) ConnectLocationPopup(cb *func(FileChooserWidget, string)) uint {
238	cbPtr := uintptr(unsafe.Pointer(cb))
239	if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
240		handlerID := gobject.SignalConnect(x.GoPointer(), "location-popup", cbRefPtr)
241		glib.SaveHandlerMapping(handlerID, cbPtr)
242		return handlerID
243	}
244
245	fcb := func(clsPtr uintptr, PathVarp uintptr) {
246		fa := FileChooserWidget{}
247		fa.Ptr = clsPtr
248		cbFn := *cb
249
250		cbFn(fa, core.GoString(PathVarp))
251
252	}
253	cbRefPtr := purego.NewCallback(fcb)
254	glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
255	handlerID := gobject.SignalConnect(x.GoPointer(), "location-popup", cbRefPtr)
256	glib.SaveHandlerMapping(handlerID, cbPtr)
257	return handlerID
258}
259
260// Emitted when the user asks for it.
261//
262// This is a [keybinding signal](class.SignalAction.html).
263//
264// This is used to make the file chooser show a "Location" prompt
265// when the user pastes into a `GtkFileChooserWidget`.
266//
267// The default binding for this signal is <kbd>Control</kbd>-<kbd>V</kbd>.
268func (x *FileChooserWidget) ConnectLocationPopupOnPaste(cb *func(FileChooserWidget)) uint {
269	cbPtr := uintptr(unsafe.Pointer(cb))
270	if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
271		handlerID := gobject.SignalConnect(x.GoPointer(), "location-popup-on-paste", cbRefPtr)
272		glib.SaveHandlerMapping(handlerID, cbPtr)
273		return handlerID
274	}
275
276	fcb := func(clsPtr uintptr) {
277		fa := FileChooserWidget{}
278		fa.Ptr = clsPtr
279		cbFn := *cb
280
281		cbFn(fa)
282
283	}
284	cbRefPtr := purego.NewCallback(fcb)
285	glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
286	handlerID := gobject.SignalConnect(x.GoPointer(), "location-popup-on-paste", cbRefPtr)
287	glib.SaveHandlerMapping(handlerID, cbPtr)
288	return handlerID
289}
290
291// Emitted when the user asks for it.
292//
293// This is a [keybinding signal](class.SignalAction.html).
294//
295// This is used to toggle the visibility of a "Location" prompt
296// which the user can use to manually type the name of the file
297// he wishes to select.
298//
299// The default binding for this signal is <kbd>Control</kbd>-<kbd>L</kbd>.
300func (x *FileChooserWidget) ConnectLocationTogglePopup(cb *func(FileChooserWidget)) uint {
301	cbPtr := uintptr(unsafe.Pointer(cb))
302	if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
303		handlerID := gobject.SignalConnect(x.GoPointer(), "location-toggle-popup", cbRefPtr)
304		glib.SaveHandlerMapping(handlerID, cbPtr)
305		return handlerID
306	}
307
308	fcb := func(clsPtr uintptr) {
309		fa := FileChooserWidget{}
310		fa.Ptr = clsPtr
311		cbFn := *cb
312
313		cbFn(fa)
314
315	}
316	cbRefPtr := purego.NewCallback(fcb)
317	glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
318	handlerID := gobject.SignalConnect(x.GoPointer(), "location-toggle-popup", cbRefPtr)
319	glib.SaveHandlerMapping(handlerID, cbPtr)
320	return handlerID
321}
322
323// Emitted when the user asks for it.
324//
325// This is a [keybinding signal](class.SignalAction.html).
326//
327// This is used to move the focus to the places sidebar.
328//
329// The default binding for this signal is <kbd>Alt</kbd>-<kbd>P</kbd>.
330func (x *FileChooserWidget) ConnectPlacesShortcut(cb *func(FileChooserWidget)) uint {
331	cbPtr := uintptr(unsafe.Pointer(cb))
332	if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
333		handlerID := gobject.SignalConnect(x.GoPointer(), "places-shortcut", cbRefPtr)
334		glib.SaveHandlerMapping(handlerID, cbPtr)
335		return handlerID
336	}
337
338	fcb := func(clsPtr uintptr) {
339		fa := FileChooserWidget{}
340		fa.Ptr = clsPtr
341		cbFn := *cb
342
343		cbFn(fa)
344
345	}
346	cbRefPtr := purego.NewCallback(fcb)
347	glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
348	handlerID := gobject.SignalConnect(x.GoPointer(), "places-shortcut", cbRefPtr)
349	glib.SaveHandlerMapping(handlerID, cbPtr)
350	return handlerID
351}
352
353// Emitted when the user asks for it.
354//
355// This is a [keybinding signal](class.SignalAction.html).
356//
357// This is used to make the file chooser switch to the bookmark
358// specified in the @bookmark_index parameter. For example, if
359// you have three bookmarks, you can pass 0, 1, 2 to this signal
360// to switch to each of them, respectively.
361//
362// The default binding for this signal is <kbd>Alt</kbd>-<kbd>1</kbd>,
363// <kbd>Alt</kbd>-<kbd>2</kbd>, etc. until <kbd>Alt</kbd>-<kbd>0</kbd>.
364// Note that in the default binding, that <kbd>Alt</kbd>-<kbd>1</kbd> is
365// actually defined to switch to the bookmark at index 0, and so on
366// successively.
367func (x *FileChooserWidget) ConnectQuickBookmark(cb *func(FileChooserWidget, int)) uint {
368	cbPtr := uintptr(unsafe.Pointer(cb))
369	if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
370		handlerID := gobject.SignalConnect(x.GoPointer(), "quick-bookmark", cbRefPtr)
371		glib.SaveHandlerMapping(handlerID, cbPtr)
372		return handlerID
373	}
374
375	fcb := func(clsPtr uintptr, BookmarkIndexVarp int) {
376		fa := FileChooserWidget{}
377		fa.Ptr = clsPtr
378		cbFn := *cb
379
380		cbFn(fa, BookmarkIndexVarp)
381
382	}
383	cbRefPtr := purego.NewCallback(fcb)
384	glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
385	handlerID := gobject.SignalConnect(x.GoPointer(), "quick-bookmark", cbRefPtr)
386	glib.SaveHandlerMapping(handlerID, cbPtr)
387	return handlerID
388}
389
390// Emitted when the user asks for it.
391//
392// This is a [keybinding signal](class.SignalAction.html).
393//
394// This is used to make the file chooser show the Recent location.
395//
396// The default binding for this signal is <kbd>Alt</kbd>-<kbd>R</kbd>.
397func (x *FileChooserWidget) ConnectRecentShortcut(cb *func(FileChooserWidget)) uint {
398	cbPtr := uintptr(unsafe.Pointer(cb))
399	if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
400		handlerID := gobject.SignalConnect(x.GoPointer(), "recent-shortcut", cbRefPtr)
401		glib.SaveHandlerMapping(handlerID, cbPtr)
402		return handlerID
403	}
404
405	fcb := func(clsPtr uintptr) {
406		fa := FileChooserWidget{}
407		fa.Ptr = clsPtr
408		cbFn := *cb
409
410		cbFn(fa)
411
412	}
413	cbRefPtr := purego.NewCallback(fcb)
414	glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
415	handlerID := gobject.SignalConnect(x.GoPointer(), "recent-shortcut", cbRefPtr)
416	glib.SaveHandlerMapping(handlerID, cbPtr)
417	return handlerID
418}
419
420// Emitted when the user asks for it.
421//
422// This is a [keybinding signal](class.SignalAction.html).
423//
424// This is used to make the file chooser show the search entry.
425//
426// The default binding for this signal is <kbd>Alt</kbd>-<kbd>S</kbd>.
427func (x *FileChooserWidget) ConnectSearchShortcut(cb *func(FileChooserWidget)) uint {
428	cbPtr := uintptr(unsafe.Pointer(cb))
429	if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
430		handlerID := gobject.SignalConnect(x.GoPointer(), "search-shortcut", cbRefPtr)
431		glib.SaveHandlerMapping(handlerID, cbPtr)
432		return handlerID
433	}
434
435	fcb := func(clsPtr uintptr) {
436		fa := FileChooserWidget{}
437		fa.Ptr = clsPtr
438		cbFn := *cb
439
440		cbFn(fa)
441
442	}
443	cbRefPtr := purego.NewCallback(fcb)
444	glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
445	handlerID := gobject.SignalConnect(x.GoPointer(), "search-shortcut", cbRefPtr)
446	glib.SaveHandlerMapping(handlerID, cbPtr)
447	return handlerID
448}
449
450// Emitted when the user asks for it.
451//
452// This is a [keybinding signal](class.SignalAction.html).
453//
454// This is used to make the file chooser display hidden files.
455//
456// The default binding for this signal is <kbd>Control</kbd>-<kbd>H</kbd>.
457func (x *FileChooserWidget) ConnectShowHidden(cb *func(FileChooserWidget)) uint {
458	cbPtr := uintptr(unsafe.Pointer(cb))
459	if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
460		handlerID := gobject.SignalConnect(x.GoPointer(), "show-hidden", cbRefPtr)
461		glib.SaveHandlerMapping(handlerID, cbPtr)
462		return handlerID
463	}
464
465	fcb := func(clsPtr uintptr) {
466		fa := FileChooserWidget{}
467		fa.Ptr = clsPtr
468		cbFn := *cb
469
470		cbFn(fa)
471
472	}
473	cbRefPtr := purego.NewCallback(fcb)
474	glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
475	handlerID := gobject.SignalConnect(x.GoPointer(), "show-hidden", cbRefPtr)
476	glib.SaveHandlerMapping(handlerID, cbPtr)
477	return handlerID
478}
479
480// Emitted when the user asks for it.
481//
482// This is a [keybinding signal](class.SignalAction.html).
483//
484// This is used to make the file chooser go to the parent
485// of the current folder in the file hierarchy.
486//
487// The default binding for this signal is <kbd>Alt</kbd>-<kbd>Up</kbd>.
488func (x *FileChooserWidget) ConnectUpFolder(cb *func(FileChooserWidget)) uint {
489	cbPtr := uintptr(unsafe.Pointer(cb))
490	if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
491		handlerID := gobject.SignalConnect(x.GoPointer(), "up-folder", cbRefPtr)
492		glib.SaveHandlerMapping(handlerID, cbPtr)
493		return handlerID
494	}
495
496	fcb := func(clsPtr uintptr) {
497		fa := FileChooserWidget{}
498		fa.Ptr = clsPtr
499		cbFn := *cb
500
501		cbFn(fa)
502
503	}
504	cbRefPtr := purego.NewCallback(fcb)
505	glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
506	handlerID := gobject.SignalConnect(x.GoPointer(), "up-folder", cbRefPtr)
507	glib.SaveHandlerMapping(handlerID, cbPtr)
508	return handlerID
509}
510
511// Requests the user's screen reader to announce the given message.
512//
513// This kind of notification is useful for messages that
514// either have only a visual representation or that are not
515// exposed visually at all, e.g. a notification about a
516// successful operation.
517//
518// Also, by using this API, you can ensure that the message
519// does not interrupts the user's current screen reader output.
520func (x *FileChooserWidget) Announce(MessageVar string, PriorityVar AccessibleAnnouncementPriority) {
521
522	XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar)
523
524}
525
526// Retrieves the accessible parent for an accessible object.
527//
528// This function returns `NULL` for top level widgets.
529func (x *FileChooserWidget) GetAccessibleParent() *AccessibleBase {
530	var cls *AccessibleBase
531
532	cret := XGtkAccessibleGetAccessibleParent(x.GoPointer())
533
534	if cret == 0 {
535		return nil
536	}
537	cls = &AccessibleBase{}
538	cls.Ptr = cret
539	return cls
540}
541
542// Retrieves the accessible role of an accessible object.
543func (x *FileChooserWidget) GetAccessibleRole() AccessibleRole {
544
545	cret := XGtkAccessibleGetAccessibleRole(x.GoPointer())
546	return cret
547}
548
549// Retrieves the implementation for the given accessible object.
550func (x *FileChooserWidget) GetAtContext() *ATContext {
551	var cls *ATContext
552
553	cret := XGtkAccessibleGetAtContext(x.GoPointer())
554
555	if cret == 0 {
556		return nil
557	}
558	cls = &ATContext{}
559	cls.Ptr = cret
560	return cls
561}
562
563// Queries the coordinates and dimensions of this accessible
564//
565// This functionality can be overridden by `GtkAccessible`
566// implementations, e.g. to get the bounds from an ignored
567// child widget.
568func (x *FileChooserWidget) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool {
569
570	cret := XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
571	return cret
572}
573
574// Retrieves the first accessible child of an accessible object.
575func (x *FileChooserWidget) GetFirstAccessibleChild() *AccessibleBase {
576	var cls *AccessibleBase
577
578	cret := XGtkAccessibleGetFirstAccessibleChild(x.GoPointer())
579
580	if cret == 0 {
581		return nil
582	}
583	cls = &AccessibleBase{}
584	cls.Ptr = cret
585	return cls
586}
587
588// Retrieves the next accessible sibling of an accessible object
589func (x *FileChooserWidget) GetNextAccessibleSibling() *AccessibleBase {
590	var cls *AccessibleBase
591
592	cret := XGtkAccessibleGetNextAccessibleSibling(x.GoPointer())
593
594	if cret == 0 {
595		return nil
596	}
597	cls = &AccessibleBase{}
598	cls.Ptr = cret
599	return cls
600}
601
602// Queries a platform state, such as focus.
603//
604// This functionality can be overridden by `GtkAccessible`
605// implementations, e.g. to get platform state from an ignored
606// child widget, as is the case for `GtkText` wrappers.
607func (x *FileChooserWidget) GetPlatformState(StateVar AccessiblePlatformState) bool {
608
609	cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar)
610	return cret
611}
612
613// Resets the accessible property to its default value.
614func (x *FileChooserWidget) ResetProperty(PropertyVar AccessibleProperty) {
615
616	XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar)
617
618}
619
620// Resets the accessible relation to its default value.
621func (x *FileChooserWidget) ResetRelation(RelationVar AccessibleRelation) {
622
623	XGtkAccessibleResetRelation(x.GoPointer(), RelationVar)
624
625}
626
627// Resets the accessible state to its default value.
628func (x *FileChooserWidget) ResetState(StateVar AccessibleState) {
629
630	XGtkAccessibleResetState(x.GoPointer(), StateVar)
631
632}
633
634// Sets the parent and sibling of an accessible object.
635//
636// This function is meant to be used by accessible implementations that are
637// not part of the widget hierarchy, and but act as a logical bridge between
638// widgets. For instance, if a widget creates an object that holds metadata
639// for each child, and you want that object to implement the `GtkAccessible`
640// interface, you will use this function to ensure that the parent of each
641// child widget is the metadata object, and the parent of each metadata
642// object is the container widget.
643func (x *FileChooserWidget) SetAccessibleParent(ParentVar Accessible, NextSiblingVar Accessible) {
644
645	XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer())
646
647}
648
649// Updates the next accessible sibling.
650//
651// That might be useful when a new child of a custom accessible
652// is created, and it needs to be linked to a previous child.
653func (x *FileChooserWidget) UpdateNextAccessibleSibling(NewSiblingVar Accessible) {
654
655	XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer())
656
657}
658
659// Informs ATs that the platform state has changed.
660//
661// This function should be used by `GtkAccessible` implementations that
662// have a platform state but are not widgets. Widgets handle platform
663// states automatically.
664func (x *FileChooserWidget) UpdatePlatformState(StateVar AccessiblePlatformState) {
665
666	XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar)
667
668}
669
670// Updates a list of accessible properties.
671//
672// See the [enum@Gtk.AccessibleProperty] documentation for the
673// value types of accessible properties.
674//
675// This function should be called by `GtkWidget` types whenever
676// an accessible property change must be communicated to assistive
677// technologies.
678//
679// Example:
680// ```c
681// value = gtk_adjustment_get_value (adjustment);
682// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
683//
684//	GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
685//	-1);
686//
687// ```
688func (x *FileChooserWidget) UpdateProperty(FirstPropertyVar AccessibleProperty, varArgs ...interface{}) {
689
690	XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...)
691
692}
693
694// Updates an array of accessible properties.
695//
696// This function should be called by `GtkWidget` types whenever an accessible
697// property change must be communicated to assistive technologies.
698//
699// This function is meant to be used by language bindings.
700func (x *FileChooserWidget) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []AccessibleProperty, ValuesVar []gobject.Value) {
701
702	XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar)
703
704}
705
706// Updates a list of accessible relations.
707//
708// This function should be called by `GtkWidget` types whenever an accessible
709// relation change must be communicated to assistive technologies.
710//
711// If the [enum@Gtk.AccessibleRelation] requires a list of references,
712// you should pass each reference individually, followed by `NULL`, e.g.
713//
714// ```c
715// gtk_accessible_update_relation (accessible,
716//
717//	GTK_ACCESSIBLE_RELATION_CONTROLS,
718//	  ref1, NULL,
719//	GTK_ACCESSIBLE_RELATION_LABELLED_BY,
720//	  ref1, ref2, ref3, NULL,
721//	-1);
722//
723// ```
724func (x *FileChooserWidget) UpdateRelation(FirstRelationVar AccessibleRelation, varArgs ...interface{}) {
725
726	XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...)
727
728}
729
730// Updates an array of accessible relations.
731//
732// This function should be called by `GtkWidget` types whenever an accessible
733// relation change must be communicated to assistive technologies.
734//
735// This function is meant to be used by language bindings.
736func (x *FileChooserWidget) UpdateRelationValue(NRelationsVar int, RelationsVar []AccessibleRelation, ValuesVar []gobject.Value) {
737
738	XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar)
739
740}
741
742// Updates a list of accessible states.
743//
744// See the [enum@Gtk.AccessibleState] documentation for the
745// value types of accessible states.
746//
747// This function should be called by `GtkWidget` types whenever
748// an accessible state change must be communicated to assistive
749// technologies.
750//
751// Example:
752//
753// ```c
754// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
755// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
756//
757//	GTK_ACCESSIBLE_STATE_CHECKED, value,
758//	-1);
759//
760// ```
761func (x *FileChooserWidget) UpdateState(FirstStateVar AccessibleState, varArgs ...interface{}) {
762
763	XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...)
764
765}
766
767// Updates an array of accessible states.
768//
769// This function should be called by `GtkWidget` types whenever an accessible
770// state change must be communicated to assistive technologies.
771//
772// This function is meant to be used by language bindings.
773func (x *FileChooserWidget) UpdateStateValue(NStatesVar int, StatesVar []AccessibleState, ValuesVar []gobject.Value) {
774
775	XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar)
776
777}
778
779// Gets the ID of the @buildable object.
780//
781// `GtkBuilder` sets the name based on the ID attribute
782// of the `<object>` tag used to construct the @buildable.
783func (x *FileChooserWidget) GetBuildableId() string {
784
785	cret := XGtkBuildableGetBuildableId(x.GoPointer())
786	return cret
787}
788
789// Adds a 'choice' to the file chooser.
790//
791// This is typically implemented as a combobox or, for boolean choices,
792// as a checkbutton. You can select a value using
793// [method@Gtk.FileChooser.set_choice] before the dialog is shown,
794// and you can obtain the user-selected value in the
795// [signal@Gtk.Dialog::response] signal handler using
796// [method@Gtk.FileChooser.get_choice].
797func (x *FileChooserWidget) AddChoice(IdVar string, LabelVar string, OptionsVar []string, OptionLabelsVar []string) {
798
799	XGtkFileChooserAddChoice(x.GoPointer(), IdVar, LabelVar, OptionsVar, OptionLabelsVar)
800
801}
802
803// Adds @filter to the list of filters that the user can select between.
804//
805// When a filter is selected, only files that are passed by that
806// filter are displayed.
807//
808// Note that the @chooser takes ownership of the filter if it is floating,
809// so you have to ref and sink it if you want to keep a reference.
810func (x *FileChooserWidget) AddFilter(FilterVar *FileFilter) {
811
812	XGtkFileChooserAddFilter(x.GoPointer(), FilterVar.GoPointer())
813
814}
815
816// Adds a folder to be displayed with the shortcut folders
817// in a file chooser.
818func (x *FileChooserWidget) AddShortcutFolder(FolderVar gio.File) (bool, error) {
819	var cerr *glib.Error
820
821	cret := XGtkFileChooserAddShortcutFolder(x.GoPointer(), FolderVar.GoPointer(), &cerr)
822	if cerr == nil {
823		return cret, nil
824	}
825	return cret, cerr
826
827}
828
829// Gets the type of operation that the file chooser is performing.
830func (x *FileChooserWidget) GetAction() FileChooserAction {
831
832	cret := XGtkFileChooserGetAction(x.GoPointer())
833	return cret
834}
835
836// Gets the currently selected option in the 'choice' with the given ID.
837func (x *FileChooserWidget) GetChoice(IdVar string) string {
838
839	cret := XGtkFileChooserGetChoice(x.GoPointer(), IdVar)
840	return cret
841}
842
843// Gets whether file chooser will offer to create new folders.
844func (x *FileChooserWidget) GetCreateFolders() bool {
845
846	cret := XGtkFileChooserGetCreateFolders(x.GoPointer())
847	return cret
848}
849
850// Gets the current folder of @chooser as `GFile`.
851func (x *FileChooserWidget) GetCurrentFolder() *gio.FileBase {
852	var cls *gio.FileBase
853
854	cret := XGtkFileChooserGetCurrentFolder(x.GoPointer())
855
856	if cret == 0 {
857		return nil
858	}
859	cls = &gio.FileBase{}
860	cls.Ptr = cret
861	return cls
862}
863
864// Gets the current name in the file selector, as entered by the user.
865//
866// This is meant to be used in save dialogs, to get the currently typed
867// filename when the file itself does not exist yet.
868func (x *FileChooserWidget) GetCurrentName() string {
869
870	cret := XGtkFileChooserGetCurrentName(x.GoPointer())
871	return cret
872}
873
874// Gets the `GFile` for the currently selected file in
875// the file selector.
876//
877// If multiple files are selected, one of the files will be
878// returned at random.
879//
880// If the file chooser is in folder mode, this function returns
881// the selected folder.
882func (x *FileChooserWidget) GetFile() *gio.FileBase {
883	var cls *gio.FileBase
884
885	cret := XGtkFileChooserGetFile(x.GoPointer())
886
887	if cret == 0 {
888		return nil
889	}
890	cls = &gio.FileBase{}
891	cls.Ptr = cret
892	return cls
893}
894
895// Lists all the selected files and subfolders in the current folder
896// of @chooser as `GFile`.
897func (x *FileChooserWidget) GetFiles() *gio.ListModelBase {
898	var cls *gio.ListModelBase
899
900	cret := XGtkFileChooserGetFiles(x.GoPointer())
901
902	if cret == 0 {
903		return nil
904	}
905	cls = &gio.ListModelBase{}
906	cls.Ptr = cret
907	return cls
908}
909
910// Gets the current filter.
911func (x *FileChooserWidget) GetFilter() *FileFilter {
912	var cls *FileFilter
913
914	cret := XGtkFileChooserGetFilter(x.GoPointer())
915
916	if cret == 0 {
917		return nil
918	}
919	gobject.IncreaseRef(cret)
920	cls = &FileFilter{}
921	cls.Ptr = cret
922	return cls
923}
924
925// Gets the current set of user-selectable filters, as a list model.
926//
927// See [method@Gtk.FileChooser.add_filter] and
928// [method@Gtk.FileChooser.remove_filter] for changing individual filters.
929//
930// You should not modify the returned list model. Future changes to
931// @chooser may or may not affect the returned model.
932func (x *FileChooserWidget) GetFilters() *gio.ListModelBase {
933	var cls *gio.ListModelBase
934
935	cret := XGtkFileChooserGetFilters(x.GoPointer())
936
937	if cret == 0 {
938		return nil
939	}
940	cls = &gio.ListModelBase{}
941	cls.Ptr = cret
942	return cls
943}
944
945// Gets whether multiple files can be selected in the file
946// chooser.
947func (x *FileChooserWidget) GetSelectMultiple() bool {
948
949	cret := XGtkFileChooserGetSelectMultiple(x.GoPointer())
950	return cret
951}
952
953// Queries the list of shortcut folders in the file chooser.
954//
955// You should not modify the returned list model. Future changes to
956// @chooser may or may not affect the returned model.
957func (x *FileChooserWidget) GetShortcutFolders() *gio.ListModelBase {
958	var cls *gio.ListModelBase
959
960	cret := XGtkFileChooserGetShortcutFolders(x.GoPointer())
961
962	if cret == 0 {
963		return nil
964	}
965	cls = &gio.ListModelBase{}
966	cls.Ptr = cret
967	return cls
968}
969
970// Removes a 'choice' that has been added with gtk_file_chooser_add_choice().
971func (x *FileChooserWidget) RemoveChoice(IdVar string) {
972
973	XGtkFileChooserRemoveChoice(x.GoPointer(), IdVar)
974
975}
976
977// Removes @filter from the list of filters that the user can select between.
978func (x *FileChooserWidget) RemoveFilter(FilterVar *FileFilter) {
979
980	XGtkFileChooserRemoveFilter(x.GoPointer(), FilterVar.GoPointer())
981
982}
983
984// Removes a folder from the shortcut folders in a file chooser.
985func (x *FileChooserWidget) RemoveShortcutFolder(FolderVar gio.File) (bool, error) {
986	var cerr *glib.Error
987
988	cret := XGtkFileChooserRemoveShortcutFolder(x.GoPointer(), FolderVar.GoPointer(), &cerr)
989	if cerr == nil {
990		return cret, nil
991	}
992	return cret, cerr
993
994}
995
996// Sets the type of operation that the chooser is performing.
997//
998// The user interface is adapted to suit the selected action.
999//
1000// For example, an option to create a new folder might be shown
1001// if the action is %GTK_FILE_CHOOSER_ACTION_SAVE but not if the
1002// action is %GTK_FILE_CHOOSER_ACTION_OPEN.
1003func (x *FileChooserWidget) SetAction(ActionVar FileChooserAction) {
1004
1005	XGtkFileChooserSetAction(x.GoPointer(), ActionVar)
1006
1007}
1008
1009// Selects an option in a 'choice' that has been added with
1010// gtk_file_chooser_add_choice().
1011//
1012// For a boolean choice, the possible options are "true" and "false".
1013func (x *FileChooserWidget) SetChoice(IdVar string, OptionVar string) {
1014
1015	XGtkFileChooserSetChoice(x.GoPointer(), IdVar, OptionVar)
1016
1017}
1018
1019// Sets whether file chooser will offer to create new folders.
1020//
1021// This is only relevant if the action is not set to be
1022// %GTK_FILE_CHOOSER_ACTION_OPEN.
1023func (x *FileChooserWidget) SetCreateFolders(CreateFoldersVar bool) {
1024
1025	XGtkFileChooserSetCreateFolders(x.GoPointer(), CreateFoldersVar)
1026
1027}
1028
1029// Sets the current folder for @chooser from a `GFile`.
1030func (x *FileChooserWidget) SetCurrentFolder(FileVar gio.File) (bool, error) {
1031	var cerr *glib.Error
1032
1033	cret := XGtkFileChooserSetCurrentFolder(x.GoPointer(), FileVar.GoPointer(), &cerr)
1034	if cerr == nil {
1035		return cret, nil
1036	}
1037	return cret, cerr
1038
1039}
1040
1041// Sets the current name in the file selector, as if entered
1042// by the user.
1043//
1044// Note that the name passed in here is a UTF-8 string rather
1045// than a filename. This function is meant for such uses as a
1046// suggested name in a “Save As...” dialog.  You can pass
1047// “Untitled.doc” or a similarly suitable suggestion for the @name.
1048//
1049// If you want to preselect a particular existing file, you should
1050// use [method@Gtk.FileChooser.set_file] instead.
1051//
1052// Please see the documentation for those functions for an example
1053// of using [method@Gtk.FileChooser.set_current_name] as well.
1054func (x *FileChooserWidget) SetCurrentName(NameVar string) {
1055
1056	XGtkFileChooserSetCurrentName(x.GoPointer(), NameVar)
1057
1058}
1059
1060// Sets @file as the current filename for the file chooser.
1061//
1062// This includes changing to the file’s parent folder and actually selecting
1063// the file in list. If the @chooser is in %GTK_FILE_CHOOSER_ACTION_SAVE mode,
1064// the file’s base name will also appear in the dialog’s file name entry.
1065//
1066// If the file name isn’t in the current folder of @chooser, then the current
1067// folder of @chooser will be changed to the folder containing @file.
1068//
1069// Note that the file must exist, or nothing will be done except
1070// for the directory change.
1071//
1072// If you are implementing a save dialog, you should use this function if
1073// you already have a file name to which the user may save; for example,
1074// when the user opens an existing file and then does “Save As…”. If you
1075// don’t have a file name already — for example, if the user just created
1076// a new file and is saving it for the first time, do not call this function.
1077//
1078// Instead, use something similar to this:
1079//
1080// ```c
1081// static void
1082// prepare_file_chooser (GtkFileChooser *chooser,
1083//
1084//	GFile          *existing_file)
1085//
1086//	{
1087//	  gboolean document_is_new = (existing_file == NULL);
1088//
1089//	  if (document_is_new)
1090//	    {
1091//	      GFile *default_file_for_saving = g_file_new_for_path ("./out.txt");
1092//	      // the user just created a new document
1093//	      gtk_file_chooser_set_current_folder (chooser, default_file_for_saving, NULL);
1094//	      gtk_file_chooser_set_current_name (chooser, "Untitled document");
1095//	      g_object_unref (default_file_for_saving);
1096//	    }
1097//	  else
1098//	    {
1099//	      // the user edited an existing document
1100//	      gtk_file_chooser_set_file (chooser, existing_file, NULL);
1101//	    }
1102//	}
1103//
1104// ```
1105func (x *FileChooserWidget) SetFile(FileVar gio.File) (bool, error) {
1106	var cerr *glib.Error
1107
1108	cret := XGtkFileChooserSetFile(x.GoPointer(), FileVar.GoPointer(), &cerr)
1109	if cerr == nil {
1110		return cret, nil
1111	}
1112	return cret, cerr
1113
1114}
1115
1116// Sets the current filter.
1117//
1118// Only the files that pass the filter will be displayed.
1119// If the user-selectable list of filters is non-empty, then
1120// the filter should be one of the filters in that list.
1121//
1122// Setting the current filter when the list of filters is
1123// empty is useful if you want to restrict the displayed
1124// set of files without letting the user change it.
1125func (x *FileChooserWidget) SetFilter(FilterVar *FileFilter) {
1126
1127	XGtkFileChooserSetFilter(x.GoPointer(), FilterVar.GoPointer())
1128
1129}
1130
1131// Sets whether multiple files can be selected in the file chooser.
1132//
1133// This is only relevant if the action is set to be
1134// %GTK_FILE_CHOOSER_ACTION_OPEN or
1135// %GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER.
1136func (x *FileChooserWidget) SetSelectMultiple(SelectMultipleVar bool) {
1137
1138	XGtkFileChooserSetSelectMultiple(x.GoPointer(), SelectMultipleVar)
1139
1140}
1141
1142func init() {
1143	core.SetPackageName("GTK", "gtk4")
1144	core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
1145	var libs []uintptr
1146	for _, libPath := range core.GetPaths("GTK") {
1147		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
1148		if err != nil {
1149			panic(err)
1150		}
1151		libs = append(libs, lib)
1152	}
1153
1154	core.PuregoSafeRegister(&xFileChooserWidgetGLibType, libs, "gtk_file_chooser_widget_get_type")
1155
1156	core.PuregoSafeRegister(&xNewFileChooserWidget, libs, "gtk_file_chooser_widget_new")
1157
1158}

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