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
16// This function type is used by g_vfs_register_uri_scheme() to make it
17// possible for a client to associate a URI scheme to a different #GFile
18// implementation.
19//
20// The client should return a reference to the new file that has been
21// created for @uri, or %NULL to continue with the default implementation.
22type VfsFileLookupFunc func(uintptr, string, uintptr) uintptr
23
24type VfsClass struct {
25 _ structs.HostLayout
26
27 ParentClass gobject.ObjectClass
28
29 xIsActive uintptr
30
31 xGetFileForPath uintptr
32
33 xGetFileForUri uintptr
34
35 xGetSupportedUriSchemes uintptr
36
37 xParseName uintptr
38
39 xLocalFileAddInfo uintptr
40
41 xAddWritableNamespaces uintptr
42
43 xLocalFileSetAttributes uintptr
44
45 xLocalFileRemoved uintptr
46
47 xLocalFileMoved uintptr
48
49 xDeserializeIcon uintptr
50
51 xGReserved1 uintptr
52
53 xGReserved2 uintptr
54
55 xGReserved3 uintptr
56
57 xGReserved4 uintptr
58
59 xGReserved5 uintptr
60
61 xGReserved6 uintptr
62}
63
64func (x *VfsClass) GoPointer() uintptr {
65 return uintptr(unsafe.Pointer(x))
66}
67
68// OverrideIsActive sets the "is_active" callback function.
69func (x *VfsClass) OverrideIsActive(cb func(*Vfs) bool) {
70 if cb == nil {
71 x.xIsActive = 0
72 } else {
73 x.xIsActive = purego.NewCallback(func(VfsVarp uintptr) bool {
74 return cb(VfsNewFromInternalPtr(VfsVarp))
75 })
76 }
77}
78
79// GetIsActive gets the "is_active" callback function.
80func (x *VfsClass) GetIsActive() func(*Vfs) bool {
81 if x.xIsActive == 0 {
82 return nil
83 }
84 var rawCallback func(VfsVarp uintptr) bool
85 purego.RegisterFunc(&rawCallback, x.xIsActive)
86 return func(VfsVar *Vfs) bool {
87 return rawCallback(VfsVar.GoPointer())
88 }
89}
90
91// OverrideGetFileForPath sets the "get_file_for_path" callback function.
92func (x *VfsClass) OverrideGetFileForPath(cb func(*Vfs, string) *FileBase) {
93 if cb == nil {
94 x.xGetFileForPath = 0
95 } else {
96 x.xGetFileForPath = purego.NewCallback(func(VfsVarp uintptr, PathVarp string) uintptr {
97 ret := cb(VfsNewFromInternalPtr(VfsVarp), PathVarp)
98 if ret == nil {
99 return 0
100 }
101 return ret.GoPointer()
102 })
103 }
104}
105
106// GetGetFileForPath gets the "get_file_for_path" callback function.
107func (x *VfsClass) GetGetFileForPath() func(*Vfs, string) *FileBase {
108 if x.xGetFileForPath == 0 {
109 return nil
110 }
111 var rawCallback func(VfsVarp uintptr, PathVarp string) uintptr
112 purego.RegisterFunc(&rawCallback, x.xGetFileForPath)
113 return func(VfsVar *Vfs, PathVar string) *FileBase {
114 rawRet := rawCallback(VfsVar.GoPointer(), PathVar)
115 if rawRet == 0 {
116 return nil
117 }
118 ret := &FileBase{}
119 ret.Ptr = rawRet
120 return ret
121 }
122}
123
124// OverrideGetFileForUri sets the "get_file_for_uri" callback function.
125func (x *VfsClass) OverrideGetFileForUri(cb func(*Vfs, string) *FileBase) {
126 if cb == nil {
127 x.xGetFileForUri = 0
128 } else {
129 x.xGetFileForUri = purego.NewCallback(func(VfsVarp uintptr, UriVarp string) uintptr {
130 ret := cb(VfsNewFromInternalPtr(VfsVarp), UriVarp)
131 if ret == nil {
132 return 0
133 }
134 return ret.GoPointer()
135 })
136 }
137}
138
139// GetGetFileForUri gets the "get_file_for_uri" callback function.
140func (x *VfsClass) GetGetFileForUri() func(*Vfs, string) *FileBase {
141 if x.xGetFileForUri == 0 {
142 return nil
143 }
144 var rawCallback func(VfsVarp uintptr, UriVarp string) uintptr
145 purego.RegisterFunc(&rawCallback, x.xGetFileForUri)
146 return func(VfsVar *Vfs, UriVar string) *FileBase {
147 rawRet := rawCallback(VfsVar.GoPointer(), UriVar)
148 if rawRet == 0 {
149 return nil
150 }
151 ret := &FileBase{}
152 ret.Ptr = rawRet
153 return ret
154 }
155}
156
157// OverrideGetSupportedUriSchemes sets the "get_supported_uri_schemes" callback function.
158func (x *VfsClass) OverrideGetSupportedUriSchemes(cb func(*Vfs) []string) {
159 if cb == nil {
160 x.xGetSupportedUriSchemes = 0
161 } else {
162 x.xGetSupportedUriSchemes = purego.NewCallback(func(VfsVarp uintptr) []string {
163 return cb(VfsNewFromInternalPtr(VfsVarp))
164 })
165 }
166}
167
168// GetGetSupportedUriSchemes gets the "get_supported_uri_schemes" callback function.
169func (x *VfsClass) GetGetSupportedUriSchemes() func(*Vfs) []string {
170 if x.xGetSupportedUriSchemes == 0 {
171 return nil
172 }
173 var rawCallback func(VfsVarp uintptr) []string
174 purego.RegisterFunc(&rawCallback, x.xGetSupportedUriSchemes)
175 return func(VfsVar *Vfs) []string {
176 return rawCallback(VfsVar.GoPointer())
177 }
178}
179
180// OverrideParseName sets the "parse_name" callback function.
181func (x *VfsClass) OverrideParseName(cb func(*Vfs, string) *FileBase) {
182 if cb == nil {
183 x.xParseName = 0
184 } else {
185 x.xParseName = purego.NewCallback(func(VfsVarp uintptr, ParseNameVarp string) uintptr {
186 ret := cb(VfsNewFromInternalPtr(VfsVarp), ParseNameVarp)
187 if ret == nil {
188 return 0
189 }
190 return ret.GoPointer()
191 })
192 }
193}
194
195// GetParseName gets the "parse_name" callback function.
196func (x *VfsClass) GetParseName() func(*Vfs, string) *FileBase {
197 if x.xParseName == 0 {
198 return nil
199 }
200 var rawCallback func(VfsVarp uintptr, ParseNameVarp string) uintptr
201 purego.RegisterFunc(&rawCallback, x.xParseName)
202 return func(VfsVar *Vfs, ParseNameVar string) *FileBase {
203 rawRet := rawCallback(VfsVar.GoPointer(), ParseNameVar)
204 if rawRet == 0 {
205 return nil
206 }
207 ret := &FileBase{}
208 ret.Ptr = rawRet
209 return ret
210 }
211}
212
213// OverrideLocalFileAddInfo sets the "local_file_add_info" callback function.
214func (x *VfsClass) OverrideLocalFileAddInfo(cb func(*Vfs, string, uint64, *FileAttributeMatcher, *FileInfo, *Cancellable, uintptr, *glib.DestroyNotify)) {
215 if cb == nil {
216 x.xLocalFileAddInfo = 0
217 } else {
218 x.xLocalFileAddInfo = purego.NewCallback(func(VfsVarp uintptr, FilenameVarp string, DeviceVarp uint64, AttributeMatcherVarp *FileAttributeMatcher, InfoVarp uintptr, CancellableVarp uintptr, ExtraDataVarp uintptr, FreeExtraDataVarp uintptr) {
219 cb(VfsNewFromInternalPtr(VfsVarp), FilenameVarp, DeviceVarp, AttributeMatcherVarp, FileInfoNewFromInternalPtr(InfoVarp), CancellableNewFromInternalPtr(CancellableVarp), ExtraDataVarp, (*glib.DestroyNotify)(unsafe.Pointer(FreeExtraDataVarp)))
220 })
221 }
222}
223
224// GetLocalFileAddInfo gets the "local_file_add_info" callback function.
225func (x *VfsClass) GetLocalFileAddInfo() func(*Vfs, string, uint64, *FileAttributeMatcher, *FileInfo, *Cancellable, uintptr, *glib.DestroyNotify) {
226 if x.xLocalFileAddInfo == 0 {
227 return nil
228 }
229 var rawCallback func(VfsVarp uintptr, FilenameVarp string, DeviceVarp uint64, AttributeMatcherVarp *FileAttributeMatcher, InfoVarp uintptr, CancellableVarp uintptr, ExtraDataVarp uintptr, FreeExtraDataVarp uintptr)
230 purego.RegisterFunc(&rawCallback, x.xLocalFileAddInfo)
231 return func(VfsVar *Vfs, FilenameVar string, DeviceVar uint64, AttributeMatcherVar *FileAttributeMatcher, InfoVar *FileInfo, CancellableVar *Cancellable, ExtraDataVar uintptr, FreeExtraDataVar *glib.DestroyNotify) {
232 rawCallback(VfsVar.GoPointer(), FilenameVar, DeviceVar, AttributeMatcherVar, InfoVar.GoPointer(), CancellableVar.GoPointer(), ExtraDataVar, glib.NewCallback(FreeExtraDataVar))
233 }
234}
235
236// OverrideAddWritableNamespaces sets the "add_writable_namespaces" callback function.
237func (x *VfsClass) OverrideAddWritableNamespaces(cb func(*Vfs, *FileAttributeInfoList)) {
238 if cb == nil {
239 x.xAddWritableNamespaces = 0
240 } else {
241 x.xAddWritableNamespaces = purego.NewCallback(func(VfsVarp uintptr, ListVarp *FileAttributeInfoList) {
242 cb(VfsNewFromInternalPtr(VfsVarp), ListVarp)
243 })
244 }
245}
246
247// GetAddWritableNamespaces gets the "add_writable_namespaces" callback function.
248func (x *VfsClass) GetAddWritableNamespaces() func(*Vfs, *FileAttributeInfoList) {
249 if x.xAddWritableNamespaces == 0 {
250 return nil
251 }
252 var rawCallback func(VfsVarp uintptr, ListVarp *FileAttributeInfoList)
253 purego.RegisterFunc(&rawCallback, x.xAddWritableNamespaces)
254 return func(VfsVar *Vfs, ListVar *FileAttributeInfoList) {
255 rawCallback(VfsVar.GoPointer(), ListVar)
256 }
257}
258
259// OverrideLocalFileSetAttributes sets the "local_file_set_attributes" callback function.
260func (x *VfsClass) OverrideLocalFileSetAttributes(cb func(*Vfs, string, *FileInfo, FileQueryInfoFlags, *Cancellable) bool) {
261 if cb == nil {
262 x.xLocalFileSetAttributes = 0
263 } else {
264 x.xLocalFileSetAttributes = purego.NewCallback(func(VfsVarp uintptr, FilenameVarp string, InfoVarp uintptr, FlagsVarp FileQueryInfoFlags, CancellableVarp uintptr) bool {
265 return cb(VfsNewFromInternalPtr(VfsVarp), FilenameVarp, FileInfoNewFromInternalPtr(InfoVarp), FlagsVarp, CancellableNewFromInternalPtr(CancellableVarp))
266 })
267 }
268}
269
270// GetLocalFileSetAttributes gets the "local_file_set_attributes" callback function.
271func (x *VfsClass) GetLocalFileSetAttributes() func(*Vfs, string, *FileInfo, FileQueryInfoFlags, *Cancellable) bool {
272 if x.xLocalFileSetAttributes == 0 {
273 return nil
274 }
275 var rawCallback func(VfsVarp uintptr, FilenameVarp string, InfoVarp uintptr, FlagsVarp FileQueryInfoFlags, CancellableVarp uintptr) bool
276 purego.RegisterFunc(&rawCallback, x.xLocalFileSetAttributes)
277 return func(VfsVar *Vfs, FilenameVar string, InfoVar *FileInfo, FlagsVar FileQueryInfoFlags, CancellableVar *Cancellable) bool {
278 return rawCallback(VfsVar.GoPointer(), FilenameVar, InfoVar.GoPointer(), FlagsVar, CancellableVar.GoPointer())
279 }
280}
281
282// OverrideLocalFileRemoved sets the "local_file_removed" callback function.
283func (x *VfsClass) OverrideLocalFileRemoved(cb func(*Vfs, string)) {
284 if cb == nil {
285 x.xLocalFileRemoved = 0
286 } else {
287 x.xLocalFileRemoved = purego.NewCallback(func(VfsVarp uintptr, FilenameVarp string) {
288 cb(VfsNewFromInternalPtr(VfsVarp), FilenameVarp)
289 })
290 }
291}
292
293// GetLocalFileRemoved gets the "local_file_removed" callback function.
294func (x *VfsClass) GetLocalFileRemoved() func(*Vfs, string) {
295 if x.xLocalFileRemoved == 0 {
296 return nil
297 }
298 var rawCallback func(VfsVarp uintptr, FilenameVarp string)
299 purego.RegisterFunc(&rawCallback, x.xLocalFileRemoved)
300 return func(VfsVar *Vfs, FilenameVar string) {
301 rawCallback(VfsVar.GoPointer(), FilenameVar)
302 }
303}
304
305// OverrideLocalFileMoved sets the "local_file_moved" callback function.
306func (x *VfsClass) OverrideLocalFileMoved(cb func(*Vfs, string, string)) {
307 if cb == nil {
308 x.xLocalFileMoved = 0
309 } else {
310 x.xLocalFileMoved = purego.NewCallback(func(VfsVarp uintptr, SourceVarp string, DestVarp string) {
311 cb(VfsNewFromInternalPtr(VfsVarp), SourceVarp, DestVarp)
312 })
313 }
314}
315
316// GetLocalFileMoved gets the "local_file_moved" callback function.
317func (x *VfsClass) GetLocalFileMoved() func(*Vfs, string, string) {
318 if x.xLocalFileMoved == 0 {
319 return nil
320 }
321 var rawCallback func(VfsVarp uintptr, SourceVarp string, DestVarp string)
322 purego.RegisterFunc(&rawCallback, x.xLocalFileMoved)
323 return func(VfsVar *Vfs, SourceVar string, DestVar string) {
324 rawCallback(VfsVar.GoPointer(), SourceVar, DestVar)
325 }
326}
327
328// OverrideDeserializeIcon sets the "deserialize_icon" callback function.
329func (x *VfsClass) OverrideDeserializeIcon(cb func(*Vfs, *glib.Variant) *IconBase) {
330 if cb == nil {
331 x.xDeserializeIcon = 0
332 } else {
333 x.xDeserializeIcon = purego.NewCallback(func(VfsVarp uintptr, ValueVarp *glib.Variant) uintptr {
334 ret := cb(VfsNewFromInternalPtr(VfsVarp), ValueVarp)
335 if ret == nil {
336 return 0
337 }
338 return ret.GoPointer()
339 })
340 }
341}
342
343// GetDeserializeIcon gets the "deserialize_icon" callback function.
344func (x *VfsClass) GetDeserializeIcon() func(*Vfs, *glib.Variant) *IconBase {
345 if x.xDeserializeIcon == 0 {
346 return nil
347 }
348 var rawCallback func(VfsVarp uintptr, ValueVarp *glib.Variant) uintptr
349 purego.RegisterFunc(&rawCallback, x.xDeserializeIcon)
350 return func(VfsVar *Vfs, ValueVar *glib.Variant) *IconBase {
351 rawRet := rawCallback(VfsVar.GoPointer(), ValueVar)
352 if rawRet == 0 {
353 return nil
354 }
355 ret := &IconBase{}
356 ret.Ptr = rawRet
357 return ret
358 }
359}
360
361// OverrideGReserved1 sets the "_g_reserved1" callback function.
362func (x *VfsClass) OverrideGReserved1(cb func()) {
363 if cb == nil {
364 x.xGReserved1 = 0
365 } else {
366 x.xGReserved1 = purego.NewCallback(func() {
367 cb()
368 })
369 }
370}
371
372// GetGReserved1 gets the "_g_reserved1" callback function.
373func (x *VfsClass) GetGReserved1() func() {
374 if x.xGReserved1 == 0 {
375 return nil
376 }
377 var rawCallback func()
378 purego.RegisterFunc(&rawCallback, x.xGReserved1)
379 return func() {
380 rawCallback()
381 }
382}
383
384// OverrideGReserved2 sets the "_g_reserved2" callback function.
385func (x *VfsClass) OverrideGReserved2(cb func()) {
386 if cb == nil {
387 x.xGReserved2 = 0
388 } else {
389 x.xGReserved2 = purego.NewCallback(func() {
390 cb()
391 })
392 }
393}
394
395// GetGReserved2 gets the "_g_reserved2" callback function.
396func (x *VfsClass) GetGReserved2() func() {
397 if x.xGReserved2 == 0 {
398 return nil
399 }
400 var rawCallback func()
401 purego.RegisterFunc(&rawCallback, x.xGReserved2)
402 return func() {
403 rawCallback()
404 }
405}
406
407// OverrideGReserved3 sets the "_g_reserved3" callback function.
408func (x *VfsClass) OverrideGReserved3(cb func()) {
409 if cb == nil {
410 x.xGReserved3 = 0
411 } else {
412 x.xGReserved3 = purego.NewCallback(func() {
413 cb()
414 })
415 }
416}
417
418// GetGReserved3 gets the "_g_reserved3" callback function.
419func (x *VfsClass) GetGReserved3() func() {
420 if x.xGReserved3 == 0 {
421 return nil
422 }
423 var rawCallback func()
424 purego.RegisterFunc(&rawCallback, x.xGReserved3)
425 return func() {
426 rawCallback()
427 }
428}
429
430// OverrideGReserved4 sets the "_g_reserved4" callback function.
431func (x *VfsClass) OverrideGReserved4(cb func()) {
432 if cb == nil {
433 x.xGReserved4 = 0
434 } else {
435 x.xGReserved4 = purego.NewCallback(func() {
436 cb()
437 })
438 }
439}
440
441// GetGReserved4 gets the "_g_reserved4" callback function.
442func (x *VfsClass) GetGReserved4() func() {
443 if x.xGReserved4 == 0 {
444 return nil
445 }
446 var rawCallback func()
447 purego.RegisterFunc(&rawCallback, x.xGReserved4)
448 return func() {
449 rawCallback()
450 }
451}
452
453// OverrideGReserved5 sets the "_g_reserved5" callback function.
454func (x *VfsClass) OverrideGReserved5(cb func()) {
455 if cb == nil {
456 x.xGReserved5 = 0
457 } else {
458 x.xGReserved5 = purego.NewCallback(func() {
459 cb()
460 })
461 }
462}
463
464// GetGReserved5 gets the "_g_reserved5" callback function.
465func (x *VfsClass) GetGReserved5() func() {
466 if x.xGReserved5 == 0 {
467 return nil
468 }
469 var rawCallback func()
470 purego.RegisterFunc(&rawCallback, x.xGReserved5)
471 return func() {
472 rawCallback()
473 }
474}
475
476// OverrideGReserved6 sets the "_g_reserved6" callback function.
477func (x *VfsClass) OverrideGReserved6(cb func()) {
478 if cb == nil {
479 x.xGReserved6 = 0
480 } else {
481 x.xGReserved6 = purego.NewCallback(func() {
482 cb()
483 })
484 }
485}
486
487// GetGReserved6 gets the "_g_reserved6" callback function.
488func (x *VfsClass) GetGReserved6() func() {
489 if x.xGReserved6 == 0 {
490 return nil
491 }
492 var rawCallback func()
493 purego.RegisterFunc(&rawCallback, x.xGReserved6)
494 return func() {
495 rawCallback()
496 }
497}
498
499const (
500 // Extension point for #GVfs functionality.
501 // See [Extending GIO](overview.html#extending-gio).
502 VFS_EXTENSION_POINT_NAME string = "gio-vfs"
503)
504
505// Entry point for using GIO functionality.
506type Vfs struct {
507 gobject.Object
508}
509
510var xVfsGLibType func() types.GType
511
512func VfsGLibType() types.GType {
513 return xVfsGLibType()
514}
515
516func VfsNewFromInternalPtr(ptr uintptr) *Vfs {
517 cls := &Vfs{}
518 cls.Ptr = ptr
519 return cls
520}
521
522var xVfsGetFileForPath func(uintptr, string) uintptr
523
524// Gets a #GFile for @path.
525func (x *Vfs) GetFileForPath(PathVar string) *FileBase {
526 var cls *FileBase
527
528 cret := xVfsGetFileForPath(x.GoPointer(), PathVar)
529
530 if cret == 0 {
531 return nil
532 }
533 cls = &FileBase{}
534 cls.Ptr = cret
535 return cls
536}
537
538var xVfsGetFileForUri func(uintptr, string) uintptr
539
540// Gets a #GFile for @uri.
541//
542// This operation never fails, but the returned object
543// might not support any I/O operation if the URI
544// is malformed or if the URI scheme is not supported.
545func (x *Vfs) GetFileForUri(UriVar string) *FileBase {
546 var cls *FileBase
547
548 cret := xVfsGetFileForUri(x.GoPointer(), UriVar)
549
550 if cret == 0 {
551 return nil
552 }
553 cls = &FileBase{}
554 cls.Ptr = cret
555 return cls
556}
557
558var xVfsGetSupportedUriSchemes func(uintptr) []string
559
560// Gets a list of URI schemes supported by @vfs.
561func (x *Vfs) GetSupportedUriSchemes() []string {
562
563 cret := xVfsGetSupportedUriSchemes(x.GoPointer())
564 return cret
565}
566
567var xVfsIsActive func(uintptr) bool
568
569// Checks if the VFS is active.
570func (x *Vfs) IsActive() bool {
571
572 cret := xVfsIsActive(x.GoPointer())
573 return cret
574}
575
576var xVfsParseName func(uintptr, string) uintptr
577
578// This operation never fails, but the returned object might
579// not support any I/O operations if the @parse_name cannot
580// be parsed by the #GVfs module.
581func (x *Vfs) ParseName(ParseNameVar string) *FileBase {
582 var cls *FileBase
583
584 cret := xVfsParseName(x.GoPointer(), ParseNameVar)
585
586 if cret == 0 {
587 return nil
588 }
589 cls = &FileBase{}
590 cls.Ptr = cret
591 return cls
592}
593
594var xVfsRegisterUriScheme func(uintptr, string, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr) bool
595
596// Registers @uri_func and @parse_name_func as the #GFile URI and parse name
597// lookup functions for URIs with a scheme matching @scheme.
598// Note that @scheme is registered only within the running application, as
599// opposed to desktop-wide as it happens with GVfs backends.
600//
601// When a #GFile is requested with an URI containing @scheme (e.g. through
602// g_file_new_for_uri()), @uri_func will be called to allow a custom
603// constructor. The implementation of @uri_func should not be blocking, and
604// must not call g_vfs_register_uri_scheme() or g_vfs_unregister_uri_scheme().
605//
606// When g_file_parse_name() is called with a parse name obtained from such file,
607// @parse_name_func will be called to allow the #GFile to be created again. In
608// that case, it's responsibility of @parse_name_func to make sure the parse
609// name matches what the custom #GFile implementation returned when
610// g_file_get_parse_name() was previously called. The implementation of
611// @parse_name_func should not be blocking, and must not call
612// g_vfs_register_uri_scheme() or g_vfs_unregister_uri_scheme().
613//
614// It's an error to call this function twice with the same scheme. To unregister
615// a custom URI scheme, use g_vfs_unregister_uri_scheme().
616func (x *Vfs) RegisterUriScheme(SchemeVar string, UriFuncVar *VfsFileLookupFunc, UriDataVar uintptr, UriDestroyVar *glib.DestroyNotify, ParseNameFuncVar *VfsFileLookupFunc, ParseNameDataVar uintptr, ParseNameDestroyVar *glib.DestroyNotify) bool {
617
618 var UriFuncVarRef uintptr
619 if UriFuncVar != nil {
620 UriFuncVarPtr := uintptr(unsafe.Pointer(UriFuncVar))
621 if cbRefPtr, ok := glib.GetCallback(UriFuncVarPtr); ok {
622 UriFuncVarRef = cbRefPtr
623 } else {
624 fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) uintptr {
625 cbFn := *UriFuncVar
626 return cbFn(arg0, core.GoString(arg1), arg2)
627 }
628 UriFuncVarRef = purego.NewCallback(fcb)
629 glib.SaveCallbackWithClosure(UriFuncVarPtr, UriFuncVarRef, UriFuncVar)
630 }
631 }
632
633 var UriDestroyVarRef uintptr
634 if UriDestroyVar != nil {
635 UriDestroyVarPtr := uintptr(unsafe.Pointer(UriDestroyVar))
636 if cbRefPtr, ok := glib.GetCallback(UriDestroyVarPtr); ok {
637 UriDestroyVarRef = cbRefPtr
638 } else {
639 fcb := func(arg0 uintptr) {
640 cbFn := *UriDestroyVar
641 cbFn(arg0)
642 }
643 UriDestroyVarRef = purego.NewCallback(fcb)
644 glib.SaveCallbackWithClosure(UriDestroyVarPtr, UriDestroyVarRef, UriDestroyVar)
645 }
646 }
647
648 var ParseNameFuncVarRef uintptr
649 if ParseNameFuncVar != nil {
650 ParseNameFuncVarPtr := uintptr(unsafe.Pointer(ParseNameFuncVar))
651 if cbRefPtr, ok := glib.GetCallback(ParseNameFuncVarPtr); ok {
652 ParseNameFuncVarRef = cbRefPtr
653 } else {
654 fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) uintptr {
655 cbFn := *ParseNameFuncVar
656 return cbFn(arg0, core.GoString(arg1), arg2)
657 }
658 ParseNameFuncVarRef = purego.NewCallback(fcb)
659 glib.SaveCallbackWithClosure(ParseNameFuncVarPtr, ParseNameFuncVarRef, ParseNameFuncVar)
660 }
661 }
662
663 var ParseNameDestroyVarRef uintptr
664 if ParseNameDestroyVar != nil {
665 ParseNameDestroyVarPtr := uintptr(unsafe.Pointer(ParseNameDestroyVar))
666 if cbRefPtr, ok := glib.GetCallback(ParseNameDestroyVarPtr); ok {
667 ParseNameDestroyVarRef = cbRefPtr
668 } else {
669 fcb := func(arg0 uintptr) {
670 cbFn := *ParseNameDestroyVar
671 cbFn(arg0)
672 }
673 ParseNameDestroyVarRef = purego.NewCallback(fcb)
674 glib.SaveCallbackWithClosure(ParseNameDestroyVarPtr, ParseNameDestroyVarRef, ParseNameDestroyVar)
675 }
676 }
677
678 cret := xVfsRegisterUriScheme(x.GoPointer(), SchemeVar, UriFuncVarRef, UriDataVar, UriDestroyVarRef, ParseNameFuncVarRef, ParseNameDataVar, ParseNameDestroyVarRef)
679 return cret
680}
681
682var xVfsUnregisterUriScheme func(uintptr, string) bool
683
684// Unregisters the URI handler for @scheme previously registered with
685// g_vfs_register_uri_scheme().
686func (x *Vfs) UnregisterUriScheme(SchemeVar string) bool {
687
688 cret := xVfsUnregisterUriScheme(x.GoPointer(), SchemeVar)
689 return cret
690}
691
692func (c *Vfs) GoPointer() uintptr {
693 if c == nil {
694 return 0
695 }
696 return c.Ptr
697}
698
699func (c *Vfs) SetGoPointer(ptr uintptr) {
700 c.Ptr = ptr
701}
702
703var xVfsGetDefault func() uintptr
704
705// Gets the default #GVfs for the system.
706func VfsGetDefault() *Vfs {
707 var cls *Vfs
708
709 cret := xVfsGetDefault()
710
711 if cret == 0 {
712 return nil
713 }
714 gobject.IncreaseRef(cret)
715 cls = &Vfs{}
716 cls.Ptr = cret
717 return cls
718}
719
720var xVfsGetLocal func() uintptr
721
722// Gets the local #GVfs for the system.
723func VfsGetLocal() *Vfs {
724 var cls *Vfs
725
726 cret := xVfsGetLocal()
727
728 if cret == 0 {
729 return nil
730 }
731 gobject.IncreaseRef(cret)
732 cls = &Vfs{}
733 cls.Ptr = cret
734 return cls
735}
736
737func init() {
738 core.SetPackageName("GIO", "gio-2.0")
739 core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"})
740 var libs []uintptr
741 for _, libPath := range core.GetPaths("GIO") {
742 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
743 if err != nil {
744 panic(err)
745 }
746 libs = append(libs, lib)
747 }
748
749 core.PuregoSafeRegister(&xVfsGLibType, libs, "g_vfs_get_type")
750
751 core.PuregoSafeRegister(&xVfsGetFileForPath, libs, "g_vfs_get_file_for_path")
752 core.PuregoSafeRegister(&xVfsGetFileForUri, libs, "g_vfs_get_file_for_uri")
753 core.PuregoSafeRegister(&xVfsGetSupportedUriSchemes, libs, "g_vfs_get_supported_uri_schemes")
754 core.PuregoSafeRegister(&xVfsIsActive, libs, "g_vfs_is_active")
755 core.PuregoSafeRegister(&xVfsParseName, libs, "g_vfs_parse_name")
756 core.PuregoSafeRegister(&xVfsRegisterUriScheme, libs, "g_vfs_register_uri_scheme")
757 core.PuregoSafeRegister(&xVfsUnregisterUriScheme, libs, "g_vfs_unregister_uri_scheme")
758
759 core.PuregoSafeRegister(&xVfsGetDefault, libs, "g_vfs_get_default")
760 core.PuregoSafeRegister(&xVfsGetLocal, libs, "g_vfs_get_local")
761
762}