v0.2.1 c0399be

gvolume.go RawHistoryFolder

1// Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gio
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/glib"
12	"github.com/bnema/puregotk/v4/gobject/types"
13)
14
15// Interface for implementing operations for mountable volumes.
16type VolumeIface struct {
17	_ structs.HostLayout
18
19	GIface uintptr
20
21	xChanged uintptr
22
23	xRemoved uintptr
24
25	xGetName uintptr
26
27	xGetIcon uintptr
28
29	xGetUuid uintptr
30
31	xGetDrive uintptr
32
33	xGetMount uintptr
34
35	xCanMount uintptr
36
37	xCanEject uintptr
38
39	xMountFn uintptr
40
41	xMountFinish uintptr
42
43	xEject uintptr
44
45	xEjectFinish uintptr
46
47	xGetIdentifier uintptr
48
49	xEnumerateIdentifiers uintptr
50
51	xShouldAutomount uintptr
52
53	xGetActivationRoot uintptr
54
55	xEjectWithOperation uintptr
56
57	xEjectWithOperationFinish uintptr
58
59	xGetSortKey uintptr
60
61	xGetSymbolicIcon uintptr
62}
63
64func (x *VolumeIface) GoPointer() uintptr {
65	return uintptr(unsafe.Pointer(x))
66}
67
68// OverrideChanged sets the "changed" callback function.
69// Changed signal that is emitted when the volume's state has changed.
70func (x *VolumeIface) OverrideChanged(cb func(Volume)) {
71	if cb == nil {
72		x.xChanged = 0
73	} else {
74		x.xChanged = purego.NewCallback(func(VolumeVarp uintptr) {
75			cb(&VolumeBase{Ptr: VolumeVarp})
76		})
77	}
78}
79
80// GetChanged gets the "changed" callback function.
81// Changed signal that is emitted when the volume's state has changed.
82func (x *VolumeIface) GetChanged() func(Volume) {
83	if x.xChanged == 0 {
84		return nil
85	}
86	var rawCallback func(VolumeVarp uintptr)
87	purego.RegisterFunc(&rawCallback, x.xChanged)
88	return func(VolumeVar Volume) {
89		rawCallback(VolumeVar.GoPointer())
90	}
91}
92
93// OverrideRemoved sets the "removed" callback function.
94// The removed signal that is emitted when the #GVolume have been removed. If the recipient is holding references to the object they should release them so the object can be finalized.
95func (x *VolumeIface) OverrideRemoved(cb func(Volume)) {
96	if cb == nil {
97		x.xRemoved = 0
98	} else {
99		x.xRemoved = purego.NewCallback(func(VolumeVarp uintptr) {
100			cb(&VolumeBase{Ptr: VolumeVarp})
101		})
102	}
103}
104
105// GetRemoved gets the "removed" callback function.
106// The removed signal that is emitted when the #GVolume have been removed. If the recipient is holding references to the object they should release them so the object can be finalized.
107func (x *VolumeIface) GetRemoved() func(Volume) {
108	if x.xRemoved == 0 {
109		return nil
110	}
111	var rawCallback func(VolumeVarp uintptr)
112	purego.RegisterFunc(&rawCallback, x.xRemoved)
113	return func(VolumeVar Volume) {
114		rawCallback(VolumeVar.GoPointer())
115	}
116}
117
118// OverrideGetName sets the "get_name" callback function.
119// Gets a string containing the name of the #GVolume.
120func (x *VolumeIface) OverrideGetName(cb func(Volume) string) {
121	if cb == nil {
122		x.xGetName = 0
123	} else {
124		x.xGetName = purego.NewCallback(func(VolumeVarp uintptr) string {
125			return cb(&VolumeBase{Ptr: VolumeVarp})
126		})
127	}
128}
129
130// GetGetName gets the "get_name" callback function.
131// Gets a string containing the name of the #GVolume.
132func (x *VolumeIface) GetGetName() func(Volume) string {
133	if x.xGetName == 0 {
134		return nil
135	}
136	var rawCallback func(VolumeVarp uintptr) string
137	purego.RegisterFunc(&rawCallback, x.xGetName)
138	return func(VolumeVar Volume) string {
139		return rawCallback(VolumeVar.GoPointer())
140	}
141}
142
143// OverrideGetIcon sets the "get_icon" callback function.
144// Gets a #GIcon for the #GVolume.
145func (x *VolumeIface) OverrideGetIcon(cb func(Volume) *IconBase) {
146	if cb == nil {
147		x.xGetIcon = 0
148	} else {
149		x.xGetIcon = purego.NewCallback(func(VolumeVarp uintptr) uintptr {
150			ret := cb(&VolumeBase{Ptr: VolumeVarp})
151			if ret == nil {
152				return 0
153			}
154			return ret.GoPointer()
155		})
156	}
157}
158
159// GetGetIcon gets the "get_icon" callback function.
160// Gets a #GIcon for the #GVolume.
161func (x *VolumeIface) GetGetIcon() func(Volume) *IconBase {
162	if x.xGetIcon == 0 {
163		return nil
164	}
165	var rawCallback func(VolumeVarp uintptr) uintptr
166	purego.RegisterFunc(&rawCallback, x.xGetIcon)
167	return func(VolumeVar Volume) *IconBase {
168		rawRet := rawCallback(VolumeVar.GoPointer())
169		if rawRet == 0 {
170			return nil
171		}
172		ret := &IconBase{}
173		ret.Ptr = rawRet
174		return ret
175	}
176}
177
178// OverrideGetUuid sets the "get_uuid" callback function.
179// Gets the UUID for the #GVolume. The reference is typically based on the file system UUID for the mount in question and should be considered an opaque string. Returns %NULL if there is no UUID available.
180func (x *VolumeIface) OverrideGetUuid(cb func(Volume) string) {
181	if cb == nil {
182		x.xGetUuid = 0
183	} else {
184		x.xGetUuid = purego.NewCallback(func(VolumeVarp uintptr) string {
185			return cb(&VolumeBase{Ptr: VolumeVarp})
186		})
187	}
188}
189
190// GetGetUuid gets the "get_uuid" callback function.
191// Gets the UUID for the #GVolume. The reference is typically based on the file system UUID for the mount in question and should be considered an opaque string. Returns %NULL if there is no UUID available.
192func (x *VolumeIface) GetGetUuid() func(Volume) string {
193	if x.xGetUuid == 0 {
194		return nil
195	}
196	var rawCallback func(VolumeVarp uintptr) string
197	purego.RegisterFunc(&rawCallback, x.xGetUuid)
198	return func(VolumeVar Volume) string {
199		return rawCallback(VolumeVar.GoPointer())
200	}
201}
202
203// OverrideGetDrive sets the "get_drive" callback function.
204// Gets a #GDrive the volume is located on. Returns %NULL if the #GVolume is not associated with a #GDrive.
205func (x *VolumeIface) OverrideGetDrive(cb func(Volume) *DriveBase) {
206	if cb == nil {
207		x.xGetDrive = 0
208	} else {
209		x.xGetDrive = purego.NewCallback(func(VolumeVarp uintptr) uintptr {
210			ret := cb(&VolumeBase{Ptr: VolumeVarp})
211			if ret == nil {
212				return 0
213			}
214			return ret.GoPointer()
215		})
216	}
217}
218
219// GetGetDrive gets the "get_drive" callback function.
220// Gets a #GDrive the volume is located on. Returns %NULL if the #GVolume is not associated with a #GDrive.
221func (x *VolumeIface) GetGetDrive() func(Volume) *DriveBase {
222	if x.xGetDrive == 0 {
223		return nil
224	}
225	var rawCallback func(VolumeVarp uintptr) uintptr
226	purego.RegisterFunc(&rawCallback, x.xGetDrive)
227	return func(VolumeVar Volume) *DriveBase {
228		rawRet := rawCallback(VolumeVar.GoPointer())
229		if rawRet == 0 {
230			return nil
231		}
232		ret := &DriveBase{}
233		ret.Ptr = rawRet
234		return ret
235	}
236}
237
238// OverrideGetMount sets the "get_mount" callback function.
239// Gets a #GMount representing the mounted volume. Returns %NULL if the #GVolume is not mounted.
240func (x *VolumeIface) OverrideGetMount(cb func(Volume) *MountBase) {
241	if cb == nil {
242		x.xGetMount = 0
243	} else {
244		x.xGetMount = purego.NewCallback(func(VolumeVarp uintptr) uintptr {
245			ret := cb(&VolumeBase{Ptr: VolumeVarp})
246			if ret == nil {
247				return 0
248			}
249			return ret.GoPointer()
250		})
251	}
252}
253
254// GetGetMount gets the "get_mount" callback function.
255// Gets a #GMount representing the mounted volume. Returns %NULL if the #GVolume is not mounted.
256func (x *VolumeIface) GetGetMount() func(Volume) *MountBase {
257	if x.xGetMount == 0 {
258		return nil
259	}
260	var rawCallback func(VolumeVarp uintptr) uintptr
261	purego.RegisterFunc(&rawCallback, x.xGetMount)
262	return func(VolumeVar Volume) *MountBase {
263		rawRet := rawCallback(VolumeVar.GoPointer())
264		if rawRet == 0 {
265			return nil
266		}
267		ret := &MountBase{}
268		ret.Ptr = rawRet
269		return ret
270	}
271}
272
273// OverrideCanMount sets the "can_mount" callback function.
274// Returns %TRUE if the #GVolume can be mounted.
275func (x *VolumeIface) OverrideCanMount(cb func(Volume) bool) {
276	if cb == nil {
277		x.xCanMount = 0
278	} else {
279		x.xCanMount = purego.NewCallback(func(VolumeVarp uintptr) bool {
280			return cb(&VolumeBase{Ptr: VolumeVarp})
281		})
282	}
283}
284
285// GetCanMount gets the "can_mount" callback function.
286// Returns %TRUE if the #GVolume can be mounted.
287func (x *VolumeIface) GetCanMount() func(Volume) bool {
288	if x.xCanMount == 0 {
289		return nil
290	}
291	var rawCallback func(VolumeVarp uintptr) bool
292	purego.RegisterFunc(&rawCallback, x.xCanMount)
293	return func(VolumeVar Volume) bool {
294		return rawCallback(VolumeVar.GoPointer())
295	}
296}
297
298// OverrideCanEject sets the "can_eject" callback function.
299// Checks if a #GVolume can be ejected.
300func (x *VolumeIface) OverrideCanEject(cb func(Volume) bool) {
301	if cb == nil {
302		x.xCanEject = 0
303	} else {
304		x.xCanEject = purego.NewCallback(func(VolumeVarp uintptr) bool {
305			return cb(&VolumeBase{Ptr: VolumeVarp})
306		})
307	}
308}
309
310// GetCanEject gets the "can_eject" callback function.
311// Checks if a #GVolume can be ejected.
312func (x *VolumeIface) GetCanEject() func(Volume) bool {
313	if x.xCanEject == 0 {
314		return nil
315	}
316	var rawCallback func(VolumeVarp uintptr) bool
317	purego.RegisterFunc(&rawCallback, x.xCanEject)
318	return func(VolumeVar Volume) bool {
319		return rawCallback(VolumeVar.GoPointer())
320	}
321}
322
323// OverrideMountFn sets the "mount_fn" callback function.
324// Mounts a given #GVolume.
325//
326//	#GVolume implementations must emit the #GMountOperation::aborted
327//	signal before completing a mount operation that is aborted while
328//	awaiting input from the user through a #GMountOperation instance.
329func (x *VolumeIface) OverrideMountFn(cb func(Volume, MountMountFlags, *MountOperation, *Cancellable, *AsyncReadyCallback, uintptr)) {
330	if cb == nil {
331		x.xMountFn = 0
332	} else {
333		x.xMountFn = purego.NewCallback(func(VolumeVarp uintptr, FlagsVarp MountMountFlags, MountOperationVarp uintptr, CancellableVarp uintptr, CallbackVarp uintptr, UserDataVarp uintptr) {
334			cb(&VolumeBase{Ptr: VolumeVarp}, FlagsVarp, MountOperationNewFromInternalPtr(MountOperationVarp), CancellableNewFromInternalPtr(CancellableVarp), (*AsyncReadyCallback)(unsafe.Pointer(CallbackVarp)), UserDataVarp)
335		})
336	}
337}
338
339// GetMountFn gets the "mount_fn" callback function.
340// Mounts a given #GVolume.
341//
342//	#GVolume implementations must emit the #GMountOperation::aborted
343//	signal before completing a mount operation that is aborted while
344//	awaiting input from the user through a #GMountOperation instance.
345func (x *VolumeIface) GetMountFn() func(Volume, MountMountFlags, *MountOperation, *Cancellable, *AsyncReadyCallback, uintptr) {
346	if x.xMountFn == 0 {
347		return nil
348	}
349	var rawCallback func(VolumeVarp uintptr, FlagsVarp MountMountFlags, MountOperationVarp uintptr, CancellableVarp uintptr, CallbackVarp uintptr, UserDataVarp uintptr)
350	purego.RegisterFunc(&rawCallback, x.xMountFn)
351	return func(VolumeVar Volume, FlagsVar MountMountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
352		rawCallback(VolumeVar.GoPointer(), FlagsVar, MountOperationVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar)
353	}
354}
355
356// OverrideMountFinish sets the "mount_finish" callback function.
357// Finishes a mount operation.
358func (x *VolumeIface) OverrideMountFinish(cb func(Volume, AsyncResult) bool) {
359	if cb == nil {
360		x.xMountFinish = 0
361	} else {
362		x.xMountFinish = purego.NewCallback(func(VolumeVarp uintptr, ResultVarp uintptr) bool {
363			return cb(&VolumeBase{Ptr: VolumeVarp}, &AsyncResultBase{Ptr: ResultVarp})
364		})
365	}
366}
367
368// GetMountFinish gets the "mount_finish" callback function.
369// Finishes a mount operation.
370func (x *VolumeIface) GetMountFinish() func(Volume, AsyncResult) bool {
371	if x.xMountFinish == 0 {
372		return nil
373	}
374	var rawCallback func(VolumeVarp uintptr, ResultVarp uintptr) bool
375	purego.RegisterFunc(&rawCallback, x.xMountFinish)
376	return func(VolumeVar Volume, ResultVar AsyncResult) bool {
377		return rawCallback(VolumeVar.GoPointer(), ResultVar.GoPointer())
378	}
379}
380
381// OverrideEject sets the "eject" callback function.
382// Ejects a given #GVolume.
383func (x *VolumeIface) OverrideEject(cb func(Volume, MountUnmountFlags, *Cancellable, *AsyncReadyCallback, uintptr)) {
384	if cb == nil {
385		x.xEject = 0
386	} else {
387		x.xEject = purego.NewCallback(func(VolumeVarp uintptr, FlagsVarp MountUnmountFlags, CancellableVarp uintptr, CallbackVarp uintptr, UserDataVarp uintptr) {
388			cb(&VolumeBase{Ptr: VolumeVarp}, FlagsVarp, CancellableNewFromInternalPtr(CancellableVarp), (*AsyncReadyCallback)(unsafe.Pointer(CallbackVarp)), UserDataVarp)
389		})
390	}
391}
392
393// GetEject gets the "eject" callback function.
394// Ejects a given #GVolume.
395func (x *VolumeIface) GetEject() func(Volume, MountUnmountFlags, *Cancellable, *AsyncReadyCallback, uintptr) {
396	if x.xEject == 0 {
397		return nil
398	}
399	var rawCallback func(VolumeVarp uintptr, FlagsVarp MountUnmountFlags, CancellableVarp uintptr, CallbackVarp uintptr, UserDataVarp uintptr)
400	purego.RegisterFunc(&rawCallback, x.xEject)
401	return func(VolumeVar Volume, FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
402		rawCallback(VolumeVar.GoPointer(), FlagsVar, CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar)
403	}
404}
405
406// OverrideEjectFinish sets the "eject_finish" callback function.
407// Finishes an eject operation.
408func (x *VolumeIface) OverrideEjectFinish(cb func(Volume, AsyncResult) bool) {
409	if cb == nil {
410		x.xEjectFinish = 0
411	} else {
412		x.xEjectFinish = purego.NewCallback(func(VolumeVarp uintptr, ResultVarp uintptr) bool {
413			return cb(&VolumeBase{Ptr: VolumeVarp}, &AsyncResultBase{Ptr: ResultVarp})
414		})
415	}
416}
417
418// GetEjectFinish gets the "eject_finish" callback function.
419// Finishes an eject operation.
420func (x *VolumeIface) GetEjectFinish() func(Volume, AsyncResult) bool {
421	if x.xEjectFinish == 0 {
422		return nil
423	}
424	var rawCallback func(VolumeVarp uintptr, ResultVarp uintptr) bool
425	purego.RegisterFunc(&rawCallback, x.xEjectFinish)
426	return func(VolumeVar Volume, ResultVar AsyncResult) bool {
427		return rawCallback(VolumeVar.GoPointer(), ResultVar.GoPointer())
428	}
429}
430
431// OverrideGetIdentifier sets the "get_identifier" callback function.
432// Returns the [identifier](#volume-identifiers) of the given kind, or %NULL if
433//
434//	the #GVolume doesn't have one.
435func (x *VolumeIface) OverrideGetIdentifier(cb func(Volume, string) string) {
436	if cb == nil {
437		x.xGetIdentifier = 0
438	} else {
439		x.xGetIdentifier = purego.NewCallback(func(VolumeVarp uintptr, KindVarp string) string {
440			return cb(&VolumeBase{Ptr: VolumeVarp}, KindVarp)
441		})
442	}
443}
444
445// GetGetIdentifier gets the "get_identifier" callback function.
446// Returns the [identifier](#volume-identifiers) of the given kind, or %NULL if
447//
448//	the #GVolume doesn't have one.
449func (x *VolumeIface) GetGetIdentifier() func(Volume, string) string {
450	if x.xGetIdentifier == 0 {
451		return nil
452	}
453	var rawCallback func(VolumeVarp uintptr, KindVarp string) string
454	purego.RegisterFunc(&rawCallback, x.xGetIdentifier)
455	return func(VolumeVar Volume, KindVar string) string {
456		return rawCallback(VolumeVar.GoPointer(), KindVar)
457	}
458}
459
460// OverrideEnumerateIdentifiers sets the "enumerate_identifiers" callback function.
461// Returns an array strings listing the kinds
462//
463//	of [identifiers](#volume-identifiers) which the #GVolume has.
464func (x *VolumeIface) OverrideEnumerateIdentifiers(cb func(Volume) []string) {
465	if cb == nil {
466		x.xEnumerateIdentifiers = 0
467	} else {
468		x.xEnumerateIdentifiers = purego.NewCallback(func(VolumeVarp uintptr) []string {
469			return cb(&VolumeBase{Ptr: VolumeVarp})
470		})
471	}
472}
473
474// GetEnumerateIdentifiers gets the "enumerate_identifiers" callback function.
475// Returns an array strings listing the kinds
476//
477//	of [identifiers](#volume-identifiers) which the #GVolume has.
478func (x *VolumeIface) GetEnumerateIdentifiers() func(Volume) []string {
479	if x.xEnumerateIdentifiers == 0 {
480		return nil
481	}
482	var rawCallback func(VolumeVarp uintptr) []string
483	purego.RegisterFunc(&rawCallback, x.xEnumerateIdentifiers)
484	return func(VolumeVar Volume) []string {
485		return rawCallback(VolumeVar.GoPointer())
486	}
487}
488
489// OverrideShouldAutomount sets the "should_automount" callback function.
490// Returns %TRUE if the #GVolume should be automatically mounted.
491func (x *VolumeIface) OverrideShouldAutomount(cb func(Volume) bool) {
492	if cb == nil {
493		x.xShouldAutomount = 0
494	} else {
495		x.xShouldAutomount = purego.NewCallback(func(VolumeVarp uintptr) bool {
496			return cb(&VolumeBase{Ptr: VolumeVarp})
497		})
498	}
499}
500
501// GetShouldAutomount gets the "should_automount" callback function.
502// Returns %TRUE if the #GVolume should be automatically mounted.
503func (x *VolumeIface) GetShouldAutomount() func(Volume) bool {
504	if x.xShouldAutomount == 0 {
505		return nil
506	}
507	var rawCallback func(VolumeVarp uintptr) bool
508	purego.RegisterFunc(&rawCallback, x.xShouldAutomount)
509	return func(VolumeVar Volume) bool {
510		return rawCallback(VolumeVar.GoPointer())
511	}
512}
513
514// OverrideGetActivationRoot sets the "get_activation_root" callback function.
515// Returns the activation root for the #GVolume if it is known in advance or %NULL if
516//
517//	it is not known.
518func (x *VolumeIface) OverrideGetActivationRoot(cb func(Volume) *FileBase) {
519	if cb == nil {
520		x.xGetActivationRoot = 0
521	} else {
522		x.xGetActivationRoot = purego.NewCallback(func(VolumeVarp uintptr) uintptr {
523			ret := cb(&VolumeBase{Ptr: VolumeVarp})
524			if ret == nil {
525				return 0
526			}
527			return ret.GoPointer()
528		})
529	}
530}
531
532// GetGetActivationRoot gets the "get_activation_root" callback function.
533// Returns the activation root for the #GVolume if it is known in advance or %NULL if
534//
535//	it is not known.
536func (x *VolumeIface) GetGetActivationRoot() func(Volume) *FileBase {
537	if x.xGetActivationRoot == 0 {
538		return nil
539	}
540	var rawCallback func(VolumeVarp uintptr) uintptr
541	purego.RegisterFunc(&rawCallback, x.xGetActivationRoot)
542	return func(VolumeVar Volume) *FileBase {
543		rawRet := rawCallback(VolumeVar.GoPointer())
544		if rawRet == 0 {
545			return nil
546		}
547		ret := &FileBase{}
548		ret.Ptr = rawRet
549		return ret
550	}
551}
552
553// OverrideEjectWithOperation sets the "eject_with_operation" callback function.
554// Starts ejecting a #GVolume using a #GMountOperation. Since 2.22.
555func (x *VolumeIface) OverrideEjectWithOperation(cb func(Volume, MountUnmountFlags, *MountOperation, *Cancellable, *AsyncReadyCallback, uintptr)) {
556	if cb == nil {
557		x.xEjectWithOperation = 0
558	} else {
559		x.xEjectWithOperation = purego.NewCallback(func(VolumeVarp uintptr, FlagsVarp MountUnmountFlags, MountOperationVarp uintptr, CancellableVarp uintptr, CallbackVarp uintptr, UserDataVarp uintptr) {
560			cb(&VolumeBase{Ptr: VolumeVarp}, FlagsVarp, MountOperationNewFromInternalPtr(MountOperationVarp), CancellableNewFromInternalPtr(CancellableVarp), (*AsyncReadyCallback)(unsafe.Pointer(CallbackVarp)), UserDataVarp)
561		})
562	}
563}
564
565// GetEjectWithOperation gets the "eject_with_operation" callback function.
566// Starts ejecting a #GVolume using a #GMountOperation. Since 2.22.
567func (x *VolumeIface) GetEjectWithOperation() func(Volume, MountUnmountFlags, *MountOperation, *Cancellable, *AsyncReadyCallback, uintptr) {
568	if x.xEjectWithOperation == 0 {
569		return nil
570	}
571	var rawCallback func(VolumeVarp uintptr, FlagsVarp MountUnmountFlags, MountOperationVarp uintptr, CancellableVarp uintptr, CallbackVarp uintptr, UserDataVarp uintptr)
572	purego.RegisterFunc(&rawCallback, x.xEjectWithOperation)
573	return func(VolumeVar Volume, FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
574		rawCallback(VolumeVar.GoPointer(), FlagsVar, MountOperationVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar)
575	}
576}
577
578// OverrideEjectWithOperationFinish sets the "eject_with_operation_finish" callback function.
579// Finishes an eject operation using a #GMountOperation. Since 2.22.
580func (x *VolumeIface) OverrideEjectWithOperationFinish(cb func(Volume, AsyncResult) bool) {
581	if cb == nil {
582		x.xEjectWithOperationFinish = 0
583	} else {
584		x.xEjectWithOperationFinish = purego.NewCallback(func(VolumeVarp uintptr, ResultVarp uintptr) bool {
585			return cb(&VolumeBase{Ptr: VolumeVarp}, &AsyncResultBase{Ptr: ResultVarp})
586		})
587	}
588}
589
590// GetEjectWithOperationFinish gets the "eject_with_operation_finish" callback function.
591// Finishes an eject operation using a #GMountOperation. Since 2.22.
592func (x *VolumeIface) GetEjectWithOperationFinish() func(Volume, AsyncResult) bool {
593	if x.xEjectWithOperationFinish == 0 {
594		return nil
595	}
596	var rawCallback func(VolumeVarp uintptr, ResultVarp uintptr) bool
597	purego.RegisterFunc(&rawCallback, x.xEjectWithOperationFinish)
598	return func(VolumeVar Volume, ResultVar AsyncResult) bool {
599		return rawCallback(VolumeVar.GoPointer(), ResultVar.GoPointer())
600	}
601}
602
603// OverrideGetSortKey sets the "get_sort_key" callback function.
604// Gets a key used for sorting #GVolume instance or %NULL if no such key exists. Since 2.32.
605func (x *VolumeIface) OverrideGetSortKey(cb func(Volume) string) {
606	if cb == nil {
607		x.xGetSortKey = 0
608	} else {
609		x.xGetSortKey = purego.NewCallback(func(VolumeVarp uintptr) string {
610			return cb(&VolumeBase{Ptr: VolumeVarp})
611		})
612	}
613}
614
615// GetGetSortKey gets the "get_sort_key" callback function.
616// Gets a key used for sorting #GVolume instance or %NULL if no such key exists. Since 2.32.
617func (x *VolumeIface) GetGetSortKey() func(Volume) string {
618	if x.xGetSortKey == 0 {
619		return nil
620	}
621	var rawCallback func(VolumeVarp uintptr) string
622	purego.RegisterFunc(&rawCallback, x.xGetSortKey)
623	return func(VolumeVar Volume) string {
624		return rawCallback(VolumeVar.GoPointer())
625	}
626}
627
628// OverrideGetSymbolicIcon sets the "get_symbolic_icon" callback function.
629// Gets a symbolic #GIcon for the #GVolume. Since 2.34.
630func (x *VolumeIface) OverrideGetSymbolicIcon(cb func(Volume) *IconBase) {
631	if cb == nil {
632		x.xGetSymbolicIcon = 0
633	} else {
634		x.xGetSymbolicIcon = purego.NewCallback(func(VolumeVarp uintptr) uintptr {
635			ret := cb(&VolumeBase{Ptr: VolumeVarp})
636			if ret == nil {
637				return 0
638			}
639			return ret.GoPointer()
640		})
641	}
642}
643
644// GetGetSymbolicIcon gets the "get_symbolic_icon" callback function.
645// Gets a symbolic #GIcon for the #GVolume. Since 2.34.
646func (x *VolumeIface) GetGetSymbolicIcon() func(Volume) *IconBase {
647	if x.xGetSymbolicIcon == 0 {
648		return nil
649	}
650	var rawCallback func(VolumeVarp uintptr) uintptr
651	purego.RegisterFunc(&rawCallback, x.xGetSymbolicIcon)
652	return func(VolumeVar Volume) *IconBase {
653		rawRet := rawCallback(VolumeVar.GoPointer())
654		if rawRet == 0 {
655			return nil
656		}
657		ret := &IconBase{}
658		ret.Ptr = rawRet
659		return ret
660	}
661}
662
663// The `GVolume` interface represents user-visible objects that can be
664// mounted. For example, a file system partition on a USB flash drive, or an
665// optical disc inserted into a disc drive.
666//
667// If a `GVolume` is currently mounted, the corresponding [iface@Gio.Mount] can
668// be retrieved using [method@Gio.Volume.get_mount].
669//
670// Mounting a `GVolume` instance is an asynchronous operation. For more
671// information about asynchronous operations, see [iface@Gio.AsyncResult] and
672// [class@Gio.Task]. To mount a `GVolume`, first call [method@Gio.Volume.mount]
673// with (at least) the `GVolume` instance, optionally a
674// [class@Gio.MountOperation] object and a [type@Gio.AsyncReadyCallback].
675//
676// Typically, one will only want to pass `NULL` for the
677// [class@Gio.MountOperation] if automounting all volumes when a desktop session
678// starts since it’s not desirable to put up a lot of dialogs asking
679// for credentials.
680//
681// The callback will be fired when the operation has resolved (either
682// with success or failure), and a [iface@Gio.AsyncResult] instance will be
683// passed to the callback.  That callback should then call
684// [method@Gio.Volume.mount_finish] with the `GVolume` instance and the
685// [iface@Gio.AsyncResult] data to see if the operation was completed
686// successfully.  If a [type@GLib.Error] is present when
687// [method@Gio.Volume.mount_finish] is called, then it will be filled with any
688// error information.
689//
690// Note, when [porting from GnomeVFS](migrating-gnome-vfs.html),
691// `GVolume` is the moral equivalent of `GnomeVFSDrive`.
692//
693// ## Volume Identifiers
694//
695// It is sometimes necessary to directly access the underlying
696// operating system object behind a volume (e.g. for passing a volume
697// to an application via the command line). For this purpose, GIO
698// allows to obtain an ‘identifier’ for the volume. There can be
699// different kinds of identifiers, such as Hal UDIs, filesystem labels,
700// traditional Unix devices (e.g. `/dev/sda2`), UUIDs. GIO uses predefined
701// strings as names for the different kinds of identifiers:
702// `G_VOLUME_IDENTIFIER_KIND_UUID`, `G_VOLUME_IDENTIFIER_KIND_LABEL`, etc.
703// Use [method@Gio.Volume.get_identifier] to obtain an identifier for a volume.
704//
705// Note that `G_VOLUME_IDENTIFIER_KIND_HAL_UDI` will only be available
706// when the GVFS hal volume monitor is in use. Other volume monitors
707// will generally be able to provide the `G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE`
708// identifier, which can be used to obtain a hal device by means of
709// `libhal_manager_find_device_string_match()`.
710type Volume interface {
711	GoPointer() uintptr
712	SetGoPointer(uintptr)
713	CanEject() bool
714	CanMount() bool
715	Eject(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
716	EjectFinish(ResultVar AsyncResult) (bool, error)
717	EjectWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
718	EjectWithOperationFinish(ResultVar AsyncResult) (bool, error)
719	EnumerateIdentifiers() []string
720	GetActivationRoot() *FileBase
721	GetDrive() *DriveBase
722	GetIcon() *IconBase
723	GetIdentifier(KindVar string) string
724	GetMount() *MountBase
725	GetName() string
726	GetSortKey() string
727	GetSymbolicIcon() *IconBase
728	GetUuid() string
729	Mount(FlagsVar MountMountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
730	MountFinish(ResultVar AsyncResult) (bool, error)
731	ShouldAutomount() bool
732}
733
734var xVolumeGLibType func() types.GType
735
736func VolumeGLibType() types.GType {
737	return xVolumeGLibType()
738}
739
740type VolumeBase struct {
741	Ptr uintptr
742}
743
744func (x *VolumeBase) GoPointer() uintptr {
745	if x == nil {
746		return 0
747	}
748	return x.Ptr
749}
750
751func (x *VolumeBase) SetGoPointer(ptr uintptr) {
752	x.Ptr = ptr
753}
754
755// Checks if a volume can be ejected.
756func (x *VolumeBase) CanEject() bool {
757
758	cret := XGVolumeCanEject(x.GoPointer())
759	return cret
760}
761
762// Checks if a volume can be mounted.
763func (x *VolumeBase) CanMount() bool {
764
765	cret := XGVolumeCanMount(x.GoPointer())
766	return cret
767}
768
769// Ejects a volume. This is an asynchronous operation, and is
770// finished by calling g_volume_eject_finish() with the @volume
771// and #GAsyncResult returned in the @callback.
772func (x *VolumeBase) Eject(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
773
774	XGVolumeEject(x.GoPointer(), FlagsVar, CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar)
775
776}
777
778// Finishes ejecting a volume. If any errors occurred during the operation,
779// @error will be set to contain the errors and %FALSE will be returned.
780func (x *VolumeBase) EjectFinish(ResultVar AsyncResult) (bool, error) {
781	var cerr *glib.Error
782
783	cret := XGVolumeEjectFinish(x.GoPointer(), ResultVar.GoPointer(), &cerr)
784	if cerr == nil {
785		return cret, nil
786	}
787	return cret, cerr
788
789}
790
791// Ejects a volume. This is an asynchronous operation, and is
792// finished by calling g_volume_eject_with_operation_finish() with the @volume
793// and #GAsyncResult data returned in the @callback.
794func (x *VolumeBase) EjectWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
795
796	XGVolumeEjectWithOperation(x.GoPointer(), FlagsVar, MountOperationVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar)
797
798}
799
800// Finishes ejecting a volume. If any errors occurred during the operation,
801// @error will be set to contain the errors and %FALSE will be returned.
802func (x *VolumeBase) EjectWithOperationFinish(ResultVar AsyncResult) (bool, error) {
803	var cerr *glib.Error
804
805	cret := XGVolumeEjectWithOperationFinish(x.GoPointer(), ResultVar.GoPointer(), &cerr)
806	if cerr == nil {
807		return cret, nil
808	}
809	return cret, cerr
810
811}
812
813// Gets the kinds of [identifiers](#volume-identifiers) that @volume has.
814// Use g_volume_get_identifier() to obtain the identifiers themselves.
815func (x *VolumeBase) EnumerateIdentifiers() []string {
816
817	cret := XGVolumeEnumerateIdentifiers(x.GoPointer())
818	return cret
819}
820
821// Gets the activation root for a #GVolume if it is known ahead of
822// mount time. Returns %NULL otherwise. If not %NULL and if @volume
823// is mounted, then the result of g_mount_get_root() on the
824// #GMount object obtained from g_volume_get_mount() will always
825// either be equal or a prefix of what this function returns. In
826// other words, in code
827//
828// |[<!-- language="C" -->
829//
830//	GMount *mount;
831//	GFile *mount_root
832//	GFile *volume_activation_root;
833//
834//	mount = g_volume_get_mount (volume); // mounted, so never NULL
835//	mount_root = g_mount_get_root (mount);
836//	volume_activation_root = g_volume_get_activation_root (volume); // assume not NULL
837//
838// ]|
839// then the expression
840// |[<!-- language="C" -->
841//
842//	(g_file_has_prefix (volume_activation_root, mount_root) ||
843//	 g_file_equal (volume_activation_root, mount_root))
844//
845// ]|
846// will always be %TRUE.
847//
848// Activation roots are typically used in #GVolumeMonitor
849// implementations to find the underlying mount to shadow, see
850// g_mount_is_shadowed() for more details.
851func (x *VolumeBase) GetActivationRoot() *FileBase {
852	var cls *FileBase
853
854	cret := XGVolumeGetActivationRoot(x.GoPointer())
855
856	if cret == 0 {
857		return nil
858	}
859	cls = &FileBase{}
860	cls.Ptr = cret
861	return cls
862}
863
864// Gets the drive for the @volume.
865func (x *VolumeBase) GetDrive() *DriveBase {
866	var cls *DriveBase
867
868	cret := XGVolumeGetDrive(x.GoPointer())
869
870	if cret == 0 {
871		return nil
872	}
873	cls = &DriveBase{}
874	cls.Ptr = cret
875	return cls
876}
877
878// Gets the icon for @volume.
879func (x *VolumeBase) GetIcon() *IconBase {
880	var cls *IconBase
881
882	cret := XGVolumeGetIcon(x.GoPointer())
883
884	if cret == 0 {
885		return nil
886	}
887	cls = &IconBase{}
888	cls.Ptr = cret
889	return cls
890}
891
892// Gets the identifier of the given kind for @volume.
893// See the [introduction](#volume-identifiers) for more
894// information about volume identifiers.
895func (x *VolumeBase) GetIdentifier(KindVar string) string {
896
897	cret := XGVolumeGetIdentifier(x.GoPointer(), KindVar)
898	return cret
899}
900
901// Gets the mount for the @volume.
902func (x *VolumeBase) GetMount() *MountBase {
903	var cls *MountBase
904
905	cret := XGVolumeGetMount(x.GoPointer())
906
907	if cret == 0 {
908		return nil
909	}
910	cls = &MountBase{}
911	cls.Ptr = cret
912	return cls
913}
914
915// Gets the name of @volume.
916func (x *VolumeBase) GetName() string {
917
918	cret := XGVolumeGetName(x.GoPointer())
919	return cret
920}
921
922// Gets the sort key for @volume, if any.
923func (x *VolumeBase) GetSortKey() string {
924
925	cret := XGVolumeGetSortKey(x.GoPointer())
926	return cret
927}
928
929// Gets the symbolic icon for @volume.
930func (x *VolumeBase) GetSymbolicIcon() *IconBase {
931	var cls *IconBase
932
933	cret := XGVolumeGetSymbolicIcon(x.GoPointer())
934
935	if cret == 0 {
936		return nil
937	}
938	cls = &IconBase{}
939	cls.Ptr = cret
940	return cls
941}
942
943// Gets the UUID for the @volume. The reference is typically based on
944// the file system UUID for the volume in question and should be
945// considered an opaque string. Returns %NULL if there is no UUID
946// available.
947func (x *VolumeBase) GetUuid() string {
948
949	cret := XGVolumeGetUuid(x.GoPointer())
950	return cret
951}
952
953// Mounts a volume. This is an asynchronous operation, and is
954// finished by calling g_volume_mount_finish() with the @volume
955// and #GAsyncResult returned in the @callback.
956func (x *VolumeBase) Mount(FlagsVar MountMountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
957
958	XGVolumeMount(x.GoPointer(), FlagsVar, MountOperationVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar)
959
960}
961
962// Finishes mounting a volume. If any errors occurred during the operation,
963// @error will be set to contain the errors and %FALSE will be returned.
964//
965// If the mount operation succeeded, g_volume_get_mount() on @volume
966// is guaranteed to return the mount right after calling this
967// function; there's no need to listen for the 'mount-added' signal on
968// #GVolumeMonitor.
969func (x *VolumeBase) MountFinish(ResultVar AsyncResult) (bool, error) {
970	var cerr *glib.Error
971
972	cret := XGVolumeMountFinish(x.GoPointer(), ResultVar.GoPointer(), &cerr)
973	if cerr == nil {
974		return cret, nil
975	}
976	return cret, cerr
977
978}
979
980// Returns whether the volume should be automatically mounted.
981func (x *VolumeBase) ShouldAutomount() bool {
982
983	cret := XGVolumeShouldAutomount(x.GoPointer())
984	return cret
985}
986
987var XGVolumeCanEject func(uintptr) bool
988var XGVolumeCanMount func(uintptr) bool
989var XGVolumeEject func(uintptr, MountUnmountFlags, uintptr, uintptr, uintptr)
990var XGVolumeEjectFinish func(uintptr, uintptr, **glib.Error) bool
991var XGVolumeEjectWithOperation func(uintptr, MountUnmountFlags, uintptr, uintptr, uintptr, uintptr)
992var XGVolumeEjectWithOperationFinish func(uintptr, uintptr, **glib.Error) bool
993var XGVolumeEnumerateIdentifiers func(uintptr) []string
994var XGVolumeGetActivationRoot func(uintptr) uintptr
995var XGVolumeGetDrive func(uintptr) uintptr
996var XGVolumeGetIcon func(uintptr) uintptr
997var XGVolumeGetIdentifier func(uintptr, string) string
998var XGVolumeGetMount func(uintptr) uintptr
999var XGVolumeGetName func(uintptr) string
1000var XGVolumeGetSortKey func(uintptr) string
1001var XGVolumeGetSymbolicIcon func(uintptr) uintptr
1002var XGVolumeGetUuid func(uintptr) string
1003var XGVolumeMount func(uintptr, MountMountFlags, uintptr, uintptr, uintptr, uintptr)
1004var XGVolumeMountFinish func(uintptr, uintptr, **glib.Error) bool
1005var XGVolumeShouldAutomount func(uintptr) bool
1006
1007const (
1008	// The string used to obtain the volume class with g_volume_get_identifier().
1009	//
1010	// Known volume classes include `device`, `network`, and `loop`. Other
1011	// classes may be added in the future.
1012	//
1013	// This is intended to be used by applications to classify #GVolume
1014	// instances into different sections - for example a file manager or
1015	// file chooser can use this information to show `network` volumes under
1016	// a "Network" heading and `device` volumes under a "Devices" heading.
1017	VOLUME_IDENTIFIER_KIND_CLASS string = "class"
1018	// The string used to obtain a Hal UDI with g_volume_get_identifier().
1019	VOLUME_IDENTIFIER_KIND_HAL_UDI string = "hal-udi"
1020	// The string used to obtain a filesystem label with g_volume_get_identifier().
1021	VOLUME_IDENTIFIER_KIND_LABEL string = "label"
1022	// The string used to obtain a NFS mount with g_volume_get_identifier().
1023	VOLUME_IDENTIFIER_KIND_NFS_MOUNT string = "nfs-mount"
1024	// The string used to obtain a Unix device path with g_volume_get_identifier().
1025	VOLUME_IDENTIFIER_KIND_UNIX_DEVICE string = "unix-device"
1026	// The string used to obtain a UUID with g_volume_get_identifier().
1027	VOLUME_IDENTIFIER_KIND_UUID string = "uuid"
1028)
1029
1030func init() {
1031	core.SetPackageName("GIO", "gio-2.0")
1032	core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"})
1033	var libs []uintptr
1034	for _, libPath := range core.GetPaths("GIO") {
1035		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
1036		if err != nil {
1037			panic(err)
1038		}
1039		libs = append(libs, lib)
1040	}
1041
1042	core.PuregoSafeRegister(&xVolumeGLibType, libs, "g_volume_get_type")
1043
1044	core.PuregoSafeRegister(&XGVolumeCanEject, libs, "g_volume_can_eject")
1045	core.PuregoSafeRegister(&XGVolumeCanMount, libs, "g_volume_can_mount")
1046	core.PuregoSafeRegister(&XGVolumeEject, libs, "g_volume_eject")
1047	core.PuregoSafeRegister(&XGVolumeEjectFinish, libs, "g_volume_eject_finish")
1048	core.PuregoSafeRegister(&XGVolumeEjectWithOperation, libs, "g_volume_eject_with_operation")
1049	core.PuregoSafeRegister(&XGVolumeEjectWithOperationFinish, libs, "g_volume_eject_with_operation_finish")
1050	core.PuregoSafeRegister(&XGVolumeEnumerateIdentifiers, libs, "g_volume_enumerate_identifiers")
1051	core.PuregoSafeRegister(&XGVolumeGetActivationRoot, libs, "g_volume_get_activation_root")
1052	core.PuregoSafeRegister(&XGVolumeGetDrive, libs, "g_volume_get_drive")
1053	core.PuregoSafeRegister(&XGVolumeGetIcon, libs, "g_volume_get_icon")
1054	core.PuregoSafeRegister(&XGVolumeGetIdentifier, libs, "g_volume_get_identifier")
1055	core.PuregoSafeRegister(&XGVolumeGetMount, libs, "g_volume_get_mount")
1056	core.PuregoSafeRegister(&XGVolumeGetName, libs, "g_volume_get_name")
1057	core.PuregoSafeRegister(&XGVolumeGetSortKey, libs, "g_volume_get_sort_key")
1058	core.PuregoSafeRegister(&XGVolumeGetSymbolicIcon, libs, "g_volume_get_symbolic_icon")
1059	core.PuregoSafeRegister(&XGVolumeGetUuid, libs, "g_volume_get_uuid")
1060	core.PuregoSafeRegister(&XGVolumeMount, libs, "g_volume_mount")
1061	core.PuregoSafeRegister(&XGVolumeMountFinish, libs, "g_volume_mount_finish")
1062	core.PuregoSafeRegister(&XGVolumeShouldAutomount, libs, "g_volume_should_automount")
1063
1064}

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