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 IOModuleClass struct {
17 _ structs.HostLayout
18}
19
20func (x *IOModuleClass) GoPointer() uintptr {
21 return uintptr(unsafe.Pointer(x))
22}
23
24// Represents a scope for loading IO modules. A scope can be used for blocking
25// duplicate modules, or blocking a module you don't want to load.
26//
27// The scope can be used with g_io_modules_load_all_in_directory_with_scope()
28// or g_io_modules_scan_all_in_directory_with_scope().
29type IOModuleScope struct {
30 _ structs.HostLayout
31}
32
33func (x *IOModuleScope) GoPointer() uintptr {
34 return uintptr(unsafe.Pointer(x))
35}
36
37var xIOModuleScopeBlock func(uintptr, string)
38
39// Block modules with the given @basename from being loaded when
40// this scope is used with g_io_modules_scan_all_in_directory_with_scope()
41// or g_io_modules_load_all_in_directory_with_scope().
42func (x *IOModuleScope) Block(BasenameVar string) {
43
44 xIOModuleScopeBlock(x.GoPointer(), BasenameVar)
45
46}
47
48var xIOModuleScopeFree func(uintptr)
49
50// Free a module scope.
51func (x *IOModuleScope) Free() {
52
53 xIOModuleScopeFree(x.GoPointer())
54
55}
56
57var xIoExtensionPointImplement func(string, types.GType, string, int) *IOExtension
58
59// Registers @type as extension for the extension point with name
60// @extension_point_name.
61//
62// If @type has already been registered as an extension for this
63// extension point, the existing #GIOExtension object is returned.
64func IoExtensionPointImplement(ExtensionPointNameVar string, TypeVar types.GType, ExtensionNameVar string, PriorityVar int) *IOExtension {
65
66 cret := xIoExtensionPointImplement(ExtensionPointNameVar, TypeVar, ExtensionNameVar, PriorityVar)
67 return cret
68}
69
70var xIoExtensionPointLookup func(string) *IOExtensionPoint
71
72// Looks up an existing extension point.
73func IoExtensionPointLookup(NameVar string) *IOExtensionPoint {
74
75 cret := xIoExtensionPointLookup(NameVar)
76 return cret
77}
78
79var xIoExtensionPointRegister func(string) *IOExtensionPoint
80
81// Registers an extension point.
82func IoExtensionPointRegister(NameVar string) *IOExtensionPoint {
83
84 cret := xIoExtensionPointRegister(NameVar)
85 return cret
86}
87
88var xIoModulesLoadAllInDirectory func(string) *glib.List
89
90// Loads all the modules in the specified directory.
91//
92// If don't require all modules to be initialized (and thus registering
93// all gtypes) then you can use g_io_modules_scan_all_in_directory()
94// which allows delayed/lazy loading of modules.
95func IoModulesLoadAllInDirectory(DirnameVar string) *glib.List {
96
97 cret := xIoModulesLoadAllInDirectory(DirnameVar)
98 return cret
99}
100
101var xIoModulesLoadAllInDirectoryWithScope func(string, *IOModuleScope) *glib.List
102
103// Loads all the modules in the specified directory.
104//
105// If don't require all modules to be initialized (and thus registering
106// all gtypes) then you can use g_io_modules_scan_all_in_directory()
107// which allows delayed/lazy loading of modules.
108func IoModulesLoadAllInDirectoryWithScope(DirnameVar string, ScopeVar *IOModuleScope) *glib.List {
109
110 cret := xIoModulesLoadAllInDirectoryWithScope(DirnameVar, ScopeVar)
111 return cret
112}
113
114var xIoModulesScanAllInDirectory func(string)
115
116// Scans all the modules in the specified directory, ensuring that
117// any extension point implemented by a module is registered.
118//
119// This may not actually load and initialize all the types in each
120// module, some modules may be lazily loaded and initialized when
121// an extension point it implements is used with e.g.
122// g_io_extension_point_get_extensions() or
123// g_io_extension_point_get_extension_by_name().
124//
125// If you need to guarantee that all types are loaded in all the modules,
126// use g_io_modules_load_all_in_directory().
127func IoModulesScanAllInDirectory(DirnameVar string) {
128
129 xIoModulesScanAllInDirectory(DirnameVar)
130
131}
132
133var xIoModulesScanAllInDirectoryWithScope func(string, *IOModuleScope)
134
135// Scans all the modules in the specified directory, ensuring that
136// any extension point implemented by a module is registered.
137//
138// This may not actually load and initialize all the types in each
139// module, some modules may be lazily loaded and initialized when
140// an extension point it implements is used with e.g.
141// g_io_extension_point_get_extensions() or
142// g_io_extension_point_get_extension_by_name().
143//
144// If you need to guarantee that all types are loaded in all the modules,
145// use g_io_modules_load_all_in_directory().
146func IoModulesScanAllInDirectoryWithScope(DirnameVar string, ScopeVar *IOModuleScope) {
147
148 xIoModulesScanAllInDirectoryWithScope(DirnameVar, ScopeVar)
149
150}
151
152// Provides an interface and default functions for loading and unloading
153// modules. This is used internally to make GIO extensible, but can also
154// be used by others to implement module loading.
155type IOModule struct {
156 gobject.TypeModule
157}
158
159var xIOModuleGLibType func() types.GType
160
161func IOModuleGLibType() types.GType {
162 return xIOModuleGLibType()
163}
164
165func IOModuleNewFromInternalPtr(ptr uintptr) *IOModule {
166 cls := &IOModule{}
167 cls.Ptr = ptr
168 return cls
169}
170
171var xNewIOModule func(string) uintptr
172
173// Creates a new GIOModule that will load the specific
174// shared library when in use.
175func NewIOModule(FilenameVar string) *IOModule {
176 var cls *IOModule
177
178 cret := xNewIOModule(FilenameVar)
179
180 if cret == 0 {
181 return nil
182 }
183 cls = &IOModule{}
184 cls.Ptr = cret
185 return cls
186}
187
188var xIOModuleLoad func(uintptr)
189
190// Required API for GIO modules to implement.
191//
192// This function is run after the module has been loaded into GIO,
193// to initialize the module. Typically, this function will call
194// g_io_extension_point_implement().
195//
196// Since 2.56, this function should be named `g_io_<modulename>_load`, where
197// `modulename` is the plugin’s filename with the `lib` or `libgio` prefix and
198// everything after the first dot removed, and with `-` replaced with `_`
199// throughout. For example, `libgiognutls-helper.so` becomes `gnutls_helper`.
200// Using the new symbol names avoids name clashes when building modules
201// statically. The old symbol names continue to be supported, but cannot be used
202// for static builds.
203func (x *IOModule) Load() {
204
205 xIOModuleLoad(x.GoPointer())
206
207}
208
209var xIOModuleUnload func(uintptr)
210
211// Required API for GIO modules to implement.
212//
213// This function is run when the module is being unloaded from GIO,
214// to finalize the module.
215//
216// Since 2.56, this function should be named `g_io_<modulename>_unload`, where
217// `modulename` is the plugin’s filename with the `lib` or `libgio` prefix and
218// everything after the first dot removed, and with `-` replaced with `_`
219// throughout. For example, `libgiognutls-helper.so` becomes `gnutls_helper`.
220// Using the new symbol names avoids name clashes when building modules
221// statically. The old symbol names continue to be supported, but cannot be used
222// for static builds.
223func (x *IOModule) Unload() {
224
225 xIOModuleUnload(x.GoPointer())
226
227}
228
229func (c *IOModule) GoPointer() uintptr {
230 if c == nil {
231 return 0
232 }
233 return c.Ptr
234}
235
236func (c *IOModule) SetGoPointer(ptr uintptr) {
237 c.Ptr = ptr
238}
239
240// Calls the @complete_interface_info function from the
241// #GTypePluginClass of @plugin. There should be no need to use this
242// function outside of the GObject type system itself.
243func (x *IOModule) CompleteInterfaceInfo(InstanceTypeVar types.GType, InterfaceTypeVar types.GType, InfoVar *gobject.InterfaceInfo) {
244
245 gobject.XGTypePluginCompleteInterfaceInfo(x.GoPointer(), InstanceTypeVar, InterfaceTypeVar, InfoVar)
246
247}
248
249// Calls the @complete_type_info function from the #GTypePluginClass of @plugin.
250// There should be no need to use this function outside of the GObject
251// type system itself.
252func (x *IOModule) CompleteTypeInfo(GTypeVar types.GType, InfoVar *gobject.TypeInfo, ValueTableVar *gobject.TypeValueTable) {
253
254 gobject.XGTypePluginCompleteTypeInfo(x.GoPointer(), GTypeVar, InfoVar, ValueTableVar)
255
256}
257
258// Calls the @unuse_plugin function from the #GTypePluginClass of
259// @plugin. There should be no need to use this function outside of
260// the GObject type system itself.
261func (x *IOModule) Unuse() {
262
263 gobject.XGTypePluginUnuse(x.GoPointer())
264
265}
266
267// Calls the @use_plugin function from the #GTypePluginClass of
268// @plugin. There should be no need to use this function outside of
269// the GObject type system itself.
270func (x *IOModule) Use() {
271
272 gobject.XGTypePluginUse(x.GoPointer())
273
274}
275
276var xIOModuleQuery func() []string
277
278// Optional API for GIO modules to implement.
279//
280// Should return a list of all the extension points that may be
281// implemented in this module.
282//
283// This method will not be called in normal use, however it may be
284// called when probing existing modules and recording which extension
285// points that this model is used for. This means we won't have to
286// load and initialize this module unless its needed.
287//
288// If this function is not implemented by the module the module will
289// always be loaded, initialized and then unloaded on application
290// startup so that it can register its extension points during init.
291//
292// Note that a module need not actually implement all the extension
293// points that g_io_module_query() returns, since the exact list of
294// extension may depend on runtime issues. However all extension
295// points actually implemented must be returned by g_io_module_query()
296// (if defined).
297//
298// When installing a module that implements g_io_module_query() you must
299// run gio-querymodules in order to build the cache files required for
300// lazy loading.
301//
302// Since 2.56, this function should be named `g_io_<modulename>_query`, where
303// `modulename` is the plugin’s filename with the `lib` or `libgio` prefix and
304// everything after the first dot removed, and with `-` replaced with `_`
305// throughout. For example, `libgiognutls-helper.so` becomes `gnutls_helper`.
306// Using the new symbol names avoids name clashes when building modules
307// statically. The old symbol names continue to be supported, but cannot be used
308// for static builds.
309func IOModuleQuery() []string {
310
311 cret := xIOModuleQuery()
312 return cret
313}
314
315func init() {
316 core.SetPackageName("GIO", "gio-2.0")
317 core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"})
318 var libs []uintptr
319 for _, libPath := range core.GetPaths("GIO") {
320 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
321 if err != nil {
322 panic(err)
323 }
324 libs = append(libs, lib)
325 }
326
327 core.PuregoSafeRegister(&xIoExtensionPointImplement, libs, "g_io_extension_point_implement")
328 core.PuregoSafeRegister(&xIoExtensionPointLookup, libs, "g_io_extension_point_lookup")
329 core.PuregoSafeRegister(&xIoExtensionPointRegister, libs, "g_io_extension_point_register")
330 core.PuregoSafeRegister(&xIoModulesLoadAllInDirectory, libs, "g_io_modules_load_all_in_directory")
331 core.PuregoSafeRegister(&xIoModulesLoadAllInDirectoryWithScope, libs, "g_io_modules_load_all_in_directory_with_scope")
332 core.PuregoSafeRegister(&xIoModulesScanAllInDirectory, libs, "g_io_modules_scan_all_in_directory")
333 core.PuregoSafeRegister(&xIoModulesScanAllInDirectoryWithScope, libs, "g_io_modules_scan_all_in_directory_with_scope")
334
335 core.PuregoSafeRegister(&xIOModuleScopeBlock, libs, "g_io_module_scope_block")
336 core.PuregoSafeRegister(&xIOModuleScopeFree, libs, "g_io_module_scope_free")
337
338 core.PuregoSafeRegister(&xIOModuleGLibType, libs, "g_io_module_get_type")
339
340 core.PuregoSafeRegister(&xNewIOModule, libs, "g_io_module_new")
341
342 core.PuregoSafeRegister(&xIOModuleLoad, libs, "g_io_module_load")
343 core.PuregoSafeRegister(&xIOModuleUnload, libs, "g_io_module_unload")
344
345 core.PuregoSafeRegister(&xIOModuleQuery, libs, "g_io_module_query")
346
347}