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 mounts.
16type MountIface struct {
17 _ structs.HostLayout
18
19 GIface uintptr
20
21 xChanged uintptr
22
23 xUnmounted uintptr
24
25 xGetRoot uintptr
26
27 xGetName uintptr
28
29 xGetIcon uintptr
30
31 xGetUuid uintptr
32
33 xGetVolume uintptr
34
35 xGetDrive uintptr
36
37 xCanUnmount uintptr
38
39 xCanEject uintptr
40
41 xUnmount uintptr
42
43 xUnmountFinish uintptr
44
45 xEject uintptr
46
47 xEjectFinish uintptr
48
49 xRemount uintptr
50
51 xRemountFinish uintptr
52
53 xGuessContentType uintptr
54
55 xGuessContentTypeFinish uintptr
56
57 xGuessContentTypeSync uintptr
58
59 xPreUnmount uintptr
60
61 xUnmountWithOperation uintptr
62
63 xUnmountWithOperationFinish uintptr
64
65 xEjectWithOperation uintptr
66
67 xEjectWithOperationFinish uintptr
68
69 xGetDefaultLocation uintptr
70
71 xGetSortKey uintptr
72
73 xGetSymbolicIcon uintptr
74}
75
76func (x *MountIface) GoPointer() uintptr {
77 return uintptr(unsafe.Pointer(x))
78}
79
80// OverrideChanged sets the "changed" callback function.
81// Changed signal that is emitted when the mount's state has changed.
82func (x *MountIface) OverrideChanged(cb func(Mount)) {
83 if cb == nil {
84 x.xChanged = 0
85 } else {
86 x.xChanged = purego.NewCallback(func(MountVarp uintptr) {
87 cb(&MountBase{Ptr: MountVarp})
88 })
89 }
90}
91
92// GetChanged gets the "changed" callback function.
93// Changed signal that is emitted when the mount's state has changed.
94func (x *MountIface) GetChanged() func(Mount) {
95 if x.xChanged == 0 {
96 return nil
97 }
98 var rawCallback func(MountVarp uintptr)
99 purego.RegisterFunc(&rawCallback, x.xChanged)
100 return func(MountVar Mount) {
101 rawCallback(MountVar.GoPointer())
102 }
103}
104
105// OverrideUnmounted sets the "unmounted" callback function.
106// The unmounted signal that is emitted when the #GMount have been unmounted. If the recipient is holding references to the object they should release them so the object can be finalized.
107func (x *MountIface) OverrideUnmounted(cb func(Mount)) {
108 if cb == nil {
109 x.xUnmounted = 0
110 } else {
111 x.xUnmounted = purego.NewCallback(func(MountVarp uintptr) {
112 cb(&MountBase{Ptr: MountVarp})
113 })
114 }
115}
116
117// GetUnmounted gets the "unmounted" callback function.
118// The unmounted signal that is emitted when the #GMount have been unmounted. If the recipient is holding references to the object they should release them so the object can be finalized.
119func (x *MountIface) GetUnmounted() func(Mount) {
120 if x.xUnmounted == 0 {
121 return nil
122 }
123 var rawCallback func(MountVarp uintptr)
124 purego.RegisterFunc(&rawCallback, x.xUnmounted)
125 return func(MountVar Mount) {
126 rawCallback(MountVar.GoPointer())
127 }
128}
129
130// OverrideGetRoot sets the "get_root" callback function.
131// Gets a #GFile to the root directory of the #GMount.
132func (x *MountIface) OverrideGetRoot(cb func(Mount) *FileBase) {
133 if cb == nil {
134 x.xGetRoot = 0
135 } else {
136 x.xGetRoot = purego.NewCallback(func(MountVarp uintptr) uintptr {
137 ret := cb(&MountBase{Ptr: MountVarp})
138 if ret == nil {
139 return 0
140 }
141 return ret.GoPointer()
142 })
143 }
144}
145
146// GetGetRoot gets the "get_root" callback function.
147// Gets a #GFile to the root directory of the #GMount.
148func (x *MountIface) GetGetRoot() func(Mount) *FileBase {
149 if x.xGetRoot == 0 {
150 return nil
151 }
152 var rawCallback func(MountVarp uintptr) uintptr
153 purego.RegisterFunc(&rawCallback, x.xGetRoot)
154 return func(MountVar Mount) *FileBase {
155 rawRet := rawCallback(MountVar.GoPointer())
156 if rawRet == 0 {
157 return nil
158 }
159 ret := &FileBase{}
160 ret.Ptr = rawRet
161 return ret
162 }
163}
164
165// OverrideGetName sets the "get_name" callback function.
166// Gets a string containing the name of the #GMount.
167func (x *MountIface) OverrideGetName(cb func(Mount) string) {
168 if cb == nil {
169 x.xGetName = 0
170 } else {
171 x.xGetName = purego.NewCallback(func(MountVarp uintptr) string {
172 return cb(&MountBase{Ptr: MountVarp})
173 })
174 }
175}
176
177// GetGetName gets the "get_name" callback function.
178// Gets a string containing the name of the #GMount.
179func (x *MountIface) GetGetName() func(Mount) string {
180 if x.xGetName == 0 {
181 return nil
182 }
183 var rawCallback func(MountVarp uintptr) string
184 purego.RegisterFunc(&rawCallback, x.xGetName)
185 return func(MountVar Mount) string {
186 return rawCallback(MountVar.GoPointer())
187 }
188}
189
190// OverrideGetIcon sets the "get_icon" callback function.
191// Gets a #GIcon for the #GMount.
192func (x *MountIface) OverrideGetIcon(cb func(Mount) *IconBase) {
193 if cb == nil {
194 x.xGetIcon = 0
195 } else {
196 x.xGetIcon = purego.NewCallback(func(MountVarp uintptr) uintptr {
197 ret := cb(&MountBase{Ptr: MountVarp})
198 if ret == nil {
199 return 0
200 }
201 return ret.GoPointer()
202 })
203 }
204}
205
206// GetGetIcon gets the "get_icon" callback function.
207// Gets a #GIcon for the #GMount.
208func (x *MountIface) GetGetIcon() func(Mount) *IconBase {
209 if x.xGetIcon == 0 {
210 return nil
211 }
212 var rawCallback func(MountVarp uintptr) uintptr
213 purego.RegisterFunc(&rawCallback, x.xGetIcon)
214 return func(MountVar Mount) *IconBase {
215 rawRet := rawCallback(MountVar.GoPointer())
216 if rawRet == 0 {
217 return nil
218 }
219 ret := &IconBase{}
220 ret.Ptr = rawRet
221 return ret
222 }
223}
224
225// OverrideGetUuid sets the "get_uuid" callback function.
226// Gets the UUID for the #GMount. 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.
227func (x *MountIface) OverrideGetUuid(cb func(Mount) string) {
228 if cb == nil {
229 x.xGetUuid = 0
230 } else {
231 x.xGetUuid = purego.NewCallback(func(MountVarp uintptr) string {
232 return cb(&MountBase{Ptr: MountVarp})
233 })
234 }
235}
236
237// GetGetUuid gets the "get_uuid" callback function.
238// Gets the UUID for the #GMount. 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.
239func (x *MountIface) GetGetUuid() func(Mount) string {
240 if x.xGetUuid == 0 {
241 return nil
242 }
243 var rawCallback func(MountVarp uintptr) string
244 purego.RegisterFunc(&rawCallback, x.xGetUuid)
245 return func(MountVar Mount) string {
246 return rawCallback(MountVar.GoPointer())
247 }
248}
249
250// OverrideGetVolume sets the "get_volume" callback function.
251// Gets a #GVolume the mount is located on. Returns %NULL if the #GMount is not associated with a #GVolume.
252func (x *MountIface) OverrideGetVolume(cb func(Mount) *VolumeBase) {
253 if cb == nil {
254 x.xGetVolume = 0
255 } else {
256 x.xGetVolume = purego.NewCallback(func(MountVarp uintptr) uintptr {
257 ret := cb(&MountBase{Ptr: MountVarp})
258 if ret == nil {
259 return 0
260 }
261 return ret.GoPointer()
262 })
263 }
264}
265
266// GetGetVolume gets the "get_volume" callback function.
267// Gets a #GVolume the mount is located on. Returns %NULL if the #GMount is not associated with a #GVolume.
268func (x *MountIface) GetGetVolume() func(Mount) *VolumeBase {
269 if x.xGetVolume == 0 {
270 return nil
271 }
272 var rawCallback func(MountVarp uintptr) uintptr
273 purego.RegisterFunc(&rawCallback, x.xGetVolume)
274 return func(MountVar Mount) *VolumeBase {
275 rawRet := rawCallback(MountVar.GoPointer())
276 if rawRet == 0 {
277 return nil
278 }
279 ret := &VolumeBase{}
280 ret.Ptr = rawRet
281 return ret
282 }
283}
284
285// OverrideGetDrive sets the "get_drive" callback function.
286// Gets a #GDrive the volume of the mount is located on. Returns %NULL if the #GMount is not associated with a #GDrive or a #GVolume. This is convenience method for getting the #GVolume and using that to get the #GDrive.
287func (x *MountIface) OverrideGetDrive(cb func(Mount) *DriveBase) {
288 if cb == nil {
289 x.xGetDrive = 0
290 } else {
291 x.xGetDrive = purego.NewCallback(func(MountVarp uintptr) uintptr {
292 ret := cb(&MountBase{Ptr: MountVarp})
293 if ret == nil {
294 return 0
295 }
296 return ret.GoPointer()
297 })
298 }
299}
300
301// GetGetDrive gets the "get_drive" callback function.
302// Gets a #GDrive the volume of the mount is located on. Returns %NULL if the #GMount is not associated with a #GDrive or a #GVolume. This is convenience method for getting the #GVolume and using that to get the #GDrive.
303func (x *MountIface) GetGetDrive() func(Mount) *DriveBase {
304 if x.xGetDrive == 0 {
305 return nil
306 }
307 var rawCallback func(MountVarp uintptr) uintptr
308 purego.RegisterFunc(&rawCallback, x.xGetDrive)
309 return func(MountVar Mount) *DriveBase {
310 rawRet := rawCallback(MountVar.GoPointer())
311 if rawRet == 0 {
312 return nil
313 }
314 ret := &DriveBase{}
315 ret.Ptr = rawRet
316 return ret
317 }
318}
319
320// OverrideCanUnmount sets the "can_unmount" callback function.
321// Checks if a #GMount can be unmounted.
322func (x *MountIface) OverrideCanUnmount(cb func(Mount) bool) {
323 if cb == nil {
324 x.xCanUnmount = 0
325 } else {
326 x.xCanUnmount = purego.NewCallback(func(MountVarp uintptr) bool {
327 return cb(&MountBase{Ptr: MountVarp})
328 })
329 }
330}
331
332// GetCanUnmount gets the "can_unmount" callback function.
333// Checks if a #GMount can be unmounted.
334func (x *MountIface) GetCanUnmount() func(Mount) bool {
335 if x.xCanUnmount == 0 {
336 return nil
337 }
338 var rawCallback func(MountVarp uintptr) bool
339 purego.RegisterFunc(&rawCallback, x.xCanUnmount)
340 return func(MountVar Mount) bool {
341 return rawCallback(MountVar.GoPointer())
342 }
343}
344
345// OverrideCanEject sets the "can_eject" callback function.
346// Checks if a #GMount can be ejected.
347func (x *MountIface) OverrideCanEject(cb func(Mount) bool) {
348 if cb == nil {
349 x.xCanEject = 0
350 } else {
351 x.xCanEject = purego.NewCallback(func(MountVarp uintptr) bool {
352 return cb(&MountBase{Ptr: MountVarp})
353 })
354 }
355}
356
357// GetCanEject gets the "can_eject" callback function.
358// Checks if a #GMount can be ejected.
359func (x *MountIface) GetCanEject() func(Mount) bool {
360 if x.xCanEject == 0 {
361 return nil
362 }
363 var rawCallback func(MountVarp uintptr) bool
364 purego.RegisterFunc(&rawCallback, x.xCanEject)
365 return func(MountVar Mount) bool {
366 return rawCallback(MountVar.GoPointer())
367 }
368}
369
370// OverrideUnmount sets the "unmount" callback function.
371// Starts unmounting a #GMount.
372func (x *MountIface) OverrideUnmount(cb func(Mount, MountUnmountFlags, *Cancellable, *AsyncReadyCallback, uintptr)) {
373 if cb == nil {
374 x.xUnmount = 0
375 } else {
376 x.xUnmount = purego.NewCallback(func(MountVarp uintptr, FlagsVarp MountUnmountFlags, CancellableVarp uintptr, CallbackVarp uintptr, UserDataVarp uintptr) {
377 cb(&MountBase{Ptr: MountVarp}, FlagsVarp, CancellableNewFromInternalPtr(CancellableVarp), (*AsyncReadyCallback)(unsafe.Pointer(CallbackVarp)), UserDataVarp)
378 })
379 }
380}
381
382// GetUnmount gets the "unmount" callback function.
383// Starts unmounting a #GMount.
384func (x *MountIface) GetUnmount() func(Mount, MountUnmountFlags, *Cancellable, *AsyncReadyCallback, uintptr) {
385 if x.xUnmount == 0 {
386 return nil
387 }
388 var rawCallback func(MountVarp uintptr, FlagsVarp MountUnmountFlags, CancellableVarp uintptr, CallbackVarp uintptr, UserDataVarp uintptr)
389 purego.RegisterFunc(&rawCallback, x.xUnmount)
390 return func(MountVar Mount, FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
391 rawCallback(MountVar.GoPointer(), FlagsVar, CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar)
392 }
393}
394
395// OverrideUnmountFinish sets the "unmount_finish" callback function.
396// Finishes an unmounting operation.
397func (x *MountIface) OverrideUnmountFinish(cb func(Mount, AsyncResult) bool) {
398 if cb == nil {
399 x.xUnmountFinish = 0
400 } else {
401 x.xUnmountFinish = purego.NewCallback(func(MountVarp uintptr, ResultVarp uintptr) bool {
402 return cb(&MountBase{Ptr: MountVarp}, &AsyncResultBase{Ptr: ResultVarp})
403 })
404 }
405}
406
407// GetUnmountFinish gets the "unmount_finish" callback function.
408// Finishes an unmounting operation.
409func (x *MountIface) GetUnmountFinish() func(Mount, AsyncResult) bool {
410 if x.xUnmountFinish == 0 {
411 return nil
412 }
413 var rawCallback func(MountVarp uintptr, ResultVarp uintptr) bool
414 purego.RegisterFunc(&rawCallback, x.xUnmountFinish)
415 return func(MountVar Mount, ResultVar AsyncResult) bool {
416 return rawCallback(MountVar.GoPointer(), ResultVar.GoPointer())
417 }
418}
419
420// OverrideEject sets the "eject" callback function.
421// Starts ejecting a #GMount.
422func (x *MountIface) OverrideEject(cb func(Mount, MountUnmountFlags, *Cancellable, *AsyncReadyCallback, uintptr)) {
423 if cb == nil {
424 x.xEject = 0
425 } else {
426 x.xEject = purego.NewCallback(func(MountVarp uintptr, FlagsVarp MountUnmountFlags, CancellableVarp uintptr, CallbackVarp uintptr, UserDataVarp uintptr) {
427 cb(&MountBase{Ptr: MountVarp}, FlagsVarp, CancellableNewFromInternalPtr(CancellableVarp), (*AsyncReadyCallback)(unsafe.Pointer(CallbackVarp)), UserDataVarp)
428 })
429 }
430}
431
432// GetEject gets the "eject" callback function.
433// Starts ejecting a #GMount.
434func (x *MountIface) GetEject() func(Mount, MountUnmountFlags, *Cancellable, *AsyncReadyCallback, uintptr) {
435 if x.xEject == 0 {
436 return nil
437 }
438 var rawCallback func(MountVarp uintptr, FlagsVarp MountUnmountFlags, CancellableVarp uintptr, CallbackVarp uintptr, UserDataVarp uintptr)
439 purego.RegisterFunc(&rawCallback, x.xEject)
440 return func(MountVar Mount, FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
441 rawCallback(MountVar.GoPointer(), FlagsVar, CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar)
442 }
443}
444
445// OverrideEjectFinish sets the "eject_finish" callback function.
446// Finishes an eject operation.
447func (x *MountIface) OverrideEjectFinish(cb func(Mount, AsyncResult) bool) {
448 if cb == nil {
449 x.xEjectFinish = 0
450 } else {
451 x.xEjectFinish = purego.NewCallback(func(MountVarp uintptr, ResultVarp uintptr) bool {
452 return cb(&MountBase{Ptr: MountVarp}, &AsyncResultBase{Ptr: ResultVarp})
453 })
454 }
455}
456
457// GetEjectFinish gets the "eject_finish" callback function.
458// Finishes an eject operation.
459func (x *MountIface) GetEjectFinish() func(Mount, AsyncResult) bool {
460 if x.xEjectFinish == 0 {
461 return nil
462 }
463 var rawCallback func(MountVarp uintptr, ResultVarp uintptr) bool
464 purego.RegisterFunc(&rawCallback, x.xEjectFinish)
465 return func(MountVar Mount, ResultVar AsyncResult) bool {
466 return rawCallback(MountVar.GoPointer(), ResultVar.GoPointer())
467 }
468}
469
470// OverrideRemount sets the "remount" callback function.
471// Starts remounting a #GMount.
472func (x *MountIface) OverrideRemount(cb func(Mount, MountMountFlags, *MountOperation, *Cancellable, *AsyncReadyCallback, uintptr)) {
473 if cb == nil {
474 x.xRemount = 0
475 } else {
476 x.xRemount = purego.NewCallback(func(MountVarp uintptr, FlagsVarp MountMountFlags, MountOperationVarp uintptr, CancellableVarp uintptr, CallbackVarp uintptr, UserDataVarp uintptr) {
477 cb(&MountBase{Ptr: MountVarp}, FlagsVarp, MountOperationNewFromInternalPtr(MountOperationVarp), CancellableNewFromInternalPtr(CancellableVarp), (*AsyncReadyCallback)(unsafe.Pointer(CallbackVarp)), UserDataVarp)
478 })
479 }
480}
481
482// GetRemount gets the "remount" callback function.
483// Starts remounting a #GMount.
484func (x *MountIface) GetRemount() func(Mount, MountMountFlags, *MountOperation, *Cancellable, *AsyncReadyCallback, uintptr) {
485 if x.xRemount == 0 {
486 return nil
487 }
488 var rawCallback func(MountVarp uintptr, FlagsVarp MountMountFlags, MountOperationVarp uintptr, CancellableVarp uintptr, CallbackVarp uintptr, UserDataVarp uintptr)
489 purego.RegisterFunc(&rawCallback, x.xRemount)
490 return func(MountVar Mount, FlagsVar MountMountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
491 rawCallback(MountVar.GoPointer(), FlagsVar, MountOperationVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar)
492 }
493}
494
495// OverrideRemountFinish sets the "remount_finish" callback function.
496// Finishes a remounting operation.
497func (x *MountIface) OverrideRemountFinish(cb func(Mount, AsyncResult) bool) {
498 if cb == nil {
499 x.xRemountFinish = 0
500 } else {
501 x.xRemountFinish = purego.NewCallback(func(MountVarp uintptr, ResultVarp uintptr) bool {
502 return cb(&MountBase{Ptr: MountVarp}, &AsyncResultBase{Ptr: ResultVarp})
503 })
504 }
505}
506
507// GetRemountFinish gets the "remount_finish" callback function.
508// Finishes a remounting operation.
509func (x *MountIface) GetRemountFinish() func(Mount, AsyncResult) bool {
510 if x.xRemountFinish == 0 {
511 return nil
512 }
513 var rawCallback func(MountVarp uintptr, ResultVarp uintptr) bool
514 purego.RegisterFunc(&rawCallback, x.xRemountFinish)
515 return func(MountVar Mount, ResultVar AsyncResult) bool {
516 return rawCallback(MountVar.GoPointer(), ResultVar.GoPointer())
517 }
518}
519
520// OverrideGuessContentType sets the "guess_content_type" callback function.
521// Starts guessing the type of the content of a #GMount.
522//
523// See g_mount_guess_content_type() for more information on content
524// type guessing. This operation was added in 2.18.
525func (x *MountIface) OverrideGuessContentType(cb func(Mount, bool, *Cancellable, *AsyncReadyCallback, uintptr)) {
526 if cb == nil {
527 x.xGuessContentType = 0
528 } else {
529 x.xGuessContentType = purego.NewCallback(func(MountVarp uintptr, ForceRescanVarp bool, CancellableVarp uintptr, CallbackVarp uintptr, UserDataVarp uintptr) {
530 cb(&MountBase{Ptr: MountVarp}, ForceRescanVarp, CancellableNewFromInternalPtr(CancellableVarp), (*AsyncReadyCallback)(unsafe.Pointer(CallbackVarp)), UserDataVarp)
531 })
532 }
533}
534
535// GetGuessContentType gets the "guess_content_type" callback function.
536// Starts guessing the type of the content of a #GMount.
537//
538// See g_mount_guess_content_type() for more information on content
539// type guessing. This operation was added in 2.18.
540func (x *MountIface) GetGuessContentType() func(Mount, bool, *Cancellable, *AsyncReadyCallback, uintptr) {
541 if x.xGuessContentType == 0 {
542 return nil
543 }
544 var rawCallback func(MountVarp uintptr, ForceRescanVarp bool, CancellableVarp uintptr, CallbackVarp uintptr, UserDataVarp uintptr)
545 purego.RegisterFunc(&rawCallback, x.xGuessContentType)
546 return func(MountVar Mount, ForceRescanVar bool, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
547 rawCallback(MountVar.GoPointer(), ForceRescanVar, CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar)
548 }
549}
550
551// OverrideGuessContentTypeFinish sets the "guess_content_type_finish" callback function.
552// Finishes a content type guessing operation. Added in 2.18.
553func (x *MountIface) OverrideGuessContentTypeFinish(cb func(Mount, AsyncResult) []string) {
554 if cb == nil {
555 x.xGuessContentTypeFinish = 0
556 } else {
557 x.xGuessContentTypeFinish = purego.NewCallback(func(MountVarp uintptr, ResultVarp uintptr) []string {
558 return cb(&MountBase{Ptr: MountVarp}, &AsyncResultBase{Ptr: ResultVarp})
559 })
560 }
561}
562
563// GetGuessContentTypeFinish gets the "guess_content_type_finish" callback function.
564// Finishes a content type guessing operation. Added in 2.18.
565func (x *MountIface) GetGuessContentTypeFinish() func(Mount, AsyncResult) []string {
566 if x.xGuessContentTypeFinish == 0 {
567 return nil
568 }
569 var rawCallback func(MountVarp uintptr, ResultVarp uintptr) []string
570 purego.RegisterFunc(&rawCallback, x.xGuessContentTypeFinish)
571 return func(MountVar Mount, ResultVar AsyncResult) []string {
572 return rawCallback(MountVar.GoPointer(), ResultVar.GoPointer())
573 }
574}
575
576// OverrideGuessContentTypeSync sets the "guess_content_type_sync" callback function.
577// Synchronous variant of @guess_content_type. Added in 2.18
578func (x *MountIface) OverrideGuessContentTypeSync(cb func(Mount, bool, *Cancellable) []string) {
579 if cb == nil {
580 x.xGuessContentTypeSync = 0
581 } else {
582 x.xGuessContentTypeSync = purego.NewCallback(func(MountVarp uintptr, ForceRescanVarp bool, CancellableVarp uintptr) []string {
583 return cb(&MountBase{Ptr: MountVarp}, ForceRescanVarp, CancellableNewFromInternalPtr(CancellableVarp))
584 })
585 }
586}
587
588// GetGuessContentTypeSync gets the "guess_content_type_sync" callback function.
589// Synchronous variant of @guess_content_type. Added in 2.18
590func (x *MountIface) GetGuessContentTypeSync() func(Mount, bool, *Cancellable) []string {
591 if x.xGuessContentTypeSync == 0 {
592 return nil
593 }
594 var rawCallback func(MountVarp uintptr, ForceRescanVarp bool, CancellableVarp uintptr) []string
595 purego.RegisterFunc(&rawCallback, x.xGuessContentTypeSync)
596 return func(MountVar Mount, ForceRescanVar bool, CancellableVar *Cancellable) []string {
597 return rawCallback(MountVar.GoPointer(), ForceRescanVar, CancellableVar.GoPointer())
598 }
599}
600
601// OverridePreUnmount sets the "pre_unmount" callback function.
602// The ::pre-unmount signal that is emitted when the #GMount will soon be emitted. If the recipient is somehow holding the mount open by keeping an open file on it it should close the file.
603func (x *MountIface) OverridePreUnmount(cb func(Mount)) {
604 if cb == nil {
605 x.xPreUnmount = 0
606 } else {
607 x.xPreUnmount = purego.NewCallback(func(MountVarp uintptr) {
608 cb(&MountBase{Ptr: MountVarp})
609 })
610 }
611}
612
613// GetPreUnmount gets the "pre_unmount" callback function.
614// The ::pre-unmount signal that is emitted when the #GMount will soon be emitted. If the recipient is somehow holding the mount open by keeping an open file on it it should close the file.
615func (x *MountIface) GetPreUnmount() func(Mount) {
616 if x.xPreUnmount == 0 {
617 return nil
618 }
619 var rawCallback func(MountVarp uintptr)
620 purego.RegisterFunc(&rawCallback, x.xPreUnmount)
621 return func(MountVar Mount) {
622 rawCallback(MountVar.GoPointer())
623 }
624}
625
626// OverrideUnmountWithOperation sets the "unmount_with_operation" callback function.
627// Starts unmounting a #GMount using a #GMountOperation. Since 2.22.
628func (x *MountIface) OverrideUnmountWithOperation(cb func(Mount, MountUnmountFlags, *MountOperation, *Cancellable, *AsyncReadyCallback, uintptr)) {
629 if cb == nil {
630 x.xUnmountWithOperation = 0
631 } else {
632 x.xUnmountWithOperation = purego.NewCallback(func(MountVarp uintptr, FlagsVarp MountUnmountFlags, MountOperationVarp uintptr, CancellableVarp uintptr, CallbackVarp uintptr, UserDataVarp uintptr) {
633 cb(&MountBase{Ptr: MountVarp}, FlagsVarp, MountOperationNewFromInternalPtr(MountOperationVarp), CancellableNewFromInternalPtr(CancellableVarp), (*AsyncReadyCallback)(unsafe.Pointer(CallbackVarp)), UserDataVarp)
634 })
635 }
636}
637
638// GetUnmountWithOperation gets the "unmount_with_operation" callback function.
639// Starts unmounting a #GMount using a #GMountOperation. Since 2.22.
640func (x *MountIface) GetUnmountWithOperation() func(Mount, MountUnmountFlags, *MountOperation, *Cancellable, *AsyncReadyCallback, uintptr) {
641 if x.xUnmountWithOperation == 0 {
642 return nil
643 }
644 var rawCallback func(MountVarp uintptr, FlagsVarp MountUnmountFlags, MountOperationVarp uintptr, CancellableVarp uintptr, CallbackVarp uintptr, UserDataVarp uintptr)
645 purego.RegisterFunc(&rawCallback, x.xUnmountWithOperation)
646 return func(MountVar Mount, FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
647 rawCallback(MountVar.GoPointer(), FlagsVar, MountOperationVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar)
648 }
649}
650
651// OverrideUnmountWithOperationFinish sets the "unmount_with_operation_finish" callback function.
652// Finishes an unmounting operation using a #GMountOperation. Since 2.22.
653func (x *MountIface) OverrideUnmountWithOperationFinish(cb func(Mount, AsyncResult) bool) {
654 if cb == nil {
655 x.xUnmountWithOperationFinish = 0
656 } else {
657 x.xUnmountWithOperationFinish = purego.NewCallback(func(MountVarp uintptr, ResultVarp uintptr) bool {
658 return cb(&MountBase{Ptr: MountVarp}, &AsyncResultBase{Ptr: ResultVarp})
659 })
660 }
661}
662
663// GetUnmountWithOperationFinish gets the "unmount_with_operation_finish" callback function.
664// Finishes an unmounting operation using a #GMountOperation. Since 2.22.
665func (x *MountIface) GetUnmountWithOperationFinish() func(Mount, AsyncResult) bool {
666 if x.xUnmountWithOperationFinish == 0 {
667 return nil
668 }
669 var rawCallback func(MountVarp uintptr, ResultVarp uintptr) bool
670 purego.RegisterFunc(&rawCallback, x.xUnmountWithOperationFinish)
671 return func(MountVar Mount, ResultVar AsyncResult) bool {
672 return rawCallback(MountVar.GoPointer(), ResultVar.GoPointer())
673 }
674}
675
676// OverrideEjectWithOperation sets the "eject_with_operation" callback function.
677// Starts ejecting a #GMount using a #GMountOperation. Since 2.22.
678func (x *MountIface) OverrideEjectWithOperation(cb func(Mount, MountUnmountFlags, *MountOperation, *Cancellable, *AsyncReadyCallback, uintptr)) {
679 if cb == nil {
680 x.xEjectWithOperation = 0
681 } else {
682 x.xEjectWithOperation = purego.NewCallback(func(MountVarp uintptr, FlagsVarp MountUnmountFlags, MountOperationVarp uintptr, CancellableVarp uintptr, CallbackVarp uintptr, UserDataVarp uintptr) {
683 cb(&MountBase{Ptr: MountVarp}, FlagsVarp, MountOperationNewFromInternalPtr(MountOperationVarp), CancellableNewFromInternalPtr(CancellableVarp), (*AsyncReadyCallback)(unsafe.Pointer(CallbackVarp)), UserDataVarp)
684 })
685 }
686}
687
688// GetEjectWithOperation gets the "eject_with_operation" callback function.
689// Starts ejecting a #GMount using a #GMountOperation. Since 2.22.
690func (x *MountIface) GetEjectWithOperation() func(Mount, MountUnmountFlags, *MountOperation, *Cancellable, *AsyncReadyCallback, uintptr) {
691 if x.xEjectWithOperation == 0 {
692 return nil
693 }
694 var rawCallback func(MountVarp uintptr, FlagsVarp MountUnmountFlags, MountOperationVarp uintptr, CancellableVarp uintptr, CallbackVarp uintptr, UserDataVarp uintptr)
695 purego.RegisterFunc(&rawCallback, x.xEjectWithOperation)
696 return func(MountVar Mount, FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
697 rawCallback(MountVar.GoPointer(), FlagsVar, MountOperationVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar)
698 }
699}
700
701// OverrideEjectWithOperationFinish sets the "eject_with_operation_finish" callback function.
702// Finishes an eject operation using a #GMountOperation. Since 2.22.
703func (x *MountIface) OverrideEjectWithOperationFinish(cb func(Mount, AsyncResult) bool) {
704 if cb == nil {
705 x.xEjectWithOperationFinish = 0
706 } else {
707 x.xEjectWithOperationFinish = purego.NewCallback(func(MountVarp uintptr, ResultVarp uintptr) bool {
708 return cb(&MountBase{Ptr: MountVarp}, &AsyncResultBase{Ptr: ResultVarp})
709 })
710 }
711}
712
713// GetEjectWithOperationFinish gets the "eject_with_operation_finish" callback function.
714// Finishes an eject operation using a #GMountOperation. Since 2.22.
715func (x *MountIface) GetEjectWithOperationFinish() func(Mount, AsyncResult) bool {
716 if x.xEjectWithOperationFinish == 0 {
717 return nil
718 }
719 var rawCallback func(MountVarp uintptr, ResultVarp uintptr) bool
720 purego.RegisterFunc(&rawCallback, x.xEjectWithOperationFinish)
721 return func(MountVar Mount, ResultVar AsyncResult) bool {
722 return rawCallback(MountVar.GoPointer(), ResultVar.GoPointer())
723 }
724}
725
726// OverrideGetDefaultLocation sets the "get_default_location" callback function.
727// Gets a #GFile indication a start location that can be use as the entry point for this mount. Since 2.24.
728func (x *MountIface) OverrideGetDefaultLocation(cb func(Mount) *FileBase) {
729 if cb == nil {
730 x.xGetDefaultLocation = 0
731 } else {
732 x.xGetDefaultLocation = purego.NewCallback(func(MountVarp uintptr) uintptr {
733 ret := cb(&MountBase{Ptr: MountVarp})
734 if ret == nil {
735 return 0
736 }
737 return ret.GoPointer()
738 })
739 }
740}
741
742// GetGetDefaultLocation gets the "get_default_location" callback function.
743// Gets a #GFile indication a start location that can be use as the entry point for this mount. Since 2.24.
744func (x *MountIface) GetGetDefaultLocation() func(Mount) *FileBase {
745 if x.xGetDefaultLocation == 0 {
746 return nil
747 }
748 var rawCallback func(MountVarp uintptr) uintptr
749 purego.RegisterFunc(&rawCallback, x.xGetDefaultLocation)
750 return func(MountVar Mount) *FileBase {
751 rawRet := rawCallback(MountVar.GoPointer())
752 if rawRet == 0 {
753 return nil
754 }
755 ret := &FileBase{}
756 ret.Ptr = rawRet
757 return ret
758 }
759}
760
761// OverrideGetSortKey sets the "get_sort_key" callback function.
762// Gets a key used for sorting #GMount instance or %NULL if no such key exists. Since 2.32.
763func (x *MountIface) OverrideGetSortKey(cb func(Mount) string) {
764 if cb == nil {
765 x.xGetSortKey = 0
766 } else {
767 x.xGetSortKey = purego.NewCallback(func(MountVarp uintptr) string {
768 return cb(&MountBase{Ptr: MountVarp})
769 })
770 }
771}
772
773// GetGetSortKey gets the "get_sort_key" callback function.
774// Gets a key used for sorting #GMount instance or %NULL if no such key exists. Since 2.32.
775func (x *MountIface) GetGetSortKey() func(Mount) string {
776 if x.xGetSortKey == 0 {
777 return nil
778 }
779 var rawCallback func(MountVarp uintptr) string
780 purego.RegisterFunc(&rawCallback, x.xGetSortKey)
781 return func(MountVar Mount) string {
782 return rawCallback(MountVar.GoPointer())
783 }
784}
785
786// OverrideGetSymbolicIcon sets the "get_symbolic_icon" callback function.
787// Gets a symbolic #GIcon for the #GMount. Since 2.34.
788func (x *MountIface) OverrideGetSymbolicIcon(cb func(Mount) *IconBase) {
789 if cb == nil {
790 x.xGetSymbolicIcon = 0
791 } else {
792 x.xGetSymbolicIcon = purego.NewCallback(func(MountVarp uintptr) uintptr {
793 ret := cb(&MountBase{Ptr: MountVarp})
794 if ret == nil {
795 return 0
796 }
797 return ret.GoPointer()
798 })
799 }
800}
801
802// GetGetSymbolicIcon gets the "get_symbolic_icon" callback function.
803// Gets a symbolic #GIcon for the #GMount. Since 2.34.
804func (x *MountIface) GetGetSymbolicIcon() func(Mount) *IconBase {
805 if x.xGetSymbolicIcon == 0 {
806 return nil
807 }
808 var rawCallback func(MountVarp uintptr) uintptr
809 purego.RegisterFunc(&rawCallback, x.xGetSymbolicIcon)
810 return func(MountVar Mount) *IconBase {
811 rawRet := rawCallback(MountVar.GoPointer())
812 if rawRet == 0 {
813 return nil
814 }
815 ret := &IconBase{}
816 ret.Ptr = rawRet
817 return ret
818 }
819}
820
821// The `GMount` interface represents a user-visible mount, such as a mounted
822// file system.
823//
824// `GMount` is a ‘mounted’ filesystem that you can access. Mounted is in
825// quotes because it’s not the same as a UNIX mount, it might be a GVFS
826// mount, but you can still access the files on it if you use GIO.
827//
828// A `GMount` might be associated with a [iface@Gio.Volume] (such as a USB flash
829// drive) which hosts it.
830//
831// Unmounting a `GMount` instance is an asynchronous operation. For
832// more information about asynchronous operations, see [iface@Gio.AsyncResult]
833// and [class@Gio.Task]. To unmount a `GMount` instance, first call
834// [method@Gio.Mount.unmount_with_operation] with (at least) the `GMount`
835// instance and a [type@Gio.AsyncReadyCallback]. The callback will be fired
836// when the operation has resolved (either with success or failure), and a
837// [iface@Gio.AsyncResult] structure will be passed to the callback. That
838// callback should then call [method@Gio.Mount.unmount_with_operation_finish]
839// with the `GMount` and the [iface@Gio.AsyncResult] data to see if the
840// operation was completed successfully. If an `error` is present when
841// [method@Gio.Mount.unmount_with_operation_finish] is called, then it will be
842// filled with any error information.
843//
844// Note, when [porting from GnomeVFS](migrating-gnome-vfs.html), `GMount` is the
845// moral equivalent of `GnomeVFSVolume`.
846type Mount interface {
847 GoPointer() uintptr
848 SetGoPointer(uintptr)
849 CanEject() bool
850 CanUnmount() bool
851 Eject(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
852 EjectFinish(ResultVar AsyncResult) (bool, error)
853 EjectWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
854 EjectWithOperationFinish(ResultVar AsyncResult) (bool, error)
855 GetDefaultLocation() *FileBase
856 GetDrive() *DriveBase
857 GetIcon() *IconBase
858 GetName() string
859 GetRoot() *FileBase
860 GetSortKey() string
861 GetSymbolicIcon() *IconBase
862 GetUuid() string
863 GetVolume() *VolumeBase
864 GuessContentType(ForceRescanVar bool, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
865 GuessContentTypeFinish(ResultVar AsyncResult) ([]string, error)
866 GuessContentTypeSync(ForceRescanVar bool, CancellableVar *Cancellable) ([]string, error)
867 IsShadowed() bool
868 Remount(FlagsVar MountMountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
869 RemountFinish(ResultVar AsyncResult) (bool, error)
870 Shadow()
871 Unmount(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
872 UnmountFinish(ResultVar AsyncResult) (bool, error)
873 UnmountWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
874 UnmountWithOperationFinish(ResultVar AsyncResult) (bool, error)
875 Unshadow()
876}
877
878var xMountGLibType func() types.GType
879
880func MountGLibType() types.GType {
881 return xMountGLibType()
882}
883
884type MountBase struct {
885 Ptr uintptr
886}
887
888func (x *MountBase) GoPointer() uintptr {
889 if x == nil {
890 return 0
891 }
892 return x.Ptr
893}
894
895func (x *MountBase) SetGoPointer(ptr uintptr) {
896 x.Ptr = ptr
897}
898
899// Checks if @mount can be ejected.
900func (x *MountBase) CanEject() bool {
901
902 cret := XGMountCanEject(x.GoPointer())
903 return cret
904}
905
906// Checks if @mount can be unmounted.
907func (x *MountBase) CanUnmount() bool {
908
909 cret := XGMountCanUnmount(x.GoPointer())
910 return cret
911}
912
913// Ejects a mount. This is an asynchronous operation, and is
914// finished by calling g_mount_eject_finish() with the @mount
915// and #GAsyncResult data returned in the @callback.
916func (x *MountBase) Eject(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
917
918 XGMountEject(x.GoPointer(), FlagsVar, CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar)
919
920}
921
922// Finishes ejecting a mount. If any errors occurred during the operation,
923// @error will be set to contain the errors and %FALSE will be returned.
924func (x *MountBase) EjectFinish(ResultVar AsyncResult) (bool, error) {
925 var cerr *glib.Error
926
927 cret := XGMountEjectFinish(x.GoPointer(), ResultVar.GoPointer(), &cerr)
928 if cerr == nil {
929 return cret, nil
930 }
931 return cret, cerr
932
933}
934
935// Ejects a mount. This is an asynchronous operation, and is
936// finished by calling g_mount_eject_with_operation_finish() with the @mount
937// and #GAsyncResult data returned in the @callback.
938func (x *MountBase) EjectWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
939
940 XGMountEjectWithOperation(x.GoPointer(), FlagsVar, MountOperationVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar)
941
942}
943
944// Finishes ejecting a mount. If any errors occurred during the operation,
945// @error will be set to contain the errors and %FALSE will be returned.
946func (x *MountBase) EjectWithOperationFinish(ResultVar AsyncResult) (bool, error) {
947 var cerr *glib.Error
948
949 cret := XGMountEjectWithOperationFinish(x.GoPointer(), ResultVar.GoPointer(), &cerr)
950 if cerr == nil {
951 return cret, nil
952 }
953 return cret, cerr
954
955}
956
957// Gets the default location of @mount. The default location of the given
958// @mount is a path that reflects the main entry point for the user (e.g.
959// the home directory, or the root of the volume).
960func (x *MountBase) GetDefaultLocation() *FileBase {
961 var cls *FileBase
962
963 cret := XGMountGetDefaultLocation(x.GoPointer())
964
965 if cret == 0 {
966 return nil
967 }
968 cls = &FileBase{}
969 cls.Ptr = cret
970 return cls
971}
972
973// Gets the drive for the @mount.
974//
975// This is a convenience method for getting the #GVolume and then
976// using that object to get the #GDrive.
977func (x *MountBase) GetDrive() *DriveBase {
978 var cls *DriveBase
979
980 cret := XGMountGetDrive(x.GoPointer())
981
982 if cret == 0 {
983 return nil
984 }
985 cls = &DriveBase{}
986 cls.Ptr = cret
987 return cls
988}
989
990// Gets the icon for @mount.
991func (x *MountBase) GetIcon() *IconBase {
992 var cls *IconBase
993
994 cret := XGMountGetIcon(x.GoPointer())
995
996 if cret == 0 {
997 return nil
998 }
999 cls = &IconBase{}
1000 cls.Ptr = cret
1001 return cls
1002}
1003
1004// Gets the name of @mount.
1005func (x *MountBase) GetName() string {
1006
1007 cret := XGMountGetName(x.GoPointer())
1008 return cret
1009}
1010
1011// Gets the root directory on @mount.
1012func (x *MountBase) GetRoot() *FileBase {
1013 var cls *FileBase
1014
1015 cret := XGMountGetRoot(x.GoPointer())
1016
1017 if cret == 0 {
1018 return nil
1019 }
1020 cls = &FileBase{}
1021 cls.Ptr = cret
1022 return cls
1023}
1024
1025// Gets the sort key for @mount, if any.
1026func (x *MountBase) GetSortKey() string {
1027
1028 cret := XGMountGetSortKey(x.GoPointer())
1029 return cret
1030}
1031
1032// Gets the symbolic icon for @mount.
1033func (x *MountBase) GetSymbolicIcon() *IconBase {
1034 var cls *IconBase
1035
1036 cret := XGMountGetSymbolicIcon(x.GoPointer())
1037
1038 if cret == 0 {
1039 return nil
1040 }
1041 cls = &IconBase{}
1042 cls.Ptr = cret
1043 return cls
1044}
1045
1046// Gets the UUID for the @mount. The reference is typically based on
1047// the file system UUID for the mount in question and should be
1048// considered an opaque string. Returns %NULL if there is no UUID
1049// available.
1050func (x *MountBase) GetUuid() string {
1051
1052 cret := XGMountGetUuid(x.GoPointer())
1053 return cret
1054}
1055
1056// Gets the volume for the @mount.
1057func (x *MountBase) GetVolume() *VolumeBase {
1058 var cls *VolumeBase
1059
1060 cret := XGMountGetVolume(x.GoPointer())
1061
1062 if cret == 0 {
1063 return nil
1064 }
1065 cls = &VolumeBase{}
1066 cls.Ptr = cret
1067 return cls
1068}
1069
1070// Tries to guess the type of content stored on @mount. Returns one or
1071// more textual identifiers of well-known content types (typically
1072// prefixed with "x-content/"), e.g. x-content/image-dcf for camera
1073// memory cards. See the
1074// [shared-mime-info](http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec)
1075// specification for more on x-content types.
1076//
1077// This is an asynchronous operation (see
1078// g_mount_guess_content_type_sync() for the synchronous version), and
1079// is finished by calling g_mount_guess_content_type_finish() with the
1080// @mount and #GAsyncResult data returned in the @callback.
1081func (x *MountBase) GuessContentType(ForceRescanVar bool, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
1082
1083 XGMountGuessContentType(x.GoPointer(), ForceRescanVar, CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar)
1084
1085}
1086
1087// Finishes guessing content types of @mount. If any errors occurred
1088// during the operation, @error will be set to contain the errors and
1089// %FALSE will be returned. In particular, you may get an
1090// %G_IO_ERROR_NOT_SUPPORTED if the mount does not support content
1091// guessing.
1092func (x *MountBase) GuessContentTypeFinish(ResultVar AsyncResult) ([]string, error) {
1093 var cerr *glib.Error
1094
1095 cret := XGMountGuessContentTypeFinish(x.GoPointer(), ResultVar.GoPointer(), &cerr)
1096 if cerr == nil {
1097 return cret, nil
1098 }
1099 return cret, cerr
1100
1101}
1102
1103// Tries to guess the type of content stored on @mount. Returns one or
1104// more textual identifiers of well-known content types (typically
1105// prefixed with "x-content/"), e.g. x-content/image-dcf for camera
1106// memory cards. See the
1107// [shared-mime-info](http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec)
1108// specification for more on x-content types.
1109//
1110// This is a synchronous operation and as such may block doing IO;
1111// see g_mount_guess_content_type() for the asynchronous version.
1112func (x *MountBase) GuessContentTypeSync(ForceRescanVar bool, CancellableVar *Cancellable) ([]string, error) {
1113 var cerr *glib.Error
1114
1115 cret := XGMountGuessContentTypeSync(x.GoPointer(), ForceRescanVar, CancellableVar.GoPointer(), &cerr)
1116 if cerr == nil {
1117 return cret, nil
1118 }
1119 return cret, cerr
1120
1121}
1122
1123// Determines if @mount is shadowed. Applications or libraries should
1124// avoid displaying @mount in the user interface if it is shadowed.
1125//
1126// A mount is said to be shadowed if there exists one or more user
1127// visible objects (currently #GMount objects) with a root that is
1128// inside the root of @mount.
1129//
1130// One application of shadow mounts is when exposing a single file
1131// system that is used to address several logical volumes. In this
1132// situation, a #GVolumeMonitor implementation would create two
1133// #GVolume objects (for example, one for the camera functionality of
1134// the device and one for a SD card reader on the device) with
1135// activation URIs `gphoto2://[usb:001,002]/store1/`
1136// and `gphoto2://[usb:001,002]/store2/`. When the
1137// underlying mount (with root
1138// `gphoto2://[usb:001,002]/`) is mounted, said
1139// #GVolumeMonitor implementation would create two #GMount objects
1140// (each with their root matching the corresponding volume activation
1141// root) that would shadow the original mount.
1142//
1143// The proxy monitor in GVfs 2.26 and later, automatically creates and
1144// manage shadow mounts (and shadows the underlying mount) if the
1145// activation root on a #GVolume is set.
1146func (x *MountBase) IsShadowed() bool {
1147
1148 cret := XGMountIsShadowed(x.GoPointer())
1149 return cret
1150}
1151
1152// Remounts a mount. This is an asynchronous operation, and is
1153// finished by calling g_mount_remount_finish() with the @mount
1154// and #GAsyncResults data returned in the @callback.
1155//
1156// Remounting is useful when some setting affecting the operation
1157// of the volume has been changed, as these may need a remount to
1158// take affect. While this is semantically equivalent with unmounting
1159// and then remounting not all backends might need to actually be
1160// unmounted.
1161func (x *MountBase) Remount(FlagsVar MountMountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
1162
1163 XGMountRemount(x.GoPointer(), FlagsVar, MountOperationVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar)
1164
1165}
1166
1167// Finishes remounting a mount. If any errors occurred during the operation,
1168// @error will be set to contain the errors and %FALSE will be returned.
1169func (x *MountBase) RemountFinish(ResultVar AsyncResult) (bool, error) {
1170 var cerr *glib.Error
1171
1172 cret := XGMountRemountFinish(x.GoPointer(), ResultVar.GoPointer(), &cerr)
1173 if cerr == nil {
1174 return cret, nil
1175 }
1176 return cret, cerr
1177
1178}
1179
1180// Increments the shadow count on @mount. Usually used by
1181// #GVolumeMonitor implementations when creating a shadow mount for
1182// @mount, see g_mount_is_shadowed() for more information. The caller
1183// will need to emit the #GMount::changed signal on @mount manually.
1184func (x *MountBase) Shadow() {
1185
1186 XGMountShadow(x.GoPointer())
1187
1188}
1189
1190// Unmounts a mount. This is an asynchronous operation, and is
1191// finished by calling g_mount_unmount_finish() with the @mount
1192// and #GAsyncResult data returned in the @callback.
1193func (x *MountBase) Unmount(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
1194
1195 XGMountUnmount(x.GoPointer(), FlagsVar, CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar)
1196
1197}
1198
1199// Finishes unmounting a mount. If any errors occurred during the operation,
1200// @error will be set to contain the errors and %FALSE will be returned.
1201func (x *MountBase) UnmountFinish(ResultVar AsyncResult) (bool, error) {
1202 var cerr *glib.Error
1203
1204 cret := XGMountUnmountFinish(x.GoPointer(), ResultVar.GoPointer(), &cerr)
1205 if cerr == nil {
1206 return cret, nil
1207 }
1208 return cret, cerr
1209
1210}
1211
1212// Unmounts a mount. This is an asynchronous operation, and is
1213// finished by calling g_mount_unmount_with_operation_finish() with the @mount
1214// and #GAsyncResult data returned in the @callback.
1215func (x *MountBase) UnmountWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
1216
1217 XGMountUnmountWithOperation(x.GoPointer(), FlagsVar, MountOperationVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar)
1218
1219}
1220
1221// Finishes unmounting a mount. If any errors occurred during the operation,
1222// @error will be set to contain the errors and %FALSE will be returned.
1223func (x *MountBase) UnmountWithOperationFinish(ResultVar AsyncResult) (bool, error) {
1224 var cerr *glib.Error
1225
1226 cret := XGMountUnmountWithOperationFinish(x.GoPointer(), ResultVar.GoPointer(), &cerr)
1227 if cerr == nil {
1228 return cret, nil
1229 }
1230 return cret, cerr
1231
1232}
1233
1234// Decrements the shadow count on @mount. Usually used by
1235// #GVolumeMonitor implementations when destroying a shadow mount for
1236// @mount, see g_mount_is_shadowed() for more information. The caller
1237// will need to emit the #GMount::changed signal on @mount manually.
1238func (x *MountBase) Unshadow() {
1239
1240 XGMountUnshadow(x.GoPointer())
1241
1242}
1243
1244var XGMountCanEject func(uintptr) bool
1245var XGMountCanUnmount func(uintptr) bool
1246var XGMountEject func(uintptr, MountUnmountFlags, uintptr, uintptr, uintptr)
1247var XGMountEjectFinish func(uintptr, uintptr, **glib.Error) bool
1248var XGMountEjectWithOperation func(uintptr, MountUnmountFlags, uintptr, uintptr, uintptr, uintptr)
1249var XGMountEjectWithOperationFinish func(uintptr, uintptr, **glib.Error) bool
1250var XGMountGetDefaultLocation func(uintptr) uintptr
1251var XGMountGetDrive func(uintptr) uintptr
1252var XGMountGetIcon func(uintptr) uintptr
1253var XGMountGetName func(uintptr) string
1254var XGMountGetRoot func(uintptr) uintptr
1255var XGMountGetSortKey func(uintptr) string
1256var XGMountGetSymbolicIcon func(uintptr) uintptr
1257var XGMountGetUuid func(uintptr) string
1258var XGMountGetVolume func(uintptr) uintptr
1259var XGMountGuessContentType func(uintptr, bool, uintptr, uintptr, uintptr)
1260var XGMountGuessContentTypeFinish func(uintptr, uintptr, **glib.Error) []string
1261var XGMountGuessContentTypeSync func(uintptr, bool, uintptr, **glib.Error) []string
1262var XGMountIsShadowed func(uintptr) bool
1263var XGMountRemount func(uintptr, MountMountFlags, uintptr, uintptr, uintptr, uintptr)
1264var XGMountRemountFinish func(uintptr, uintptr, **glib.Error) bool
1265var XGMountShadow func(uintptr)
1266var XGMountUnmount func(uintptr, MountUnmountFlags, uintptr, uintptr, uintptr)
1267var XGMountUnmountFinish func(uintptr, uintptr, **glib.Error) bool
1268var XGMountUnmountWithOperation func(uintptr, MountUnmountFlags, uintptr, uintptr, uintptr, uintptr)
1269var XGMountUnmountWithOperationFinish func(uintptr, uintptr, **glib.Error) bool
1270var XGMountUnshadow func(uintptr)
1271
1272func init() {
1273 core.SetPackageName("GIO", "gio-2.0")
1274 core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"})
1275 var libs []uintptr
1276 for _, libPath := range core.GetPaths("GIO") {
1277 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
1278 if err != nil {
1279 panic(err)
1280 }
1281 libs = append(libs, lib)
1282 }
1283
1284 core.PuregoSafeRegister(&xMountGLibType, libs, "g_mount_get_type")
1285
1286 core.PuregoSafeRegister(&XGMountCanEject, libs, "g_mount_can_eject")
1287 core.PuregoSafeRegister(&XGMountCanUnmount, libs, "g_mount_can_unmount")
1288 core.PuregoSafeRegister(&XGMountEject, libs, "g_mount_eject")
1289 core.PuregoSafeRegister(&XGMountEjectFinish, libs, "g_mount_eject_finish")
1290 core.PuregoSafeRegister(&XGMountEjectWithOperation, libs, "g_mount_eject_with_operation")
1291 core.PuregoSafeRegister(&XGMountEjectWithOperationFinish, libs, "g_mount_eject_with_operation_finish")
1292 core.PuregoSafeRegister(&XGMountGetDefaultLocation, libs, "g_mount_get_default_location")
1293 core.PuregoSafeRegister(&XGMountGetDrive, libs, "g_mount_get_drive")
1294 core.PuregoSafeRegister(&XGMountGetIcon, libs, "g_mount_get_icon")
1295 core.PuregoSafeRegister(&XGMountGetName, libs, "g_mount_get_name")
1296 core.PuregoSafeRegister(&XGMountGetRoot, libs, "g_mount_get_root")
1297 core.PuregoSafeRegister(&XGMountGetSortKey, libs, "g_mount_get_sort_key")
1298 core.PuregoSafeRegister(&XGMountGetSymbolicIcon, libs, "g_mount_get_symbolic_icon")
1299 core.PuregoSafeRegister(&XGMountGetUuid, libs, "g_mount_get_uuid")
1300 core.PuregoSafeRegister(&XGMountGetVolume, libs, "g_mount_get_volume")
1301 core.PuregoSafeRegister(&XGMountGuessContentType, libs, "g_mount_guess_content_type")
1302 core.PuregoSafeRegister(&XGMountGuessContentTypeFinish, libs, "g_mount_guess_content_type_finish")
1303 core.PuregoSafeRegister(&XGMountGuessContentTypeSync, libs, "g_mount_guess_content_type_sync")
1304 core.PuregoSafeRegister(&XGMountIsShadowed, libs, "g_mount_is_shadowed")
1305 core.PuregoSafeRegister(&XGMountRemount, libs, "g_mount_remount")
1306 core.PuregoSafeRegister(&XGMountRemountFinish, libs, "g_mount_remount_finish")
1307 core.PuregoSafeRegister(&XGMountShadow, libs, "g_mount_shadow")
1308 core.PuregoSafeRegister(&XGMountUnmount, libs, "g_mount_unmount")
1309 core.PuregoSafeRegister(&XGMountUnmountFinish, libs, "g_mount_unmount_finish")
1310 core.PuregoSafeRegister(&XGMountUnmountWithOperation, libs, "g_mount_unmount_with_operation")
1311 core.PuregoSafeRegister(&XGMountUnmountWithOperationFinish, libs, "g_mount_unmount_with_operation_finish")
1312 core.PuregoSafeRegister(&XGMountUnshadow, libs, "g_mount_unshadow")
1313
1314}