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 creating #GDrive implementations.
16type DriveIface struct {
17 _ structs.HostLayout
18
19 GIface uintptr
20
21 xChanged uintptr
22
23 xDisconnected uintptr
24
25 xEjectButton uintptr
26
27 xGetName uintptr
28
29 xGetIcon uintptr
30
31 xHasVolumes uintptr
32
33 xGetVolumes uintptr
34
35 xIsMediaRemovable uintptr
36
37 xHasMedia uintptr
38
39 xIsMediaCheckAutomatic uintptr
40
41 xCanEject uintptr
42
43 xCanPollForMedia uintptr
44
45 xEject uintptr
46
47 xEjectFinish uintptr
48
49 xPollForMedia uintptr
50
51 xPollForMediaFinish uintptr
52
53 xGetIdentifier uintptr
54
55 xEnumerateIdentifiers uintptr
56
57 xGetStartStopType uintptr
58
59 xCanStart uintptr
60
61 xCanStartDegraded uintptr
62
63 xStart uintptr
64
65 xStartFinish uintptr
66
67 xCanStop uintptr
68
69 xStop uintptr
70
71 xStopFinish uintptr
72
73 xStopButton uintptr
74
75 xEjectWithOperation uintptr
76
77 xEjectWithOperationFinish uintptr
78
79 xGetSortKey uintptr
80
81 xGetSymbolicIcon uintptr
82
83 xIsRemovable uintptr
84}
85
86func (x *DriveIface) GoPointer() uintptr {
87 return uintptr(unsafe.Pointer(x))
88}
89
90// OverrideChanged sets the "changed" callback function.
91// Signal emitted when the drive is changed.
92func (x *DriveIface) OverrideChanged(cb func(Drive)) {
93 if cb == nil {
94 x.xChanged = 0
95 } else {
96 x.xChanged = purego.NewCallback(func(DriveVarp uintptr) {
97 cb(&DriveBase{Ptr: DriveVarp})
98 })
99 }
100}
101
102// GetChanged gets the "changed" callback function.
103// Signal emitted when the drive is changed.
104func (x *DriveIface) GetChanged() func(Drive) {
105 if x.xChanged == 0 {
106 return nil
107 }
108 var rawCallback func(DriveVarp uintptr)
109 purego.RegisterFunc(&rawCallback, x.xChanged)
110 return func(DriveVar Drive) {
111 rawCallback(DriveVar.GoPointer())
112 }
113}
114
115// OverrideDisconnected sets the "disconnected" callback function.
116// The removed signal that is emitted when the #GDrive have been disconnected. If the recipient is holding references to the object they should release them so the object can be finalized.
117func (x *DriveIface) OverrideDisconnected(cb func(Drive)) {
118 if cb == nil {
119 x.xDisconnected = 0
120 } else {
121 x.xDisconnected = purego.NewCallback(func(DriveVarp uintptr) {
122 cb(&DriveBase{Ptr: DriveVarp})
123 })
124 }
125}
126
127// GetDisconnected gets the "disconnected" callback function.
128// The removed signal that is emitted when the #GDrive have been disconnected. If the recipient is holding references to the object they should release them so the object can be finalized.
129func (x *DriveIface) GetDisconnected() func(Drive) {
130 if x.xDisconnected == 0 {
131 return nil
132 }
133 var rawCallback func(DriveVarp uintptr)
134 purego.RegisterFunc(&rawCallback, x.xDisconnected)
135 return func(DriveVar Drive) {
136 rawCallback(DriveVar.GoPointer())
137 }
138}
139
140// OverrideEjectButton sets the "eject_button" callback function.
141// Signal emitted when the physical eject button (if any) of a drive have been pressed.
142func (x *DriveIface) OverrideEjectButton(cb func(Drive)) {
143 if cb == nil {
144 x.xEjectButton = 0
145 } else {
146 x.xEjectButton = purego.NewCallback(func(DriveVarp uintptr) {
147 cb(&DriveBase{Ptr: DriveVarp})
148 })
149 }
150}
151
152// GetEjectButton gets the "eject_button" callback function.
153// Signal emitted when the physical eject button (if any) of a drive have been pressed.
154func (x *DriveIface) GetEjectButton() func(Drive) {
155 if x.xEjectButton == 0 {
156 return nil
157 }
158 var rawCallback func(DriveVarp uintptr)
159 purego.RegisterFunc(&rawCallback, x.xEjectButton)
160 return func(DriveVar Drive) {
161 rawCallback(DriveVar.GoPointer())
162 }
163}
164
165// OverrideGetName sets the "get_name" callback function.
166// Returns the name for the given #GDrive.
167func (x *DriveIface) OverrideGetName(cb func(Drive) string) {
168 if cb == nil {
169 x.xGetName = 0
170 } else {
171 x.xGetName = purego.NewCallback(func(DriveVarp uintptr) string {
172 return cb(&DriveBase{Ptr: DriveVarp})
173 })
174 }
175}
176
177// GetGetName gets the "get_name" callback function.
178// Returns the name for the given #GDrive.
179func (x *DriveIface) GetGetName() func(Drive) string {
180 if x.xGetName == 0 {
181 return nil
182 }
183 var rawCallback func(DriveVarp uintptr) string
184 purego.RegisterFunc(&rawCallback, x.xGetName)
185 return func(DriveVar Drive) string {
186 return rawCallback(DriveVar.GoPointer())
187 }
188}
189
190// OverrideGetIcon sets the "get_icon" callback function.
191// Returns a #GIcon for the given #GDrive.
192func (x *DriveIface) OverrideGetIcon(cb func(Drive) *IconBase) {
193 if cb == nil {
194 x.xGetIcon = 0
195 } else {
196 x.xGetIcon = purego.NewCallback(func(DriveVarp uintptr) uintptr {
197 ret := cb(&DriveBase{Ptr: DriveVarp})
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// Returns a #GIcon for the given #GDrive.
208func (x *DriveIface) GetGetIcon() func(Drive) *IconBase {
209 if x.xGetIcon == 0 {
210 return nil
211 }
212 var rawCallback func(DriveVarp uintptr) uintptr
213 purego.RegisterFunc(&rawCallback, x.xGetIcon)
214 return func(DriveVar Drive) *IconBase {
215 rawRet := rawCallback(DriveVar.GoPointer())
216 if rawRet == 0 {
217 return nil
218 }
219 ret := &IconBase{}
220 ret.Ptr = rawRet
221 return ret
222 }
223}
224
225// OverrideHasVolumes sets the "has_volumes" callback function.
226// Returns %TRUE if the #GDrive has mountable volumes.
227func (x *DriveIface) OverrideHasVolumes(cb func(Drive) bool) {
228 if cb == nil {
229 x.xHasVolumes = 0
230 } else {
231 x.xHasVolumes = purego.NewCallback(func(DriveVarp uintptr) bool {
232 return cb(&DriveBase{Ptr: DriveVarp})
233 })
234 }
235}
236
237// GetHasVolumes gets the "has_volumes" callback function.
238// Returns %TRUE if the #GDrive has mountable volumes.
239func (x *DriveIface) GetHasVolumes() func(Drive) bool {
240 if x.xHasVolumes == 0 {
241 return nil
242 }
243 var rawCallback func(DriveVarp uintptr) bool
244 purego.RegisterFunc(&rawCallback, x.xHasVolumes)
245 return func(DriveVar Drive) bool {
246 return rawCallback(DriveVar.GoPointer())
247 }
248}
249
250// OverrideGetVolumes sets the "get_volumes" callback function.
251// Returns a list #GList of #GVolume for the #GDrive.
252func (x *DriveIface) OverrideGetVolumes(cb func(Drive) *glib.List) {
253 if cb == nil {
254 x.xGetVolumes = 0
255 } else {
256 x.xGetVolumes = purego.NewCallback(func(DriveVarp uintptr) *glib.List {
257 return cb(&DriveBase{Ptr: DriveVarp})
258 })
259 }
260}
261
262// GetGetVolumes gets the "get_volumes" callback function.
263// Returns a list #GList of #GVolume for the #GDrive.
264func (x *DriveIface) GetGetVolumes() func(Drive) *glib.List {
265 if x.xGetVolumes == 0 {
266 return nil
267 }
268 var rawCallback func(DriveVarp uintptr) *glib.List
269 purego.RegisterFunc(&rawCallback, x.xGetVolumes)
270 return func(DriveVar Drive) *glib.List {
271 return rawCallback(DriveVar.GoPointer())
272 }
273}
274
275// OverrideIsMediaRemovable sets the "is_media_removable" callback function.
276// Returns %TRUE if the #GDrive supports removal and insertion of media.
277func (x *DriveIface) OverrideIsMediaRemovable(cb func(Drive) bool) {
278 if cb == nil {
279 x.xIsMediaRemovable = 0
280 } else {
281 x.xIsMediaRemovable = purego.NewCallback(func(DriveVarp uintptr) bool {
282 return cb(&DriveBase{Ptr: DriveVarp})
283 })
284 }
285}
286
287// GetIsMediaRemovable gets the "is_media_removable" callback function.
288// Returns %TRUE if the #GDrive supports removal and insertion of media.
289func (x *DriveIface) GetIsMediaRemovable() func(Drive) bool {
290 if x.xIsMediaRemovable == 0 {
291 return nil
292 }
293 var rawCallback func(DriveVarp uintptr) bool
294 purego.RegisterFunc(&rawCallback, x.xIsMediaRemovable)
295 return func(DriveVar Drive) bool {
296 return rawCallback(DriveVar.GoPointer())
297 }
298}
299
300// OverrideHasMedia sets the "has_media" callback function.
301// Returns %TRUE if the #GDrive has media inserted.
302func (x *DriveIface) OverrideHasMedia(cb func(Drive) bool) {
303 if cb == nil {
304 x.xHasMedia = 0
305 } else {
306 x.xHasMedia = purego.NewCallback(func(DriveVarp uintptr) bool {
307 return cb(&DriveBase{Ptr: DriveVarp})
308 })
309 }
310}
311
312// GetHasMedia gets the "has_media" callback function.
313// Returns %TRUE if the #GDrive has media inserted.
314func (x *DriveIface) GetHasMedia() func(Drive) bool {
315 if x.xHasMedia == 0 {
316 return nil
317 }
318 var rawCallback func(DriveVarp uintptr) bool
319 purego.RegisterFunc(&rawCallback, x.xHasMedia)
320 return func(DriveVar Drive) bool {
321 return rawCallback(DriveVar.GoPointer())
322 }
323}
324
325// OverrideIsMediaCheckAutomatic sets the "is_media_check_automatic" callback function.
326// Returns %TRUE if the #GDrive is capable of automatically detecting media changes.
327func (x *DriveIface) OverrideIsMediaCheckAutomatic(cb func(Drive) bool) {
328 if cb == nil {
329 x.xIsMediaCheckAutomatic = 0
330 } else {
331 x.xIsMediaCheckAutomatic = purego.NewCallback(func(DriveVarp uintptr) bool {
332 return cb(&DriveBase{Ptr: DriveVarp})
333 })
334 }
335}
336
337// GetIsMediaCheckAutomatic gets the "is_media_check_automatic" callback function.
338// Returns %TRUE if the #GDrive is capable of automatically detecting media changes.
339func (x *DriveIface) GetIsMediaCheckAutomatic() func(Drive) bool {
340 if x.xIsMediaCheckAutomatic == 0 {
341 return nil
342 }
343 var rawCallback func(DriveVarp uintptr) bool
344 purego.RegisterFunc(&rawCallback, x.xIsMediaCheckAutomatic)
345 return func(DriveVar Drive) bool {
346 return rawCallback(DriveVar.GoPointer())
347 }
348}
349
350// OverrideCanEject sets the "can_eject" callback function.
351// Returns %TRUE if the #GDrive can eject media.
352func (x *DriveIface) OverrideCanEject(cb func(Drive) bool) {
353 if cb == nil {
354 x.xCanEject = 0
355 } else {
356 x.xCanEject = purego.NewCallback(func(DriveVarp uintptr) bool {
357 return cb(&DriveBase{Ptr: DriveVarp})
358 })
359 }
360}
361
362// GetCanEject gets the "can_eject" callback function.
363// Returns %TRUE if the #GDrive can eject media.
364func (x *DriveIface) GetCanEject() func(Drive) bool {
365 if x.xCanEject == 0 {
366 return nil
367 }
368 var rawCallback func(DriveVarp uintptr) bool
369 purego.RegisterFunc(&rawCallback, x.xCanEject)
370 return func(DriveVar Drive) bool {
371 return rawCallback(DriveVar.GoPointer())
372 }
373}
374
375// OverrideCanPollForMedia sets the "can_poll_for_media" callback function.
376// Returns %TRUE if the #GDrive is capable of manually polling for media change.
377func (x *DriveIface) OverrideCanPollForMedia(cb func(Drive) bool) {
378 if cb == nil {
379 x.xCanPollForMedia = 0
380 } else {
381 x.xCanPollForMedia = purego.NewCallback(func(DriveVarp uintptr) bool {
382 return cb(&DriveBase{Ptr: DriveVarp})
383 })
384 }
385}
386
387// GetCanPollForMedia gets the "can_poll_for_media" callback function.
388// Returns %TRUE if the #GDrive is capable of manually polling for media change.
389func (x *DriveIface) GetCanPollForMedia() func(Drive) bool {
390 if x.xCanPollForMedia == 0 {
391 return nil
392 }
393 var rawCallback func(DriveVarp uintptr) bool
394 purego.RegisterFunc(&rawCallback, x.xCanPollForMedia)
395 return func(DriveVar Drive) bool {
396 return rawCallback(DriveVar.GoPointer())
397 }
398}
399
400// OverrideEject sets the "eject" callback function.
401// Ejects a #GDrive.
402func (x *DriveIface) OverrideEject(cb func(Drive, MountUnmountFlags, *Cancellable, *AsyncReadyCallback, uintptr)) {
403 if cb == nil {
404 x.xEject = 0
405 } else {
406 x.xEject = purego.NewCallback(func(DriveVarp uintptr, FlagsVarp MountUnmountFlags, CancellableVarp uintptr, CallbackVarp uintptr, UserDataVarp uintptr) {
407 cb(&DriveBase{Ptr: DriveVarp}, FlagsVarp, CancellableNewFromInternalPtr(CancellableVarp), (*AsyncReadyCallback)(unsafe.Pointer(CallbackVarp)), UserDataVarp)
408 })
409 }
410}
411
412// GetEject gets the "eject" callback function.
413// Ejects a #GDrive.
414func (x *DriveIface) GetEject() func(Drive, MountUnmountFlags, *Cancellable, *AsyncReadyCallback, uintptr) {
415 if x.xEject == 0 {
416 return nil
417 }
418 var rawCallback func(DriveVarp uintptr, FlagsVarp MountUnmountFlags, CancellableVarp uintptr, CallbackVarp uintptr, UserDataVarp uintptr)
419 purego.RegisterFunc(&rawCallback, x.xEject)
420 return func(DriveVar Drive, FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
421 rawCallback(DriveVar.GoPointer(), FlagsVar, CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar)
422 }
423}
424
425// OverrideEjectFinish sets the "eject_finish" callback function.
426// Finishes an eject operation.
427func (x *DriveIface) OverrideEjectFinish(cb func(Drive, AsyncResult) bool) {
428 if cb == nil {
429 x.xEjectFinish = 0
430 } else {
431 x.xEjectFinish = purego.NewCallback(func(DriveVarp uintptr, ResultVarp uintptr) bool {
432 return cb(&DriveBase{Ptr: DriveVarp}, &AsyncResultBase{Ptr: ResultVarp})
433 })
434 }
435}
436
437// GetEjectFinish gets the "eject_finish" callback function.
438// Finishes an eject operation.
439func (x *DriveIface) GetEjectFinish() func(Drive, AsyncResult) bool {
440 if x.xEjectFinish == 0 {
441 return nil
442 }
443 var rawCallback func(DriveVarp uintptr, ResultVarp uintptr) bool
444 purego.RegisterFunc(&rawCallback, x.xEjectFinish)
445 return func(DriveVar Drive, ResultVar AsyncResult) bool {
446 return rawCallback(DriveVar.GoPointer(), ResultVar.GoPointer())
447 }
448}
449
450// OverridePollForMedia sets the "poll_for_media" callback function.
451// Poll for media insertion/removal on a #GDrive.
452func (x *DriveIface) OverridePollForMedia(cb func(Drive, *Cancellable, *AsyncReadyCallback, uintptr)) {
453 if cb == nil {
454 x.xPollForMedia = 0
455 } else {
456 x.xPollForMedia = purego.NewCallback(func(DriveVarp uintptr, CancellableVarp uintptr, CallbackVarp uintptr, UserDataVarp uintptr) {
457 cb(&DriveBase{Ptr: DriveVarp}, CancellableNewFromInternalPtr(CancellableVarp), (*AsyncReadyCallback)(unsafe.Pointer(CallbackVarp)), UserDataVarp)
458 })
459 }
460}
461
462// GetPollForMedia gets the "poll_for_media" callback function.
463// Poll for media insertion/removal on a #GDrive.
464func (x *DriveIface) GetPollForMedia() func(Drive, *Cancellable, *AsyncReadyCallback, uintptr) {
465 if x.xPollForMedia == 0 {
466 return nil
467 }
468 var rawCallback func(DriveVarp uintptr, CancellableVarp uintptr, CallbackVarp uintptr, UserDataVarp uintptr)
469 purego.RegisterFunc(&rawCallback, x.xPollForMedia)
470 return func(DriveVar Drive, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
471 rawCallback(DriveVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar)
472 }
473}
474
475// OverridePollForMediaFinish sets the "poll_for_media_finish" callback function.
476// Finishes a media poll operation.
477func (x *DriveIface) OverridePollForMediaFinish(cb func(Drive, AsyncResult) bool) {
478 if cb == nil {
479 x.xPollForMediaFinish = 0
480 } else {
481 x.xPollForMediaFinish = purego.NewCallback(func(DriveVarp uintptr, ResultVarp uintptr) bool {
482 return cb(&DriveBase{Ptr: DriveVarp}, &AsyncResultBase{Ptr: ResultVarp})
483 })
484 }
485}
486
487// GetPollForMediaFinish gets the "poll_for_media_finish" callback function.
488// Finishes a media poll operation.
489func (x *DriveIface) GetPollForMediaFinish() func(Drive, AsyncResult) bool {
490 if x.xPollForMediaFinish == 0 {
491 return nil
492 }
493 var rawCallback func(DriveVarp uintptr, ResultVarp uintptr) bool
494 purego.RegisterFunc(&rawCallback, x.xPollForMediaFinish)
495 return func(DriveVar Drive, ResultVar AsyncResult) bool {
496 return rawCallback(DriveVar.GoPointer(), ResultVar.GoPointer())
497 }
498}
499
500// OverrideGetIdentifier sets the "get_identifier" callback function.
501// Returns the identifier of the given kind, or %NULL if
502//
503// the #GDrive doesn't have one.
504func (x *DriveIface) OverrideGetIdentifier(cb func(Drive, string) string) {
505 if cb == nil {
506 x.xGetIdentifier = 0
507 } else {
508 x.xGetIdentifier = purego.NewCallback(func(DriveVarp uintptr, KindVarp string) string {
509 return cb(&DriveBase{Ptr: DriveVarp}, KindVarp)
510 })
511 }
512}
513
514// GetGetIdentifier gets the "get_identifier" callback function.
515// Returns the identifier of the given kind, or %NULL if
516//
517// the #GDrive doesn't have one.
518func (x *DriveIface) GetGetIdentifier() func(Drive, string) string {
519 if x.xGetIdentifier == 0 {
520 return nil
521 }
522 var rawCallback func(DriveVarp uintptr, KindVarp string) string
523 purego.RegisterFunc(&rawCallback, x.xGetIdentifier)
524 return func(DriveVar Drive, KindVar string) string {
525 return rawCallback(DriveVar.GoPointer(), KindVar)
526 }
527}
528
529// OverrideEnumerateIdentifiers sets the "enumerate_identifiers" callback function.
530// Returns an array strings listing the kinds
531//
532// of identifiers which the #GDrive has.
533func (x *DriveIface) OverrideEnumerateIdentifiers(cb func(Drive) []string) {
534 if cb == nil {
535 x.xEnumerateIdentifiers = 0
536 } else {
537 x.xEnumerateIdentifiers = purego.NewCallback(func(DriveVarp uintptr) []string {
538 return cb(&DriveBase{Ptr: DriveVarp})
539 })
540 }
541}
542
543// GetEnumerateIdentifiers gets the "enumerate_identifiers" callback function.
544// Returns an array strings listing the kinds
545//
546// of identifiers which the #GDrive has.
547func (x *DriveIface) GetEnumerateIdentifiers() func(Drive) []string {
548 if x.xEnumerateIdentifiers == 0 {
549 return nil
550 }
551 var rawCallback func(DriveVarp uintptr) []string
552 purego.RegisterFunc(&rawCallback, x.xEnumerateIdentifiers)
553 return func(DriveVar Drive) []string {
554 return rawCallback(DriveVar.GoPointer())
555 }
556}
557
558// OverrideGetStartStopType sets the "get_start_stop_type" callback function.
559// Gets a #GDriveStartStopType with details about starting/stopping the drive. Since 2.22.
560func (x *DriveIface) OverrideGetStartStopType(cb func(Drive) DriveStartStopType) {
561 if cb == nil {
562 x.xGetStartStopType = 0
563 } else {
564 x.xGetStartStopType = purego.NewCallback(func(DriveVarp uintptr) DriveStartStopType {
565 return cb(&DriveBase{Ptr: DriveVarp})
566 })
567 }
568}
569
570// GetGetStartStopType gets the "get_start_stop_type" callback function.
571// Gets a #GDriveStartStopType with details about starting/stopping the drive. Since 2.22.
572func (x *DriveIface) GetGetStartStopType() func(Drive) DriveStartStopType {
573 if x.xGetStartStopType == 0 {
574 return nil
575 }
576 var rawCallback func(DriveVarp uintptr) DriveStartStopType
577 purego.RegisterFunc(&rawCallback, x.xGetStartStopType)
578 return func(DriveVar Drive) DriveStartStopType {
579 return rawCallback(DriveVar.GoPointer())
580 }
581}
582
583// OverrideCanStart sets the "can_start" callback function.
584// Returns %TRUE if a #GDrive can be started. Since 2.22.
585func (x *DriveIface) OverrideCanStart(cb func(Drive) bool) {
586 if cb == nil {
587 x.xCanStart = 0
588 } else {
589 x.xCanStart = purego.NewCallback(func(DriveVarp uintptr) bool {
590 return cb(&DriveBase{Ptr: DriveVarp})
591 })
592 }
593}
594
595// GetCanStart gets the "can_start" callback function.
596// Returns %TRUE if a #GDrive can be started. Since 2.22.
597func (x *DriveIface) GetCanStart() func(Drive) bool {
598 if x.xCanStart == 0 {
599 return nil
600 }
601 var rawCallback func(DriveVarp uintptr) bool
602 purego.RegisterFunc(&rawCallback, x.xCanStart)
603 return func(DriveVar Drive) bool {
604 return rawCallback(DriveVar.GoPointer())
605 }
606}
607
608// OverrideCanStartDegraded sets the "can_start_degraded" callback function.
609// Returns %TRUE if a #GDrive can be started degraded. Since 2.22.
610func (x *DriveIface) OverrideCanStartDegraded(cb func(Drive) bool) {
611 if cb == nil {
612 x.xCanStartDegraded = 0
613 } else {
614 x.xCanStartDegraded = purego.NewCallback(func(DriveVarp uintptr) bool {
615 return cb(&DriveBase{Ptr: DriveVarp})
616 })
617 }
618}
619
620// GetCanStartDegraded gets the "can_start_degraded" callback function.
621// Returns %TRUE if a #GDrive can be started degraded. Since 2.22.
622func (x *DriveIface) GetCanStartDegraded() func(Drive) bool {
623 if x.xCanStartDegraded == 0 {
624 return nil
625 }
626 var rawCallback func(DriveVarp uintptr) bool
627 purego.RegisterFunc(&rawCallback, x.xCanStartDegraded)
628 return func(DriveVar Drive) bool {
629 return rawCallback(DriveVar.GoPointer())
630 }
631}
632
633// OverrideStart sets the "start" callback function.
634// Starts a #GDrive. Since 2.22.
635func (x *DriveIface) OverrideStart(cb func(Drive, DriveStartFlags, *MountOperation, *Cancellable, *AsyncReadyCallback, uintptr)) {
636 if cb == nil {
637 x.xStart = 0
638 } else {
639 x.xStart = purego.NewCallback(func(DriveVarp uintptr, FlagsVarp DriveStartFlags, MountOperationVarp uintptr, CancellableVarp uintptr, CallbackVarp uintptr, UserDataVarp uintptr) {
640 cb(&DriveBase{Ptr: DriveVarp}, FlagsVarp, MountOperationNewFromInternalPtr(MountOperationVarp), CancellableNewFromInternalPtr(CancellableVarp), (*AsyncReadyCallback)(unsafe.Pointer(CallbackVarp)), UserDataVarp)
641 })
642 }
643}
644
645// GetStart gets the "start" callback function.
646// Starts a #GDrive. Since 2.22.
647func (x *DriveIface) GetStart() func(Drive, DriveStartFlags, *MountOperation, *Cancellable, *AsyncReadyCallback, uintptr) {
648 if x.xStart == 0 {
649 return nil
650 }
651 var rawCallback func(DriveVarp uintptr, FlagsVarp DriveStartFlags, MountOperationVarp uintptr, CancellableVarp uintptr, CallbackVarp uintptr, UserDataVarp uintptr)
652 purego.RegisterFunc(&rawCallback, x.xStart)
653 return func(DriveVar Drive, FlagsVar DriveStartFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
654 rawCallback(DriveVar.GoPointer(), FlagsVar, MountOperationVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar)
655 }
656}
657
658// OverrideStartFinish sets the "start_finish" callback function.
659// Finishes a start operation. Since 2.22.
660func (x *DriveIface) OverrideStartFinish(cb func(Drive, AsyncResult) bool) {
661 if cb == nil {
662 x.xStartFinish = 0
663 } else {
664 x.xStartFinish = purego.NewCallback(func(DriveVarp uintptr, ResultVarp uintptr) bool {
665 return cb(&DriveBase{Ptr: DriveVarp}, &AsyncResultBase{Ptr: ResultVarp})
666 })
667 }
668}
669
670// GetStartFinish gets the "start_finish" callback function.
671// Finishes a start operation. Since 2.22.
672func (x *DriveIface) GetStartFinish() func(Drive, AsyncResult) bool {
673 if x.xStartFinish == 0 {
674 return nil
675 }
676 var rawCallback func(DriveVarp uintptr, ResultVarp uintptr) bool
677 purego.RegisterFunc(&rawCallback, x.xStartFinish)
678 return func(DriveVar Drive, ResultVar AsyncResult) bool {
679 return rawCallback(DriveVar.GoPointer(), ResultVar.GoPointer())
680 }
681}
682
683// OverrideCanStop sets the "can_stop" callback function.
684// Returns %TRUE if a #GDrive can be stopped. Since 2.22.
685func (x *DriveIface) OverrideCanStop(cb func(Drive) bool) {
686 if cb == nil {
687 x.xCanStop = 0
688 } else {
689 x.xCanStop = purego.NewCallback(func(DriveVarp uintptr) bool {
690 return cb(&DriveBase{Ptr: DriveVarp})
691 })
692 }
693}
694
695// GetCanStop gets the "can_stop" callback function.
696// Returns %TRUE if a #GDrive can be stopped. Since 2.22.
697func (x *DriveIface) GetCanStop() func(Drive) bool {
698 if x.xCanStop == 0 {
699 return nil
700 }
701 var rawCallback func(DriveVarp uintptr) bool
702 purego.RegisterFunc(&rawCallback, x.xCanStop)
703 return func(DriveVar Drive) bool {
704 return rawCallback(DriveVar.GoPointer())
705 }
706}
707
708// OverrideStop sets the "stop" callback function.
709// Stops a #GDrive. Since 2.22.
710func (x *DriveIface) OverrideStop(cb func(Drive, MountUnmountFlags, *MountOperation, *Cancellable, *AsyncReadyCallback, uintptr)) {
711 if cb == nil {
712 x.xStop = 0
713 } else {
714 x.xStop = purego.NewCallback(func(DriveVarp uintptr, FlagsVarp MountUnmountFlags, MountOperationVarp uintptr, CancellableVarp uintptr, CallbackVarp uintptr, UserDataVarp uintptr) {
715 cb(&DriveBase{Ptr: DriveVarp}, FlagsVarp, MountOperationNewFromInternalPtr(MountOperationVarp), CancellableNewFromInternalPtr(CancellableVarp), (*AsyncReadyCallback)(unsafe.Pointer(CallbackVarp)), UserDataVarp)
716 })
717 }
718}
719
720// GetStop gets the "stop" callback function.
721// Stops a #GDrive. Since 2.22.
722func (x *DriveIface) GetStop() func(Drive, MountUnmountFlags, *MountOperation, *Cancellable, *AsyncReadyCallback, uintptr) {
723 if x.xStop == 0 {
724 return nil
725 }
726 var rawCallback func(DriveVarp uintptr, FlagsVarp MountUnmountFlags, MountOperationVarp uintptr, CancellableVarp uintptr, CallbackVarp uintptr, UserDataVarp uintptr)
727 purego.RegisterFunc(&rawCallback, x.xStop)
728 return func(DriveVar Drive, FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
729 rawCallback(DriveVar.GoPointer(), FlagsVar, MountOperationVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar)
730 }
731}
732
733// OverrideStopFinish sets the "stop_finish" callback function.
734// Finishes a stop operation. Since 2.22.
735func (x *DriveIface) OverrideStopFinish(cb func(Drive, AsyncResult) bool) {
736 if cb == nil {
737 x.xStopFinish = 0
738 } else {
739 x.xStopFinish = purego.NewCallback(func(DriveVarp uintptr, ResultVarp uintptr) bool {
740 return cb(&DriveBase{Ptr: DriveVarp}, &AsyncResultBase{Ptr: ResultVarp})
741 })
742 }
743}
744
745// GetStopFinish gets the "stop_finish" callback function.
746// Finishes a stop operation. Since 2.22.
747func (x *DriveIface) GetStopFinish() func(Drive, AsyncResult) bool {
748 if x.xStopFinish == 0 {
749 return nil
750 }
751 var rawCallback func(DriveVarp uintptr, ResultVarp uintptr) bool
752 purego.RegisterFunc(&rawCallback, x.xStopFinish)
753 return func(DriveVar Drive, ResultVar AsyncResult) bool {
754 return rawCallback(DriveVar.GoPointer(), ResultVar.GoPointer())
755 }
756}
757
758// OverrideStopButton sets the "stop_button" callback function.
759// Signal emitted when the physical stop button (if any) of a drive have been pressed. Since 2.22.
760func (x *DriveIface) OverrideStopButton(cb func(Drive)) {
761 if cb == nil {
762 x.xStopButton = 0
763 } else {
764 x.xStopButton = purego.NewCallback(func(DriveVarp uintptr) {
765 cb(&DriveBase{Ptr: DriveVarp})
766 })
767 }
768}
769
770// GetStopButton gets the "stop_button" callback function.
771// Signal emitted when the physical stop button (if any) of a drive have been pressed. Since 2.22.
772func (x *DriveIface) GetStopButton() func(Drive) {
773 if x.xStopButton == 0 {
774 return nil
775 }
776 var rawCallback func(DriveVarp uintptr)
777 purego.RegisterFunc(&rawCallback, x.xStopButton)
778 return func(DriveVar Drive) {
779 rawCallback(DriveVar.GoPointer())
780 }
781}
782
783// OverrideEjectWithOperation sets the "eject_with_operation" callback function.
784// Starts ejecting a #GDrive using a #GMountOperation. Since 2.22.
785func (x *DriveIface) OverrideEjectWithOperation(cb func(Drive, MountUnmountFlags, *MountOperation, *Cancellable, *AsyncReadyCallback, uintptr)) {
786 if cb == nil {
787 x.xEjectWithOperation = 0
788 } else {
789 x.xEjectWithOperation = purego.NewCallback(func(DriveVarp uintptr, FlagsVarp MountUnmountFlags, MountOperationVarp uintptr, CancellableVarp uintptr, CallbackVarp uintptr, UserDataVarp uintptr) {
790 cb(&DriveBase{Ptr: DriveVarp}, FlagsVarp, MountOperationNewFromInternalPtr(MountOperationVarp), CancellableNewFromInternalPtr(CancellableVarp), (*AsyncReadyCallback)(unsafe.Pointer(CallbackVarp)), UserDataVarp)
791 })
792 }
793}
794
795// GetEjectWithOperation gets the "eject_with_operation" callback function.
796// Starts ejecting a #GDrive using a #GMountOperation. Since 2.22.
797func (x *DriveIface) GetEjectWithOperation() func(Drive, MountUnmountFlags, *MountOperation, *Cancellable, *AsyncReadyCallback, uintptr) {
798 if x.xEjectWithOperation == 0 {
799 return nil
800 }
801 var rawCallback func(DriveVarp uintptr, FlagsVarp MountUnmountFlags, MountOperationVarp uintptr, CancellableVarp uintptr, CallbackVarp uintptr, UserDataVarp uintptr)
802 purego.RegisterFunc(&rawCallback, x.xEjectWithOperation)
803 return func(DriveVar Drive, FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
804 rawCallback(DriveVar.GoPointer(), FlagsVar, MountOperationVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar)
805 }
806}
807
808// OverrideEjectWithOperationFinish sets the "eject_with_operation_finish" callback function.
809// Finishes an eject operation using a #GMountOperation. Since 2.22.
810func (x *DriveIface) OverrideEjectWithOperationFinish(cb func(Drive, AsyncResult) bool) {
811 if cb == nil {
812 x.xEjectWithOperationFinish = 0
813 } else {
814 x.xEjectWithOperationFinish = purego.NewCallback(func(DriveVarp uintptr, ResultVarp uintptr) bool {
815 return cb(&DriveBase{Ptr: DriveVarp}, &AsyncResultBase{Ptr: ResultVarp})
816 })
817 }
818}
819
820// GetEjectWithOperationFinish gets the "eject_with_operation_finish" callback function.
821// Finishes an eject operation using a #GMountOperation. Since 2.22.
822func (x *DriveIface) GetEjectWithOperationFinish() func(Drive, AsyncResult) bool {
823 if x.xEjectWithOperationFinish == 0 {
824 return nil
825 }
826 var rawCallback func(DriveVarp uintptr, ResultVarp uintptr) bool
827 purego.RegisterFunc(&rawCallback, x.xEjectWithOperationFinish)
828 return func(DriveVar Drive, ResultVar AsyncResult) bool {
829 return rawCallback(DriveVar.GoPointer(), ResultVar.GoPointer())
830 }
831}
832
833// OverrideGetSortKey sets the "get_sort_key" callback function.
834// Gets a key used for sorting #GDrive instances or %NULL if no such key exists. Since 2.32.
835func (x *DriveIface) OverrideGetSortKey(cb func(Drive) string) {
836 if cb == nil {
837 x.xGetSortKey = 0
838 } else {
839 x.xGetSortKey = purego.NewCallback(func(DriveVarp uintptr) string {
840 return cb(&DriveBase{Ptr: DriveVarp})
841 })
842 }
843}
844
845// GetGetSortKey gets the "get_sort_key" callback function.
846// Gets a key used for sorting #GDrive instances or %NULL if no such key exists. Since 2.32.
847func (x *DriveIface) GetGetSortKey() func(Drive) string {
848 if x.xGetSortKey == 0 {
849 return nil
850 }
851 var rawCallback func(DriveVarp uintptr) string
852 purego.RegisterFunc(&rawCallback, x.xGetSortKey)
853 return func(DriveVar Drive) string {
854 return rawCallback(DriveVar.GoPointer())
855 }
856}
857
858// OverrideGetSymbolicIcon sets the "get_symbolic_icon" callback function.
859// Returns a symbolic #GIcon for the given #GDrive. Since 2.34.
860func (x *DriveIface) OverrideGetSymbolicIcon(cb func(Drive) *IconBase) {
861 if cb == nil {
862 x.xGetSymbolicIcon = 0
863 } else {
864 x.xGetSymbolicIcon = purego.NewCallback(func(DriveVarp uintptr) uintptr {
865 ret := cb(&DriveBase{Ptr: DriveVarp})
866 if ret == nil {
867 return 0
868 }
869 return ret.GoPointer()
870 })
871 }
872}
873
874// GetGetSymbolicIcon gets the "get_symbolic_icon" callback function.
875// Returns a symbolic #GIcon for the given #GDrive. Since 2.34.
876func (x *DriveIface) GetGetSymbolicIcon() func(Drive) *IconBase {
877 if x.xGetSymbolicIcon == 0 {
878 return nil
879 }
880 var rawCallback func(DriveVarp uintptr) uintptr
881 purego.RegisterFunc(&rawCallback, x.xGetSymbolicIcon)
882 return func(DriveVar Drive) *IconBase {
883 rawRet := rawCallback(DriveVar.GoPointer())
884 if rawRet == 0 {
885 return nil
886 }
887 ret := &IconBase{}
888 ret.Ptr = rawRet
889 return ret
890 }
891}
892
893// OverrideIsRemovable sets the "is_removable" callback function.
894// Returns %TRUE if the #GDrive and/or its media is considered removable by the user. Since 2.50.
895func (x *DriveIface) OverrideIsRemovable(cb func(Drive) bool) {
896 if cb == nil {
897 x.xIsRemovable = 0
898 } else {
899 x.xIsRemovable = purego.NewCallback(func(DriveVarp uintptr) bool {
900 return cb(&DriveBase{Ptr: DriveVarp})
901 })
902 }
903}
904
905// GetIsRemovable gets the "is_removable" callback function.
906// Returns %TRUE if the #GDrive and/or its media is considered removable by the user. Since 2.50.
907func (x *DriveIface) GetIsRemovable() func(Drive) bool {
908 if x.xIsRemovable == 0 {
909 return nil
910 }
911 var rawCallback func(DriveVarp uintptr) bool
912 purego.RegisterFunc(&rawCallback, x.xIsRemovable)
913 return func(DriveVar Drive) bool {
914 return rawCallback(DriveVar.GoPointer())
915 }
916}
917
918// `GDrive` represents a piece of hardware connected to the machine.
919// It’s generally only created for removable hardware or hardware with
920// removable media. For example, an optical disc drive, or a USB flash drive.
921//
922// `GDrive` is a container class for [iface@Gio.Volume] objects that stem from
923// the same piece of media. As such, `GDrive` abstracts a drive with
924// (or without) removable media and provides operations for querying
925// whether media is available, determining whether media change is
926// automatically detected and ejecting the media.
927//
928// If the `GDrive` reports that media isn’t automatically detected, one
929// can poll for media; typically one should not do this periodically
930// as a poll for media operation is potentially expensive and may
931// spin up the drive creating noise.
932//
933// `GDrive` supports starting and stopping drives with authentication
934// support for the former. This can be used to support a diverse set
935// of use cases including connecting/disconnecting iSCSI devices,
936// powering down external disk enclosures and starting/stopping
937// multi-disk devices such as RAID devices. Note that the actual
938// semantics and side-effects of starting/stopping a `GDrive` may vary
939// according to implementation. To choose the correct verbs in e.g. a
940// file manager, use [method@Gio.Drive.get_start_stop_type].
941//
942// For [porting from GnomeVFS](migrating-gnome-vfs.html) note that there is no
943// equivalent of `GDrive` in that API.
944type Drive interface {
945 GoPointer() uintptr
946 SetGoPointer(uintptr)
947 CanEject() bool
948 CanPollForMedia() bool
949 CanStart() bool
950 CanStartDegraded() bool
951 CanStop() bool
952 Eject(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
953 EjectFinish(ResultVar AsyncResult) (bool, error)
954 EjectWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
955 EjectWithOperationFinish(ResultVar AsyncResult) (bool, error)
956 EnumerateIdentifiers() []string
957 GetIcon() *IconBase
958 GetIdentifier(KindVar string) string
959 GetName() string
960 GetSortKey() string
961 GetStartStopType() DriveStartStopType
962 GetSymbolicIcon() *IconBase
963 GetVolumes() *glib.List
964 HasMedia() bool
965 HasVolumes() bool
966 IsMediaCheckAutomatic() bool
967 IsMediaRemovable() bool
968 IsRemovable() bool
969 PollForMedia(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
970 PollForMediaFinish(ResultVar AsyncResult) (bool, error)
971 Start(FlagsVar DriveStartFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
972 StartFinish(ResultVar AsyncResult) (bool, error)
973 Stop(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
974 StopFinish(ResultVar AsyncResult) (bool, error)
975}
976
977var xDriveGLibType func() types.GType
978
979func DriveGLibType() types.GType {
980 return xDriveGLibType()
981}
982
983type DriveBase struct {
984 Ptr uintptr
985}
986
987func (x *DriveBase) GoPointer() uintptr {
988 if x == nil {
989 return 0
990 }
991 return x.Ptr
992}
993
994func (x *DriveBase) SetGoPointer(ptr uintptr) {
995 x.Ptr = ptr
996}
997
998// Checks if a drive can be ejected.
999func (x *DriveBase) CanEject() bool {
1000
1001 cret := XGDriveCanEject(x.GoPointer())
1002 return cret
1003}
1004
1005// Checks if a drive can be polled for media changes.
1006func (x *DriveBase) CanPollForMedia() bool {
1007
1008 cret := XGDriveCanPollForMedia(x.GoPointer())
1009 return cret
1010}
1011
1012// Checks if a drive can be started.
1013func (x *DriveBase) CanStart() bool {
1014
1015 cret := XGDriveCanStart(x.GoPointer())
1016 return cret
1017}
1018
1019// Checks if a drive can be started degraded.
1020func (x *DriveBase) CanStartDegraded() bool {
1021
1022 cret := XGDriveCanStartDegraded(x.GoPointer())
1023 return cret
1024}
1025
1026// Checks if a drive can be stopped.
1027func (x *DriveBase) CanStop() bool {
1028
1029 cret := XGDriveCanStop(x.GoPointer())
1030 return cret
1031}
1032
1033// Asynchronously ejects a drive.
1034//
1035// When the operation is finished, @callback will be called.
1036// You can then call g_drive_eject_finish() to obtain the
1037// result of the operation.
1038func (x *DriveBase) Eject(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
1039
1040 XGDriveEject(x.GoPointer(), FlagsVar, CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar)
1041
1042}
1043
1044// Finishes ejecting a drive.
1045func (x *DriveBase) EjectFinish(ResultVar AsyncResult) (bool, error) {
1046 var cerr *glib.Error
1047
1048 cret := XGDriveEjectFinish(x.GoPointer(), ResultVar.GoPointer(), &cerr)
1049 if cerr == nil {
1050 return cret, nil
1051 }
1052 return cret, cerr
1053
1054}
1055
1056// Ejects a drive. This is an asynchronous operation, and is
1057// finished by calling g_drive_eject_with_operation_finish() with the @drive
1058// and #GAsyncResult data returned in the @callback.
1059func (x *DriveBase) EjectWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
1060
1061 XGDriveEjectWithOperation(x.GoPointer(), FlagsVar, MountOperationVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar)
1062
1063}
1064
1065// Finishes ejecting a drive. If any errors occurred during the operation,
1066// @error will be set to contain the errors and %FALSE will be returned.
1067func (x *DriveBase) EjectWithOperationFinish(ResultVar AsyncResult) (bool, error) {
1068 var cerr *glib.Error
1069
1070 cret := XGDriveEjectWithOperationFinish(x.GoPointer(), ResultVar.GoPointer(), &cerr)
1071 if cerr == nil {
1072 return cret, nil
1073 }
1074 return cret, cerr
1075
1076}
1077
1078// Gets the kinds of identifiers that @drive has.
1079// Use g_drive_get_identifier() to obtain the identifiers
1080// themselves.
1081func (x *DriveBase) EnumerateIdentifiers() []string {
1082
1083 cret := XGDriveEnumerateIdentifiers(x.GoPointer())
1084 return cret
1085}
1086
1087// Gets the icon for @drive.
1088func (x *DriveBase) GetIcon() *IconBase {
1089 var cls *IconBase
1090
1091 cret := XGDriveGetIcon(x.GoPointer())
1092
1093 if cret == 0 {
1094 return nil
1095 }
1096 cls = &IconBase{}
1097 cls.Ptr = cret
1098 return cls
1099}
1100
1101// Gets the identifier of the given kind for @drive. The only
1102// identifier currently available is
1103// %G_DRIVE_IDENTIFIER_KIND_UNIX_DEVICE.
1104func (x *DriveBase) GetIdentifier(KindVar string) string {
1105
1106 cret := XGDriveGetIdentifier(x.GoPointer(), KindVar)
1107 return cret
1108}
1109
1110// Gets the name of @drive.
1111func (x *DriveBase) GetName() string {
1112
1113 cret := XGDriveGetName(x.GoPointer())
1114 return cret
1115}
1116
1117// Gets the sort key for @drive, if any.
1118func (x *DriveBase) GetSortKey() string {
1119
1120 cret := XGDriveGetSortKey(x.GoPointer())
1121 return cret
1122}
1123
1124// Gets a hint about how a drive can be started/stopped.
1125func (x *DriveBase) GetStartStopType() DriveStartStopType {
1126
1127 cret := XGDriveGetStartStopType(x.GoPointer())
1128 return cret
1129}
1130
1131// Gets the icon for @drive.
1132func (x *DriveBase) GetSymbolicIcon() *IconBase {
1133 var cls *IconBase
1134
1135 cret := XGDriveGetSymbolicIcon(x.GoPointer())
1136
1137 if cret == 0 {
1138 return nil
1139 }
1140 cls = &IconBase{}
1141 cls.Ptr = cret
1142 return cls
1143}
1144
1145// Get a list of mountable volumes for @drive.
1146//
1147// The returned list should be freed with g_list_free(), after
1148// its elements have been unreffed with g_object_unref().
1149func (x *DriveBase) GetVolumes() *glib.List {
1150
1151 cret := XGDriveGetVolumes(x.GoPointer())
1152 return cret
1153}
1154
1155// Checks if the @drive has media. Note that the OS may not be polling
1156// the drive for media changes; see g_drive_is_media_check_automatic()
1157// for more details.
1158func (x *DriveBase) HasMedia() bool {
1159
1160 cret := XGDriveHasMedia(x.GoPointer())
1161 return cret
1162}
1163
1164// Check if @drive has any mountable volumes.
1165func (x *DriveBase) HasVolumes() bool {
1166
1167 cret := XGDriveHasVolumes(x.GoPointer())
1168 return cret
1169}
1170
1171// Checks if @drive is capable of automatically detecting media changes.
1172func (x *DriveBase) IsMediaCheckAutomatic() bool {
1173
1174 cret := XGDriveIsMediaCheckAutomatic(x.GoPointer())
1175 return cret
1176}
1177
1178// Checks if the @drive supports removable media.
1179func (x *DriveBase) IsMediaRemovable() bool {
1180
1181 cret := XGDriveIsMediaRemovable(x.GoPointer())
1182 return cret
1183}
1184
1185// Checks if the #GDrive and/or its media is considered removable by the user.
1186// See g_drive_is_media_removable().
1187func (x *DriveBase) IsRemovable() bool {
1188
1189 cret := XGDriveIsRemovable(x.GoPointer())
1190 return cret
1191}
1192
1193// Asynchronously polls @drive to see if media has been inserted or removed.
1194//
1195// When the operation is finished, @callback will be called.
1196// You can then call g_drive_poll_for_media_finish() to obtain the
1197// result of the operation.
1198func (x *DriveBase) PollForMedia(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
1199
1200 XGDrivePollForMedia(x.GoPointer(), CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar)
1201
1202}
1203
1204// Finishes an operation started with g_drive_poll_for_media() on a drive.
1205func (x *DriveBase) PollForMediaFinish(ResultVar AsyncResult) (bool, error) {
1206 var cerr *glib.Error
1207
1208 cret := XGDrivePollForMediaFinish(x.GoPointer(), ResultVar.GoPointer(), &cerr)
1209 if cerr == nil {
1210 return cret, nil
1211 }
1212 return cret, cerr
1213
1214}
1215
1216// Asynchronously starts a drive.
1217//
1218// When the operation is finished, @callback will be called.
1219// You can then call g_drive_start_finish() to obtain the
1220// result of the operation.
1221func (x *DriveBase) Start(FlagsVar DriveStartFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
1222
1223 XGDriveStart(x.GoPointer(), FlagsVar, MountOperationVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar)
1224
1225}
1226
1227// Finishes starting a drive.
1228func (x *DriveBase) StartFinish(ResultVar AsyncResult) (bool, error) {
1229 var cerr *glib.Error
1230
1231 cret := XGDriveStartFinish(x.GoPointer(), ResultVar.GoPointer(), &cerr)
1232 if cerr == nil {
1233 return cret, nil
1234 }
1235 return cret, cerr
1236
1237}
1238
1239// Asynchronously stops a drive.
1240//
1241// When the operation is finished, @callback will be called.
1242// You can then call g_drive_stop_finish() to obtain the
1243// result of the operation.
1244func (x *DriveBase) Stop(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
1245
1246 XGDriveStop(x.GoPointer(), FlagsVar, MountOperationVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar)
1247
1248}
1249
1250// Finishes stopping a drive.
1251func (x *DriveBase) StopFinish(ResultVar AsyncResult) (bool, error) {
1252 var cerr *glib.Error
1253
1254 cret := XGDriveStopFinish(x.GoPointer(), ResultVar.GoPointer(), &cerr)
1255 if cerr == nil {
1256 return cret, nil
1257 }
1258 return cret, cerr
1259
1260}
1261
1262var XGDriveCanEject func(uintptr) bool
1263var XGDriveCanPollForMedia func(uintptr) bool
1264var XGDriveCanStart func(uintptr) bool
1265var XGDriveCanStartDegraded func(uintptr) bool
1266var XGDriveCanStop func(uintptr) bool
1267var XGDriveEject func(uintptr, MountUnmountFlags, uintptr, uintptr, uintptr)
1268var XGDriveEjectFinish func(uintptr, uintptr, **glib.Error) bool
1269var XGDriveEjectWithOperation func(uintptr, MountUnmountFlags, uintptr, uintptr, uintptr, uintptr)
1270var XGDriveEjectWithOperationFinish func(uintptr, uintptr, **glib.Error) bool
1271var XGDriveEnumerateIdentifiers func(uintptr) []string
1272var XGDriveGetIcon func(uintptr) uintptr
1273var XGDriveGetIdentifier func(uintptr, string) string
1274var XGDriveGetName func(uintptr) string
1275var XGDriveGetSortKey func(uintptr) string
1276var XGDriveGetStartStopType func(uintptr) DriveStartStopType
1277var XGDriveGetSymbolicIcon func(uintptr) uintptr
1278var XGDriveGetVolumes func(uintptr) *glib.List
1279var XGDriveHasMedia func(uintptr) bool
1280var XGDriveHasVolumes func(uintptr) bool
1281var XGDriveIsMediaCheckAutomatic func(uintptr) bool
1282var XGDriveIsMediaRemovable func(uintptr) bool
1283var XGDriveIsRemovable func(uintptr) bool
1284var XGDrivePollForMedia func(uintptr, uintptr, uintptr, uintptr)
1285var XGDrivePollForMediaFinish func(uintptr, uintptr, **glib.Error) bool
1286var XGDriveStart func(uintptr, DriveStartFlags, uintptr, uintptr, uintptr, uintptr)
1287var XGDriveStartFinish func(uintptr, uintptr, **glib.Error) bool
1288var XGDriveStop func(uintptr, MountUnmountFlags, uintptr, uintptr, uintptr, uintptr)
1289var XGDriveStopFinish func(uintptr, uintptr, **glib.Error) bool
1290
1291const (
1292 // The string used to obtain a Unix device path with g_drive_get_identifier().
1293 DRIVE_IDENTIFIER_KIND_UNIX_DEVICE string = "unix-device"
1294)
1295
1296func init() {
1297 core.SetPackageName("GIO", "gio-2.0")
1298 core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"})
1299 var libs []uintptr
1300 for _, libPath := range core.GetPaths("GIO") {
1301 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
1302 if err != nil {
1303 panic(err)
1304 }
1305 libs = append(libs, lib)
1306 }
1307
1308 core.PuregoSafeRegister(&xDriveGLibType, libs, "g_drive_get_type")
1309
1310 core.PuregoSafeRegister(&XGDriveCanEject, libs, "g_drive_can_eject")
1311 core.PuregoSafeRegister(&XGDriveCanPollForMedia, libs, "g_drive_can_poll_for_media")
1312 core.PuregoSafeRegister(&XGDriveCanStart, libs, "g_drive_can_start")
1313 core.PuregoSafeRegister(&XGDriveCanStartDegraded, libs, "g_drive_can_start_degraded")
1314 core.PuregoSafeRegister(&XGDriveCanStop, libs, "g_drive_can_stop")
1315 core.PuregoSafeRegister(&XGDriveEject, libs, "g_drive_eject")
1316 core.PuregoSafeRegister(&XGDriveEjectFinish, libs, "g_drive_eject_finish")
1317 core.PuregoSafeRegister(&XGDriveEjectWithOperation, libs, "g_drive_eject_with_operation")
1318 core.PuregoSafeRegister(&XGDriveEjectWithOperationFinish, libs, "g_drive_eject_with_operation_finish")
1319 core.PuregoSafeRegister(&XGDriveEnumerateIdentifiers, libs, "g_drive_enumerate_identifiers")
1320 core.PuregoSafeRegister(&XGDriveGetIcon, libs, "g_drive_get_icon")
1321 core.PuregoSafeRegister(&XGDriveGetIdentifier, libs, "g_drive_get_identifier")
1322 core.PuregoSafeRegister(&XGDriveGetName, libs, "g_drive_get_name")
1323 core.PuregoSafeRegister(&XGDriveGetSortKey, libs, "g_drive_get_sort_key")
1324 core.PuregoSafeRegister(&XGDriveGetStartStopType, libs, "g_drive_get_start_stop_type")
1325 core.PuregoSafeRegister(&XGDriveGetSymbolicIcon, libs, "g_drive_get_symbolic_icon")
1326 core.PuregoSafeRegister(&XGDriveGetVolumes, libs, "g_drive_get_volumes")
1327 core.PuregoSafeRegister(&XGDriveHasMedia, libs, "g_drive_has_media")
1328 core.PuregoSafeRegister(&XGDriveHasVolumes, libs, "g_drive_has_volumes")
1329 core.PuregoSafeRegister(&XGDriveIsMediaCheckAutomatic, libs, "g_drive_is_media_check_automatic")
1330 core.PuregoSafeRegister(&XGDriveIsMediaRemovable, libs, "g_drive_is_media_removable")
1331 core.PuregoSafeRegister(&XGDriveIsRemovable, libs, "g_drive_is_removable")
1332 core.PuregoSafeRegister(&XGDrivePollForMedia, libs, "g_drive_poll_for_media")
1333 core.PuregoSafeRegister(&XGDrivePollForMediaFinish, libs, "g_drive_poll_for_media_finish")
1334 core.PuregoSafeRegister(&XGDriveStart, libs, "g_drive_start")
1335 core.PuregoSafeRegister(&XGDriveStartFinish, libs, "g_drive_start_finish")
1336 core.PuregoSafeRegister(&XGDriveStop, libs, "g_drive_stop")
1337 core.PuregoSafeRegister(&XGDriveStopFinish, libs, "g_drive_stop_finish")
1338
1339}