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"
13 "github.com/bnema/puregotk/v4/gobject/types"
14)
15
16type VolumeMonitorClass struct {
17 _ structs.HostLayout
18
19 ParentClass gobject.ObjectClass
20
21 xVolumeAdded uintptr
22
23 xVolumeRemoved uintptr
24
25 xVolumeChanged uintptr
26
27 xMountAdded uintptr
28
29 xMountRemoved uintptr
30
31 xMountPreUnmount uintptr
32
33 xMountChanged uintptr
34
35 xDriveConnected uintptr
36
37 xDriveDisconnected uintptr
38
39 xDriveChanged uintptr
40
41 xIsSupported uintptr
42
43 xGetConnectedDrives uintptr
44
45 xGetVolumes uintptr
46
47 xGetMounts uintptr
48
49 xGetVolumeForUuid uintptr
50
51 xGetMountForUuid uintptr
52
53 xAdoptOrphanMount uintptr
54
55 xDriveEjectButton uintptr
56
57 xDriveStopButton uintptr
58
59 xGReserved1 uintptr
60
61 xGReserved2 uintptr
62
63 xGReserved3 uintptr
64
65 xGReserved4 uintptr
66
67 xGReserved5 uintptr
68
69 xGReserved6 uintptr
70}
71
72func (x *VolumeMonitorClass) GoPointer() uintptr {
73 return uintptr(unsafe.Pointer(x))
74}
75
76// OverrideVolumeAdded sets the "volume_added" callback function.
77func (x *VolumeMonitorClass) OverrideVolumeAdded(cb func(*VolumeMonitor, Volume)) {
78 if cb == nil {
79 x.xVolumeAdded = 0
80 } else {
81 x.xVolumeAdded = purego.NewCallback(func(VolumeMonitorVarp uintptr, VolumeVarp uintptr) {
82 cb(VolumeMonitorNewFromInternalPtr(VolumeMonitorVarp), &VolumeBase{Ptr: VolumeVarp})
83 })
84 }
85}
86
87// GetVolumeAdded gets the "volume_added" callback function.
88func (x *VolumeMonitorClass) GetVolumeAdded() func(*VolumeMonitor, Volume) {
89 if x.xVolumeAdded == 0 {
90 return nil
91 }
92 var rawCallback func(VolumeMonitorVarp uintptr, VolumeVarp uintptr)
93 purego.RegisterFunc(&rawCallback, x.xVolumeAdded)
94 return func(VolumeMonitorVar *VolumeMonitor, VolumeVar Volume) {
95 rawCallback(VolumeMonitorVar.GoPointer(), VolumeVar.GoPointer())
96 }
97}
98
99// OverrideVolumeRemoved sets the "volume_removed" callback function.
100func (x *VolumeMonitorClass) OverrideVolumeRemoved(cb func(*VolumeMonitor, Volume)) {
101 if cb == nil {
102 x.xVolumeRemoved = 0
103 } else {
104 x.xVolumeRemoved = purego.NewCallback(func(VolumeMonitorVarp uintptr, VolumeVarp uintptr) {
105 cb(VolumeMonitorNewFromInternalPtr(VolumeMonitorVarp), &VolumeBase{Ptr: VolumeVarp})
106 })
107 }
108}
109
110// GetVolumeRemoved gets the "volume_removed" callback function.
111func (x *VolumeMonitorClass) GetVolumeRemoved() func(*VolumeMonitor, Volume) {
112 if x.xVolumeRemoved == 0 {
113 return nil
114 }
115 var rawCallback func(VolumeMonitorVarp uintptr, VolumeVarp uintptr)
116 purego.RegisterFunc(&rawCallback, x.xVolumeRemoved)
117 return func(VolumeMonitorVar *VolumeMonitor, VolumeVar Volume) {
118 rawCallback(VolumeMonitorVar.GoPointer(), VolumeVar.GoPointer())
119 }
120}
121
122// OverrideVolumeChanged sets the "volume_changed" callback function.
123func (x *VolumeMonitorClass) OverrideVolumeChanged(cb func(*VolumeMonitor, Volume)) {
124 if cb == nil {
125 x.xVolumeChanged = 0
126 } else {
127 x.xVolumeChanged = purego.NewCallback(func(VolumeMonitorVarp uintptr, VolumeVarp uintptr) {
128 cb(VolumeMonitorNewFromInternalPtr(VolumeMonitorVarp), &VolumeBase{Ptr: VolumeVarp})
129 })
130 }
131}
132
133// GetVolumeChanged gets the "volume_changed" callback function.
134func (x *VolumeMonitorClass) GetVolumeChanged() func(*VolumeMonitor, Volume) {
135 if x.xVolumeChanged == 0 {
136 return nil
137 }
138 var rawCallback func(VolumeMonitorVarp uintptr, VolumeVarp uintptr)
139 purego.RegisterFunc(&rawCallback, x.xVolumeChanged)
140 return func(VolumeMonitorVar *VolumeMonitor, VolumeVar Volume) {
141 rawCallback(VolumeMonitorVar.GoPointer(), VolumeVar.GoPointer())
142 }
143}
144
145// OverrideMountAdded sets the "mount_added" callback function.
146func (x *VolumeMonitorClass) OverrideMountAdded(cb func(*VolumeMonitor, Mount)) {
147 if cb == nil {
148 x.xMountAdded = 0
149 } else {
150 x.xMountAdded = purego.NewCallback(func(VolumeMonitorVarp uintptr, MountVarp uintptr) {
151 cb(VolumeMonitorNewFromInternalPtr(VolumeMonitorVarp), &MountBase{Ptr: MountVarp})
152 })
153 }
154}
155
156// GetMountAdded gets the "mount_added" callback function.
157func (x *VolumeMonitorClass) GetMountAdded() func(*VolumeMonitor, Mount) {
158 if x.xMountAdded == 0 {
159 return nil
160 }
161 var rawCallback func(VolumeMonitorVarp uintptr, MountVarp uintptr)
162 purego.RegisterFunc(&rawCallback, x.xMountAdded)
163 return func(VolumeMonitorVar *VolumeMonitor, MountVar Mount) {
164 rawCallback(VolumeMonitorVar.GoPointer(), MountVar.GoPointer())
165 }
166}
167
168// OverrideMountRemoved sets the "mount_removed" callback function.
169func (x *VolumeMonitorClass) OverrideMountRemoved(cb func(*VolumeMonitor, Mount)) {
170 if cb == nil {
171 x.xMountRemoved = 0
172 } else {
173 x.xMountRemoved = purego.NewCallback(func(VolumeMonitorVarp uintptr, MountVarp uintptr) {
174 cb(VolumeMonitorNewFromInternalPtr(VolumeMonitorVarp), &MountBase{Ptr: MountVarp})
175 })
176 }
177}
178
179// GetMountRemoved gets the "mount_removed" callback function.
180func (x *VolumeMonitorClass) GetMountRemoved() func(*VolumeMonitor, Mount) {
181 if x.xMountRemoved == 0 {
182 return nil
183 }
184 var rawCallback func(VolumeMonitorVarp uintptr, MountVarp uintptr)
185 purego.RegisterFunc(&rawCallback, x.xMountRemoved)
186 return func(VolumeMonitorVar *VolumeMonitor, MountVar Mount) {
187 rawCallback(VolumeMonitorVar.GoPointer(), MountVar.GoPointer())
188 }
189}
190
191// OverrideMountPreUnmount sets the "mount_pre_unmount" callback function.
192func (x *VolumeMonitorClass) OverrideMountPreUnmount(cb func(*VolumeMonitor, Mount)) {
193 if cb == nil {
194 x.xMountPreUnmount = 0
195 } else {
196 x.xMountPreUnmount = purego.NewCallback(func(VolumeMonitorVarp uintptr, MountVarp uintptr) {
197 cb(VolumeMonitorNewFromInternalPtr(VolumeMonitorVarp), &MountBase{Ptr: MountVarp})
198 })
199 }
200}
201
202// GetMountPreUnmount gets the "mount_pre_unmount" callback function.
203func (x *VolumeMonitorClass) GetMountPreUnmount() func(*VolumeMonitor, Mount) {
204 if x.xMountPreUnmount == 0 {
205 return nil
206 }
207 var rawCallback func(VolumeMonitorVarp uintptr, MountVarp uintptr)
208 purego.RegisterFunc(&rawCallback, x.xMountPreUnmount)
209 return func(VolumeMonitorVar *VolumeMonitor, MountVar Mount) {
210 rawCallback(VolumeMonitorVar.GoPointer(), MountVar.GoPointer())
211 }
212}
213
214// OverrideMountChanged sets the "mount_changed" callback function.
215func (x *VolumeMonitorClass) OverrideMountChanged(cb func(*VolumeMonitor, Mount)) {
216 if cb == nil {
217 x.xMountChanged = 0
218 } else {
219 x.xMountChanged = purego.NewCallback(func(VolumeMonitorVarp uintptr, MountVarp uintptr) {
220 cb(VolumeMonitorNewFromInternalPtr(VolumeMonitorVarp), &MountBase{Ptr: MountVarp})
221 })
222 }
223}
224
225// GetMountChanged gets the "mount_changed" callback function.
226func (x *VolumeMonitorClass) GetMountChanged() func(*VolumeMonitor, Mount) {
227 if x.xMountChanged == 0 {
228 return nil
229 }
230 var rawCallback func(VolumeMonitorVarp uintptr, MountVarp uintptr)
231 purego.RegisterFunc(&rawCallback, x.xMountChanged)
232 return func(VolumeMonitorVar *VolumeMonitor, MountVar Mount) {
233 rawCallback(VolumeMonitorVar.GoPointer(), MountVar.GoPointer())
234 }
235}
236
237// OverrideDriveConnected sets the "drive_connected" callback function.
238func (x *VolumeMonitorClass) OverrideDriveConnected(cb func(*VolumeMonitor, Drive)) {
239 if cb == nil {
240 x.xDriveConnected = 0
241 } else {
242 x.xDriveConnected = purego.NewCallback(func(VolumeMonitorVarp uintptr, DriveVarp uintptr) {
243 cb(VolumeMonitorNewFromInternalPtr(VolumeMonitorVarp), &DriveBase{Ptr: DriveVarp})
244 })
245 }
246}
247
248// GetDriveConnected gets the "drive_connected" callback function.
249func (x *VolumeMonitorClass) GetDriveConnected() func(*VolumeMonitor, Drive) {
250 if x.xDriveConnected == 0 {
251 return nil
252 }
253 var rawCallback func(VolumeMonitorVarp uintptr, DriveVarp uintptr)
254 purego.RegisterFunc(&rawCallback, x.xDriveConnected)
255 return func(VolumeMonitorVar *VolumeMonitor, DriveVar Drive) {
256 rawCallback(VolumeMonitorVar.GoPointer(), DriveVar.GoPointer())
257 }
258}
259
260// OverrideDriveDisconnected sets the "drive_disconnected" callback function.
261func (x *VolumeMonitorClass) OverrideDriveDisconnected(cb func(*VolumeMonitor, Drive)) {
262 if cb == nil {
263 x.xDriveDisconnected = 0
264 } else {
265 x.xDriveDisconnected = purego.NewCallback(func(VolumeMonitorVarp uintptr, DriveVarp uintptr) {
266 cb(VolumeMonitorNewFromInternalPtr(VolumeMonitorVarp), &DriveBase{Ptr: DriveVarp})
267 })
268 }
269}
270
271// GetDriveDisconnected gets the "drive_disconnected" callback function.
272func (x *VolumeMonitorClass) GetDriveDisconnected() func(*VolumeMonitor, Drive) {
273 if x.xDriveDisconnected == 0 {
274 return nil
275 }
276 var rawCallback func(VolumeMonitorVarp uintptr, DriveVarp uintptr)
277 purego.RegisterFunc(&rawCallback, x.xDriveDisconnected)
278 return func(VolumeMonitorVar *VolumeMonitor, DriveVar Drive) {
279 rawCallback(VolumeMonitorVar.GoPointer(), DriveVar.GoPointer())
280 }
281}
282
283// OverrideDriveChanged sets the "drive_changed" callback function.
284func (x *VolumeMonitorClass) OverrideDriveChanged(cb func(*VolumeMonitor, Drive)) {
285 if cb == nil {
286 x.xDriveChanged = 0
287 } else {
288 x.xDriveChanged = purego.NewCallback(func(VolumeMonitorVarp uintptr, DriveVarp uintptr) {
289 cb(VolumeMonitorNewFromInternalPtr(VolumeMonitorVarp), &DriveBase{Ptr: DriveVarp})
290 })
291 }
292}
293
294// GetDriveChanged gets the "drive_changed" callback function.
295func (x *VolumeMonitorClass) GetDriveChanged() func(*VolumeMonitor, Drive) {
296 if x.xDriveChanged == 0 {
297 return nil
298 }
299 var rawCallback func(VolumeMonitorVarp uintptr, DriveVarp uintptr)
300 purego.RegisterFunc(&rawCallback, x.xDriveChanged)
301 return func(VolumeMonitorVar *VolumeMonitor, DriveVar Drive) {
302 rawCallback(VolumeMonitorVar.GoPointer(), DriveVar.GoPointer())
303 }
304}
305
306// OverrideIsSupported sets the "is_supported" callback function.
307func (x *VolumeMonitorClass) OverrideIsSupported(cb func() bool) {
308 if cb == nil {
309 x.xIsSupported = 0
310 } else {
311 x.xIsSupported = purego.NewCallback(func() bool {
312 return cb()
313 })
314 }
315}
316
317// GetIsSupported gets the "is_supported" callback function.
318func (x *VolumeMonitorClass) GetIsSupported() func() bool {
319 if x.xIsSupported == 0 {
320 return nil
321 }
322 var rawCallback func() bool
323 purego.RegisterFunc(&rawCallback, x.xIsSupported)
324 return func() bool {
325 return rawCallback()
326 }
327}
328
329// OverrideGetConnectedDrives sets the "get_connected_drives" callback function.
330func (x *VolumeMonitorClass) OverrideGetConnectedDrives(cb func(*VolumeMonitor) *glib.List) {
331 if cb == nil {
332 x.xGetConnectedDrives = 0
333 } else {
334 x.xGetConnectedDrives = purego.NewCallback(func(VolumeMonitorVarp uintptr) *glib.List {
335 return cb(VolumeMonitorNewFromInternalPtr(VolumeMonitorVarp))
336 })
337 }
338}
339
340// GetGetConnectedDrives gets the "get_connected_drives" callback function.
341func (x *VolumeMonitorClass) GetGetConnectedDrives() func(*VolumeMonitor) *glib.List {
342 if x.xGetConnectedDrives == 0 {
343 return nil
344 }
345 var rawCallback func(VolumeMonitorVarp uintptr) *glib.List
346 purego.RegisterFunc(&rawCallback, x.xGetConnectedDrives)
347 return func(VolumeMonitorVar *VolumeMonitor) *glib.List {
348 return rawCallback(VolumeMonitorVar.GoPointer())
349 }
350}
351
352// OverrideGetVolumes sets the "get_volumes" callback function.
353func (x *VolumeMonitorClass) OverrideGetVolumes(cb func(*VolumeMonitor) *glib.List) {
354 if cb == nil {
355 x.xGetVolumes = 0
356 } else {
357 x.xGetVolumes = purego.NewCallback(func(VolumeMonitorVarp uintptr) *glib.List {
358 return cb(VolumeMonitorNewFromInternalPtr(VolumeMonitorVarp))
359 })
360 }
361}
362
363// GetGetVolumes gets the "get_volumes" callback function.
364func (x *VolumeMonitorClass) GetGetVolumes() func(*VolumeMonitor) *glib.List {
365 if x.xGetVolumes == 0 {
366 return nil
367 }
368 var rawCallback func(VolumeMonitorVarp uintptr) *glib.List
369 purego.RegisterFunc(&rawCallback, x.xGetVolumes)
370 return func(VolumeMonitorVar *VolumeMonitor) *glib.List {
371 return rawCallback(VolumeMonitorVar.GoPointer())
372 }
373}
374
375// OverrideGetMounts sets the "get_mounts" callback function.
376func (x *VolumeMonitorClass) OverrideGetMounts(cb func(*VolumeMonitor) *glib.List) {
377 if cb == nil {
378 x.xGetMounts = 0
379 } else {
380 x.xGetMounts = purego.NewCallback(func(VolumeMonitorVarp uintptr) *glib.List {
381 return cb(VolumeMonitorNewFromInternalPtr(VolumeMonitorVarp))
382 })
383 }
384}
385
386// GetGetMounts gets the "get_mounts" callback function.
387func (x *VolumeMonitorClass) GetGetMounts() func(*VolumeMonitor) *glib.List {
388 if x.xGetMounts == 0 {
389 return nil
390 }
391 var rawCallback func(VolumeMonitorVarp uintptr) *glib.List
392 purego.RegisterFunc(&rawCallback, x.xGetMounts)
393 return func(VolumeMonitorVar *VolumeMonitor) *glib.List {
394 return rawCallback(VolumeMonitorVar.GoPointer())
395 }
396}
397
398// OverrideGetVolumeForUuid sets the "get_volume_for_uuid" callback function.
399func (x *VolumeMonitorClass) OverrideGetVolumeForUuid(cb func(*VolumeMonitor, string) *VolumeBase) {
400 if cb == nil {
401 x.xGetVolumeForUuid = 0
402 } else {
403 x.xGetVolumeForUuid = purego.NewCallback(func(VolumeMonitorVarp uintptr, UuidVarp string) uintptr {
404 ret := cb(VolumeMonitorNewFromInternalPtr(VolumeMonitorVarp), UuidVarp)
405 if ret == nil {
406 return 0
407 }
408 return ret.GoPointer()
409 })
410 }
411}
412
413// GetGetVolumeForUuid gets the "get_volume_for_uuid" callback function.
414func (x *VolumeMonitorClass) GetGetVolumeForUuid() func(*VolumeMonitor, string) *VolumeBase {
415 if x.xGetVolumeForUuid == 0 {
416 return nil
417 }
418 var rawCallback func(VolumeMonitorVarp uintptr, UuidVarp string) uintptr
419 purego.RegisterFunc(&rawCallback, x.xGetVolumeForUuid)
420 return func(VolumeMonitorVar *VolumeMonitor, UuidVar string) *VolumeBase {
421 rawRet := rawCallback(VolumeMonitorVar.GoPointer(), UuidVar)
422 if rawRet == 0 {
423 return nil
424 }
425 ret := &VolumeBase{}
426 ret.Ptr = rawRet
427 return ret
428 }
429}
430
431// OverrideGetMountForUuid sets the "get_mount_for_uuid" callback function.
432func (x *VolumeMonitorClass) OverrideGetMountForUuid(cb func(*VolumeMonitor, string) *MountBase) {
433 if cb == nil {
434 x.xGetMountForUuid = 0
435 } else {
436 x.xGetMountForUuid = purego.NewCallback(func(VolumeMonitorVarp uintptr, UuidVarp string) uintptr {
437 ret := cb(VolumeMonitorNewFromInternalPtr(VolumeMonitorVarp), UuidVarp)
438 if ret == nil {
439 return 0
440 }
441 return ret.GoPointer()
442 })
443 }
444}
445
446// GetGetMountForUuid gets the "get_mount_for_uuid" callback function.
447func (x *VolumeMonitorClass) GetGetMountForUuid() func(*VolumeMonitor, string) *MountBase {
448 if x.xGetMountForUuid == 0 {
449 return nil
450 }
451 var rawCallback func(VolumeMonitorVarp uintptr, UuidVarp string) uintptr
452 purego.RegisterFunc(&rawCallback, x.xGetMountForUuid)
453 return func(VolumeMonitorVar *VolumeMonitor, UuidVar string) *MountBase {
454 rawRet := rawCallback(VolumeMonitorVar.GoPointer(), UuidVar)
455 if rawRet == 0 {
456 return nil
457 }
458 ret := &MountBase{}
459 ret.Ptr = rawRet
460 return ret
461 }
462}
463
464// OverrideAdoptOrphanMount sets the "adopt_orphan_mount" callback function.
465func (x *VolumeMonitorClass) OverrideAdoptOrphanMount(cb func(Mount, *VolumeMonitor) *VolumeBase) {
466 if cb == nil {
467 x.xAdoptOrphanMount = 0
468 } else {
469 x.xAdoptOrphanMount = purego.NewCallback(func(MountVarp uintptr, VolumeMonitorVarp uintptr) uintptr {
470 ret := cb(&MountBase{Ptr: MountVarp}, VolumeMonitorNewFromInternalPtr(VolumeMonitorVarp))
471 if ret == nil {
472 return 0
473 }
474 return ret.GoPointer()
475 })
476 }
477}
478
479// GetAdoptOrphanMount gets the "adopt_orphan_mount" callback function.
480func (x *VolumeMonitorClass) GetAdoptOrphanMount() func(Mount, *VolumeMonitor) *VolumeBase {
481 if x.xAdoptOrphanMount == 0 {
482 return nil
483 }
484 var rawCallback func(MountVarp uintptr, VolumeMonitorVarp uintptr) uintptr
485 purego.RegisterFunc(&rawCallback, x.xAdoptOrphanMount)
486 return func(MountVar Mount, VolumeMonitorVar *VolumeMonitor) *VolumeBase {
487 rawRet := rawCallback(MountVar.GoPointer(), VolumeMonitorVar.GoPointer())
488 if rawRet == 0 {
489 return nil
490 }
491 ret := &VolumeBase{}
492 ret.Ptr = rawRet
493 return ret
494 }
495}
496
497// OverrideDriveEjectButton sets the "drive_eject_button" callback function.
498func (x *VolumeMonitorClass) OverrideDriveEjectButton(cb func(*VolumeMonitor, Drive)) {
499 if cb == nil {
500 x.xDriveEjectButton = 0
501 } else {
502 x.xDriveEjectButton = purego.NewCallback(func(VolumeMonitorVarp uintptr, DriveVarp uintptr) {
503 cb(VolumeMonitorNewFromInternalPtr(VolumeMonitorVarp), &DriveBase{Ptr: DriveVarp})
504 })
505 }
506}
507
508// GetDriveEjectButton gets the "drive_eject_button" callback function.
509func (x *VolumeMonitorClass) GetDriveEjectButton() func(*VolumeMonitor, Drive) {
510 if x.xDriveEjectButton == 0 {
511 return nil
512 }
513 var rawCallback func(VolumeMonitorVarp uintptr, DriveVarp uintptr)
514 purego.RegisterFunc(&rawCallback, x.xDriveEjectButton)
515 return func(VolumeMonitorVar *VolumeMonitor, DriveVar Drive) {
516 rawCallback(VolumeMonitorVar.GoPointer(), DriveVar.GoPointer())
517 }
518}
519
520// OverrideDriveStopButton sets the "drive_stop_button" callback function.
521func (x *VolumeMonitorClass) OverrideDriveStopButton(cb func(*VolumeMonitor, Drive)) {
522 if cb == nil {
523 x.xDriveStopButton = 0
524 } else {
525 x.xDriveStopButton = purego.NewCallback(func(VolumeMonitorVarp uintptr, DriveVarp uintptr) {
526 cb(VolumeMonitorNewFromInternalPtr(VolumeMonitorVarp), &DriveBase{Ptr: DriveVarp})
527 })
528 }
529}
530
531// GetDriveStopButton gets the "drive_stop_button" callback function.
532func (x *VolumeMonitorClass) GetDriveStopButton() func(*VolumeMonitor, Drive) {
533 if x.xDriveStopButton == 0 {
534 return nil
535 }
536 var rawCallback func(VolumeMonitorVarp uintptr, DriveVarp uintptr)
537 purego.RegisterFunc(&rawCallback, x.xDriveStopButton)
538 return func(VolumeMonitorVar *VolumeMonitor, DriveVar Drive) {
539 rawCallback(VolumeMonitorVar.GoPointer(), DriveVar.GoPointer())
540 }
541}
542
543// OverrideGReserved1 sets the "_g_reserved1" callback function.
544func (x *VolumeMonitorClass) OverrideGReserved1(cb func()) {
545 if cb == nil {
546 x.xGReserved1 = 0
547 } else {
548 x.xGReserved1 = purego.NewCallback(func() {
549 cb()
550 })
551 }
552}
553
554// GetGReserved1 gets the "_g_reserved1" callback function.
555func (x *VolumeMonitorClass) GetGReserved1() func() {
556 if x.xGReserved1 == 0 {
557 return nil
558 }
559 var rawCallback func()
560 purego.RegisterFunc(&rawCallback, x.xGReserved1)
561 return func() {
562 rawCallback()
563 }
564}
565
566// OverrideGReserved2 sets the "_g_reserved2" callback function.
567func (x *VolumeMonitorClass) OverrideGReserved2(cb func()) {
568 if cb == nil {
569 x.xGReserved2 = 0
570 } else {
571 x.xGReserved2 = purego.NewCallback(func() {
572 cb()
573 })
574 }
575}
576
577// GetGReserved2 gets the "_g_reserved2" callback function.
578func (x *VolumeMonitorClass) GetGReserved2() func() {
579 if x.xGReserved2 == 0 {
580 return nil
581 }
582 var rawCallback func()
583 purego.RegisterFunc(&rawCallback, x.xGReserved2)
584 return func() {
585 rawCallback()
586 }
587}
588
589// OverrideGReserved3 sets the "_g_reserved3" callback function.
590func (x *VolumeMonitorClass) OverrideGReserved3(cb func()) {
591 if cb == nil {
592 x.xGReserved3 = 0
593 } else {
594 x.xGReserved3 = purego.NewCallback(func() {
595 cb()
596 })
597 }
598}
599
600// GetGReserved3 gets the "_g_reserved3" callback function.
601func (x *VolumeMonitorClass) GetGReserved3() func() {
602 if x.xGReserved3 == 0 {
603 return nil
604 }
605 var rawCallback func()
606 purego.RegisterFunc(&rawCallback, x.xGReserved3)
607 return func() {
608 rawCallback()
609 }
610}
611
612// OverrideGReserved4 sets the "_g_reserved4" callback function.
613func (x *VolumeMonitorClass) OverrideGReserved4(cb func()) {
614 if cb == nil {
615 x.xGReserved4 = 0
616 } else {
617 x.xGReserved4 = purego.NewCallback(func() {
618 cb()
619 })
620 }
621}
622
623// GetGReserved4 gets the "_g_reserved4" callback function.
624func (x *VolumeMonitorClass) GetGReserved4() func() {
625 if x.xGReserved4 == 0 {
626 return nil
627 }
628 var rawCallback func()
629 purego.RegisterFunc(&rawCallback, x.xGReserved4)
630 return func() {
631 rawCallback()
632 }
633}
634
635// OverrideGReserved5 sets the "_g_reserved5" callback function.
636func (x *VolumeMonitorClass) OverrideGReserved5(cb func()) {
637 if cb == nil {
638 x.xGReserved5 = 0
639 } else {
640 x.xGReserved5 = purego.NewCallback(func() {
641 cb()
642 })
643 }
644}
645
646// GetGReserved5 gets the "_g_reserved5" callback function.
647func (x *VolumeMonitorClass) GetGReserved5() func() {
648 if x.xGReserved5 == 0 {
649 return nil
650 }
651 var rawCallback func()
652 purego.RegisterFunc(&rawCallback, x.xGReserved5)
653 return func() {
654 rawCallback()
655 }
656}
657
658// OverrideGReserved6 sets the "_g_reserved6" callback function.
659func (x *VolumeMonitorClass) OverrideGReserved6(cb func()) {
660 if cb == nil {
661 x.xGReserved6 = 0
662 } else {
663 x.xGReserved6 = purego.NewCallback(func() {
664 cb()
665 })
666 }
667}
668
669// GetGReserved6 gets the "_g_reserved6" callback function.
670func (x *VolumeMonitorClass) GetGReserved6() func() {
671 if x.xGReserved6 == 0 {
672 return nil
673 }
674 var rawCallback func()
675 purego.RegisterFunc(&rawCallback, x.xGReserved6)
676 return func() {
677 rawCallback()
678 }
679}
680
681const (
682 // Extension point for volume monitor functionality.
683 // See [Extending GIO](overview.html#extending-gio).
684 VOLUME_MONITOR_EXTENSION_POINT_NAME string = "gio-volume-monitor"
685)
686
687// `GVolumeMonitor` is for listing the user interesting devices and volumes
688// on the computer. In other words, what a file selector or file manager
689// would show in a sidebar.
690//
691// `GVolumeMonitor` is not
692// thread-default-context aware (see
693// [method@GLib.MainContext.push_thread_default]), and so should not be used
694// other than from the main thread, with no thread-default-context active.
695//
696// In order to receive updates about volumes and mounts monitored through GVFS,
697// a main loop must be running.
698type VolumeMonitor struct {
699 gobject.Object
700}
701
702var xVolumeMonitorGLibType func() types.GType
703
704func VolumeMonitorGLibType() types.GType {
705 return xVolumeMonitorGLibType()
706}
707
708func VolumeMonitorNewFromInternalPtr(ptr uintptr) *VolumeMonitor {
709 cls := &VolumeMonitor{}
710 cls.Ptr = ptr
711 return cls
712}
713
714var xVolumeMonitorGetConnectedDrives func(uintptr) *glib.List
715
716// Gets a list of drives connected to the system.
717//
718// The returned list should be freed with g_list_free(), after
719// its elements have been unreffed with g_object_unref().
720func (x *VolumeMonitor) GetConnectedDrives() *glib.List {
721
722 cret := xVolumeMonitorGetConnectedDrives(x.GoPointer())
723 return cret
724}
725
726var xVolumeMonitorGetMountForUuid func(uintptr, string) uintptr
727
728// Finds a #GMount object by its UUID (see g_mount_get_uuid())
729func (x *VolumeMonitor) GetMountForUuid(UuidVar string) *MountBase {
730 var cls *MountBase
731
732 cret := xVolumeMonitorGetMountForUuid(x.GoPointer(), UuidVar)
733
734 if cret == 0 {
735 return nil
736 }
737 cls = &MountBase{}
738 cls.Ptr = cret
739 return cls
740}
741
742var xVolumeMonitorGetMounts func(uintptr) *glib.List
743
744// Gets a list of the mounts on the system.
745//
746// The returned list should be freed with g_list_free(), after
747// its elements have been unreffed with g_object_unref().
748func (x *VolumeMonitor) GetMounts() *glib.List {
749
750 cret := xVolumeMonitorGetMounts(x.GoPointer())
751 return cret
752}
753
754var xVolumeMonitorGetVolumeForUuid func(uintptr, string) uintptr
755
756// Finds a #GVolume object by its UUID (see g_volume_get_uuid())
757func (x *VolumeMonitor) GetVolumeForUuid(UuidVar string) *VolumeBase {
758 var cls *VolumeBase
759
760 cret := xVolumeMonitorGetVolumeForUuid(x.GoPointer(), UuidVar)
761
762 if cret == 0 {
763 return nil
764 }
765 cls = &VolumeBase{}
766 cls.Ptr = cret
767 return cls
768}
769
770var xVolumeMonitorGetVolumes func(uintptr) *glib.List
771
772// Gets a list of the volumes on the system.
773//
774// The returned list should be freed with g_list_free(), after
775// its elements have been unreffed with g_object_unref().
776func (x *VolumeMonitor) GetVolumes() *glib.List {
777
778 cret := xVolumeMonitorGetVolumes(x.GoPointer())
779 return cret
780}
781
782func (c *VolumeMonitor) GoPointer() uintptr {
783 if c == nil {
784 return 0
785 }
786 return c.Ptr
787}
788
789func (c *VolumeMonitor) SetGoPointer(ptr uintptr) {
790 c.Ptr = ptr
791}
792
793// Emitted when a drive changes.
794func (x *VolumeMonitor) ConnectDriveChanged(cb *func(VolumeMonitor, uintptr)) uint {
795 cbPtr := uintptr(unsafe.Pointer(cb))
796 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
797 handlerID := gobject.SignalConnect(x.GoPointer(), "drive-changed", cbRefPtr)
798 glib.SaveHandlerMapping(handlerID, cbPtr)
799 return handlerID
800 }
801
802 fcb := func(clsPtr uintptr, DriveVarp uintptr) {
803 fa := VolumeMonitor{}
804 fa.Ptr = clsPtr
805 cbFn := *cb
806
807 cbFn(fa, DriveVarp)
808
809 }
810 cbRefPtr := purego.NewCallback(fcb)
811 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
812 handlerID := gobject.SignalConnect(x.GoPointer(), "drive-changed", cbRefPtr)
813 glib.SaveHandlerMapping(handlerID, cbPtr)
814 return handlerID
815}
816
817// Emitted when a drive is connected to the system.
818func (x *VolumeMonitor) ConnectDriveConnected(cb *func(VolumeMonitor, uintptr)) uint {
819 cbPtr := uintptr(unsafe.Pointer(cb))
820 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
821 handlerID := gobject.SignalConnect(x.GoPointer(), "drive-connected", cbRefPtr)
822 glib.SaveHandlerMapping(handlerID, cbPtr)
823 return handlerID
824 }
825
826 fcb := func(clsPtr uintptr, DriveVarp uintptr) {
827 fa := VolumeMonitor{}
828 fa.Ptr = clsPtr
829 cbFn := *cb
830
831 cbFn(fa, DriveVarp)
832
833 }
834 cbRefPtr := purego.NewCallback(fcb)
835 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
836 handlerID := gobject.SignalConnect(x.GoPointer(), "drive-connected", cbRefPtr)
837 glib.SaveHandlerMapping(handlerID, cbPtr)
838 return handlerID
839}
840
841// Emitted when a drive is disconnected from the system.
842func (x *VolumeMonitor) ConnectDriveDisconnected(cb *func(VolumeMonitor, uintptr)) uint {
843 cbPtr := uintptr(unsafe.Pointer(cb))
844 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
845 handlerID := gobject.SignalConnect(x.GoPointer(), "drive-disconnected", cbRefPtr)
846 glib.SaveHandlerMapping(handlerID, cbPtr)
847 return handlerID
848 }
849
850 fcb := func(clsPtr uintptr, DriveVarp uintptr) {
851 fa := VolumeMonitor{}
852 fa.Ptr = clsPtr
853 cbFn := *cb
854
855 cbFn(fa, DriveVarp)
856
857 }
858 cbRefPtr := purego.NewCallback(fcb)
859 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
860 handlerID := gobject.SignalConnect(x.GoPointer(), "drive-disconnected", cbRefPtr)
861 glib.SaveHandlerMapping(handlerID, cbPtr)
862 return handlerID
863}
864
865// Emitted when the eject button is pressed on @drive.
866func (x *VolumeMonitor) ConnectDriveEjectButton(cb *func(VolumeMonitor, uintptr)) uint {
867 cbPtr := uintptr(unsafe.Pointer(cb))
868 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
869 handlerID := gobject.SignalConnect(x.GoPointer(), "drive-eject-button", cbRefPtr)
870 glib.SaveHandlerMapping(handlerID, cbPtr)
871 return handlerID
872 }
873
874 fcb := func(clsPtr uintptr, DriveVarp uintptr) {
875 fa := VolumeMonitor{}
876 fa.Ptr = clsPtr
877 cbFn := *cb
878
879 cbFn(fa, DriveVarp)
880
881 }
882 cbRefPtr := purego.NewCallback(fcb)
883 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
884 handlerID := gobject.SignalConnect(x.GoPointer(), "drive-eject-button", cbRefPtr)
885 glib.SaveHandlerMapping(handlerID, cbPtr)
886 return handlerID
887}
888
889// Emitted when the stop button is pressed on @drive.
890func (x *VolumeMonitor) ConnectDriveStopButton(cb *func(VolumeMonitor, uintptr)) uint {
891 cbPtr := uintptr(unsafe.Pointer(cb))
892 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
893 handlerID := gobject.SignalConnect(x.GoPointer(), "drive-stop-button", cbRefPtr)
894 glib.SaveHandlerMapping(handlerID, cbPtr)
895 return handlerID
896 }
897
898 fcb := func(clsPtr uintptr, DriveVarp uintptr) {
899 fa := VolumeMonitor{}
900 fa.Ptr = clsPtr
901 cbFn := *cb
902
903 cbFn(fa, DriveVarp)
904
905 }
906 cbRefPtr := purego.NewCallback(fcb)
907 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
908 handlerID := gobject.SignalConnect(x.GoPointer(), "drive-stop-button", cbRefPtr)
909 glib.SaveHandlerMapping(handlerID, cbPtr)
910 return handlerID
911}
912
913// Emitted when a mount is added.
914func (x *VolumeMonitor) ConnectMountAdded(cb *func(VolumeMonitor, uintptr)) uint {
915 cbPtr := uintptr(unsafe.Pointer(cb))
916 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
917 handlerID := gobject.SignalConnect(x.GoPointer(), "mount-added", cbRefPtr)
918 glib.SaveHandlerMapping(handlerID, cbPtr)
919 return handlerID
920 }
921
922 fcb := func(clsPtr uintptr, MountVarp uintptr) {
923 fa := VolumeMonitor{}
924 fa.Ptr = clsPtr
925 cbFn := *cb
926
927 cbFn(fa, MountVarp)
928
929 }
930 cbRefPtr := purego.NewCallback(fcb)
931 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
932 handlerID := gobject.SignalConnect(x.GoPointer(), "mount-added", cbRefPtr)
933 glib.SaveHandlerMapping(handlerID, cbPtr)
934 return handlerID
935}
936
937// Emitted when a mount changes.
938func (x *VolumeMonitor) ConnectMountChanged(cb *func(VolumeMonitor, uintptr)) uint {
939 cbPtr := uintptr(unsafe.Pointer(cb))
940 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
941 handlerID := gobject.SignalConnect(x.GoPointer(), "mount-changed", cbRefPtr)
942 glib.SaveHandlerMapping(handlerID, cbPtr)
943 return handlerID
944 }
945
946 fcb := func(clsPtr uintptr, MountVarp uintptr) {
947 fa := VolumeMonitor{}
948 fa.Ptr = clsPtr
949 cbFn := *cb
950
951 cbFn(fa, MountVarp)
952
953 }
954 cbRefPtr := purego.NewCallback(fcb)
955 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
956 handlerID := gobject.SignalConnect(x.GoPointer(), "mount-changed", cbRefPtr)
957 glib.SaveHandlerMapping(handlerID, cbPtr)
958 return handlerID
959}
960
961// May be emitted when a mount is about to be removed.
962//
963// This signal depends on the backend and is only emitted if
964// GIO was used to unmount.
965func (x *VolumeMonitor) ConnectMountPreUnmount(cb *func(VolumeMonitor, uintptr)) uint {
966 cbPtr := uintptr(unsafe.Pointer(cb))
967 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
968 handlerID := gobject.SignalConnect(x.GoPointer(), "mount-pre-unmount", cbRefPtr)
969 glib.SaveHandlerMapping(handlerID, cbPtr)
970 return handlerID
971 }
972
973 fcb := func(clsPtr uintptr, MountVarp uintptr) {
974 fa := VolumeMonitor{}
975 fa.Ptr = clsPtr
976 cbFn := *cb
977
978 cbFn(fa, MountVarp)
979
980 }
981 cbRefPtr := purego.NewCallback(fcb)
982 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
983 handlerID := gobject.SignalConnect(x.GoPointer(), "mount-pre-unmount", cbRefPtr)
984 glib.SaveHandlerMapping(handlerID, cbPtr)
985 return handlerID
986}
987
988// Emitted when a mount is removed.
989func (x *VolumeMonitor) ConnectMountRemoved(cb *func(VolumeMonitor, uintptr)) uint {
990 cbPtr := uintptr(unsafe.Pointer(cb))
991 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
992 handlerID := gobject.SignalConnect(x.GoPointer(), "mount-removed", cbRefPtr)
993 glib.SaveHandlerMapping(handlerID, cbPtr)
994 return handlerID
995 }
996
997 fcb := func(clsPtr uintptr, MountVarp uintptr) {
998 fa := VolumeMonitor{}
999 fa.Ptr = clsPtr
1000 cbFn := *cb
1001
1002 cbFn(fa, MountVarp)
1003
1004 }
1005 cbRefPtr := purego.NewCallback(fcb)
1006 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
1007 handlerID := gobject.SignalConnect(x.GoPointer(), "mount-removed", cbRefPtr)
1008 glib.SaveHandlerMapping(handlerID, cbPtr)
1009 return handlerID
1010}
1011
1012// Emitted when a mountable volume is added to the system.
1013func (x *VolumeMonitor) ConnectVolumeAdded(cb *func(VolumeMonitor, uintptr)) uint {
1014 cbPtr := uintptr(unsafe.Pointer(cb))
1015 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
1016 handlerID := gobject.SignalConnect(x.GoPointer(), "volume-added", cbRefPtr)
1017 glib.SaveHandlerMapping(handlerID, cbPtr)
1018 return handlerID
1019 }
1020
1021 fcb := func(clsPtr uintptr, VolumeVarp uintptr) {
1022 fa := VolumeMonitor{}
1023 fa.Ptr = clsPtr
1024 cbFn := *cb
1025
1026 cbFn(fa, VolumeVarp)
1027
1028 }
1029 cbRefPtr := purego.NewCallback(fcb)
1030 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
1031 handlerID := gobject.SignalConnect(x.GoPointer(), "volume-added", cbRefPtr)
1032 glib.SaveHandlerMapping(handlerID, cbPtr)
1033 return handlerID
1034}
1035
1036// Emitted when mountable volume is changed.
1037func (x *VolumeMonitor) ConnectVolumeChanged(cb *func(VolumeMonitor, uintptr)) uint {
1038 cbPtr := uintptr(unsafe.Pointer(cb))
1039 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
1040 handlerID := gobject.SignalConnect(x.GoPointer(), "volume-changed", cbRefPtr)
1041 glib.SaveHandlerMapping(handlerID, cbPtr)
1042 return handlerID
1043 }
1044
1045 fcb := func(clsPtr uintptr, VolumeVarp uintptr) {
1046 fa := VolumeMonitor{}
1047 fa.Ptr = clsPtr
1048 cbFn := *cb
1049
1050 cbFn(fa, VolumeVarp)
1051
1052 }
1053 cbRefPtr := purego.NewCallback(fcb)
1054 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
1055 handlerID := gobject.SignalConnect(x.GoPointer(), "volume-changed", cbRefPtr)
1056 glib.SaveHandlerMapping(handlerID, cbPtr)
1057 return handlerID
1058}
1059
1060// Emitted when a mountable volume is removed from the system.
1061func (x *VolumeMonitor) ConnectVolumeRemoved(cb *func(VolumeMonitor, uintptr)) uint {
1062 cbPtr := uintptr(unsafe.Pointer(cb))
1063 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
1064 handlerID := gobject.SignalConnect(x.GoPointer(), "volume-removed", cbRefPtr)
1065 glib.SaveHandlerMapping(handlerID, cbPtr)
1066 return handlerID
1067 }
1068
1069 fcb := func(clsPtr uintptr, VolumeVarp uintptr) {
1070 fa := VolumeMonitor{}
1071 fa.Ptr = clsPtr
1072 cbFn := *cb
1073
1074 cbFn(fa, VolumeVarp)
1075
1076 }
1077 cbRefPtr := purego.NewCallback(fcb)
1078 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
1079 handlerID := gobject.SignalConnect(x.GoPointer(), "volume-removed", cbRefPtr)
1080 glib.SaveHandlerMapping(handlerID, cbPtr)
1081 return handlerID
1082}
1083
1084var xVolumeMonitorAdoptOrphanMount func(uintptr) uintptr
1085
1086// This function should be called by any #GVolumeMonitor
1087// implementation when a new #GMount object is created that is not
1088// associated with a #GVolume object. It must be called just before
1089// emitting the @mount_added signal.
1090//
1091// If the return value is not %NULL, the caller must associate the
1092// returned #GVolume object with the #GMount. This involves returning
1093// it in its g_mount_get_volume() implementation. The caller must
1094// also listen for the "removed" signal on the returned object
1095// and give up its reference when handling that signal
1096//
1097// Similarly, if implementing g_volume_monitor_adopt_orphan_mount(),
1098// the implementor must take a reference to @mount and return it in
1099// its g_volume_get_mount() implemented. Also, the implementor must
1100// listen for the "unmounted" signal on @mount and give up its
1101// reference upon handling that signal.
1102//
1103// There are two main use cases for this function.
1104//
1105// One is when implementing a user space file system driver that reads
1106// blocks of a block device that is already represented by the native
1107// volume monitor (for example a CD Audio file system driver). Such
1108// a driver will generate its own #GMount object that needs to be
1109// associated with the #GVolume object that represents the volume.
1110//
1111// The other is for implementing a #GVolumeMonitor whose sole purpose
1112// is to return #GVolume objects representing entries in the users
1113// "favorite servers" list or similar.
1114func VolumeMonitorAdoptOrphanMount(MountVar Mount) *VolumeBase {
1115 var cls *VolumeBase
1116
1117 cret := xVolumeMonitorAdoptOrphanMount(MountVar.GoPointer())
1118
1119 if cret == 0 {
1120 return nil
1121 }
1122 cls = &VolumeBase{}
1123 cls.Ptr = cret
1124 return cls
1125}
1126
1127var xVolumeMonitorGet func() uintptr
1128
1129// Gets the volume monitor used by gio.
1130func VolumeMonitorGet() *VolumeMonitor {
1131 var cls *VolumeMonitor
1132
1133 cret := xVolumeMonitorGet()
1134
1135 if cret == 0 {
1136 return nil
1137 }
1138 cls = &VolumeMonitor{}
1139 cls.Ptr = cret
1140 return cls
1141}
1142
1143func init() {
1144 core.SetPackageName("GIO", "gio-2.0")
1145 core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"})
1146 var libs []uintptr
1147 for _, libPath := range core.GetPaths("GIO") {
1148 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
1149 if err != nil {
1150 panic(err)
1151 }
1152 libs = append(libs, lib)
1153 }
1154
1155 core.PuregoSafeRegister(&xVolumeMonitorGLibType, libs, "g_volume_monitor_get_type")
1156
1157 core.PuregoSafeRegister(&xVolumeMonitorGetConnectedDrives, libs, "g_volume_monitor_get_connected_drives")
1158 core.PuregoSafeRegister(&xVolumeMonitorGetMountForUuid, libs, "g_volume_monitor_get_mount_for_uuid")
1159 core.PuregoSafeRegister(&xVolumeMonitorGetMounts, libs, "g_volume_monitor_get_mounts")
1160 core.PuregoSafeRegister(&xVolumeMonitorGetVolumeForUuid, libs, "g_volume_monitor_get_volume_for_uuid")
1161 core.PuregoSafeRegister(&xVolumeMonitorGetVolumes, libs, "g_volume_monitor_get_volumes")
1162
1163 core.PuregoSafeRegister(&xVolumeMonitorAdoptOrphanMount, libs, "g_volume_monitor_adopt_orphan_mount")
1164 core.PuregoSafeRegister(&xVolumeMonitorGet, libs, "g_volume_monitor_get")
1165
1166}