v0.2.2 9100209

gtypemodule.go RawHistoryFolder

1// Package gobject was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gobject
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/gobject/types"
12)
13
14// In order to implement dynamic loading of types based on #GTypeModule,
15// the @load and @unload functions in #GTypeModuleClass must be implemented.
16type TypeModuleClass struct {
17	_ structs.HostLayout
18
19	ParentClass ObjectClass
20
21	xLoad uintptr
22
23	xUnload uintptr
24
25	xReserved1 uintptr
26
27	xReserved2 uintptr
28
29	xReserved3 uintptr
30
31	xReserved4 uintptr
32}
33
34func (x *TypeModuleClass) GoPointer() uintptr {
35	return uintptr(unsafe.Pointer(x))
36}
37
38// OverrideLoad sets the "load" callback function.
39// loads the module and registers one or more types using
40//
41//	g_type_module_register_type().
42func (x *TypeModuleClass) OverrideLoad(cb func(*TypeModule) bool) {
43	if cb == nil {
44		x.xLoad = 0
45	} else {
46		x.xLoad = purego.NewCallback(func(ModuleVarp uintptr) bool {
47			return cb(TypeModuleNewFromInternalPtr(ModuleVarp))
48		})
49	}
50}
51
52// GetLoad gets the "load" callback function.
53// loads the module and registers one or more types using
54//
55//	g_type_module_register_type().
56func (x *TypeModuleClass) GetLoad() func(*TypeModule) bool {
57	if x.xLoad == 0 {
58		return nil
59	}
60	var rawCallback func(ModuleVarp uintptr) bool
61	purego.RegisterFunc(&rawCallback, x.xLoad)
62	return func(ModuleVar *TypeModule) bool {
63		return rawCallback(ModuleVar.GoPointer())
64	}
65}
66
67// OverrideUnload sets the "unload" callback function.
68// unloads the module
69func (x *TypeModuleClass) OverrideUnload(cb func(*TypeModule)) {
70	if cb == nil {
71		x.xUnload = 0
72	} else {
73		x.xUnload = purego.NewCallback(func(ModuleVarp uintptr) {
74			cb(TypeModuleNewFromInternalPtr(ModuleVarp))
75		})
76	}
77}
78
79// GetUnload gets the "unload" callback function.
80// unloads the module
81func (x *TypeModuleClass) GetUnload() func(*TypeModule) {
82	if x.xUnload == 0 {
83		return nil
84	}
85	var rawCallback func(ModuleVarp uintptr)
86	purego.RegisterFunc(&rawCallback, x.xUnload)
87	return func(ModuleVar *TypeModule) {
88		rawCallback(ModuleVar.GoPointer())
89	}
90}
91
92// OverrideReserved1 sets the "reserved1" callback function.
93func (x *TypeModuleClass) OverrideReserved1(cb func()) {
94	if cb == nil {
95		x.xReserved1 = 0
96	} else {
97		x.xReserved1 = purego.NewCallback(func() {
98			cb()
99		})
100	}
101}
102
103// GetReserved1 gets the "reserved1" callback function.
104func (x *TypeModuleClass) GetReserved1() func() {
105	if x.xReserved1 == 0 {
106		return nil
107	}
108	var rawCallback func()
109	purego.RegisterFunc(&rawCallback, x.xReserved1)
110	return func() {
111		rawCallback()
112	}
113}
114
115// OverrideReserved2 sets the "reserved2" callback function.
116func (x *TypeModuleClass) OverrideReserved2(cb func()) {
117	if cb == nil {
118		x.xReserved2 = 0
119	} else {
120		x.xReserved2 = purego.NewCallback(func() {
121			cb()
122		})
123	}
124}
125
126// GetReserved2 gets the "reserved2" callback function.
127func (x *TypeModuleClass) GetReserved2() func() {
128	if x.xReserved2 == 0 {
129		return nil
130	}
131	var rawCallback func()
132	purego.RegisterFunc(&rawCallback, x.xReserved2)
133	return func() {
134		rawCallback()
135	}
136}
137
138// OverrideReserved3 sets the "reserved3" callback function.
139func (x *TypeModuleClass) OverrideReserved3(cb func()) {
140	if cb == nil {
141		x.xReserved3 = 0
142	} else {
143		x.xReserved3 = purego.NewCallback(func() {
144			cb()
145		})
146	}
147}
148
149// GetReserved3 gets the "reserved3" callback function.
150func (x *TypeModuleClass) GetReserved3() func() {
151	if x.xReserved3 == 0 {
152		return nil
153	}
154	var rawCallback func()
155	purego.RegisterFunc(&rawCallback, x.xReserved3)
156	return func() {
157		rawCallback()
158	}
159}
160
161// OverrideReserved4 sets the "reserved4" callback function.
162func (x *TypeModuleClass) OverrideReserved4(cb func()) {
163	if cb == nil {
164		x.xReserved4 = 0
165	} else {
166		x.xReserved4 = purego.NewCallback(func() {
167			cb()
168		})
169	}
170}
171
172// GetReserved4 gets the "reserved4" callback function.
173func (x *TypeModuleClass) GetReserved4() func() {
174	if x.xReserved4 == 0 {
175		return nil
176	}
177	var rawCallback func()
178	purego.RegisterFunc(&rawCallback, x.xReserved4)
179	return func() {
180		rawCallback()
181	}
182}
183
184// `GTypeModule` provides a simple implementation of the `GTypePlugin`
185// interface.
186//
187// The model of `GTypeModule` is a dynamically loaded module which
188// implements some number of types and interface implementations.
189//
190// When the module is loaded, it registers its types and interfaces
191// using [method@GObject.TypeModule.register_type] and
192// [method@GObject.TypeModule.add_interface].
193// As long as any instances of these types and interface implementations
194// are in use, the module is kept loaded. When the types and interfaces
195// are gone, the module may be unloaded. If the types and interfaces
196// become used again, the module will be reloaded. Note that the last
197// reference cannot be released from within the module code, since that
198// would lead to the caller's code being unloaded before `g_object_unref()`
199// returns to it.
200//
201// Keeping track of whether the module should be loaded or not is done by
202// using a use count - it starts at zero, and whenever it is greater than
203// zero, the module is loaded. The use count is maintained internally by
204// the type system, but also can be explicitly controlled by
205// [method@GObject.TypeModule.use] and [method@GObject.TypeModule.unuse].
206// Typically, when loading a module for the first type, `g_type_module_use()`
207// will be used to load it so that it can initialize its types. At some later
208// point, when the module no longer needs to be loaded except for the type
209// implementations it contains, `g_type_module_unuse()` is called.
210//
211// `GTypeModule` does not actually provide any implementation of module
212// loading and unloading. To create a particular module type you must
213// derive from `GTypeModule` and implement the load and unload functions
214// in `GTypeModuleClass`.
215type TypeModule struct {
216	Object
217}
218
219var xTypeModuleGLibType func() types.GType
220
221func TypeModuleGLibType() types.GType {
222	return xTypeModuleGLibType()
223}
224
225func TypeModuleNewFromInternalPtr(ptr uintptr) *TypeModule {
226	cls := &TypeModule{}
227	cls.Ptr = ptr
228	return cls
229}
230
231var xTypeModuleAddInterface func(uintptr, types.GType, types.GType, *InterfaceInfo)
232
233// Registers an additional interface for a type, whose interface lives
234// in the given type plugin. If the interface was already registered
235// for the type in this plugin, nothing will be done.
236//
237// As long as any instances of the type exist, the type plugin will
238// not be unloaded.
239//
240// Since 2.56 if @module is %NULL this will call g_type_add_interface_static()
241// instead. This can be used when making a static build of the module.
242func (x *TypeModule) AddInterface(InstanceTypeVar types.GType, InterfaceTypeVar types.GType, InterfaceInfoVar *InterfaceInfo) {
243
244	xTypeModuleAddInterface(x.GoPointer(), InstanceTypeVar, InterfaceTypeVar, InterfaceInfoVar)
245
246}
247
248var xTypeModuleRegisterEnum func(uintptr, string, []EnumValue) types.GType
249
250// Looks up or registers an enumeration that is implemented with a particular
251// type plugin. If a type with name @type_name was previously registered,
252// the #GType identifier for the type is returned, otherwise the type
253// is newly registered, and the resulting #GType identifier returned.
254//
255// As long as any instances of the type exist, the type plugin will
256// not be unloaded.
257//
258// Since 2.56 if @module is %NULL this will call g_type_register_static()
259// instead. This can be used when making a static build of the module.
260func (x *TypeModule) RegisterEnum(NameVar string, ConstStaticValuesVar []EnumValue) types.GType {
261
262	cret := xTypeModuleRegisterEnum(x.GoPointer(), NameVar, ConstStaticValuesVar)
263	return cret
264}
265
266var xTypeModuleRegisterFlags func(uintptr, string, []FlagsValue) types.GType
267
268// Looks up or registers a flags type that is implemented with a particular
269// type plugin. If a type with name @type_name was previously registered,
270// the #GType identifier for the type is returned, otherwise the type
271// is newly registered, and the resulting #GType identifier returned.
272//
273// As long as any instances of the type exist, the type plugin will
274// not be unloaded.
275//
276// Since 2.56 if @module is %NULL this will call g_type_register_static()
277// instead. This can be used when making a static build of the module.
278func (x *TypeModule) RegisterFlags(NameVar string, ConstStaticValuesVar []FlagsValue) types.GType {
279
280	cret := xTypeModuleRegisterFlags(x.GoPointer(), NameVar, ConstStaticValuesVar)
281	return cret
282}
283
284var xTypeModuleRegisterType func(uintptr, types.GType, string, *TypeInfo, TypeFlags) types.GType
285
286// Looks up or registers a type that is implemented with a particular
287// type plugin. If a type with name @type_name was previously registered,
288// the #GType identifier for the type is returned, otherwise the type
289// is newly registered, and the resulting #GType identifier returned.
290//
291// When reregistering a type (typically because a module is unloaded
292// then reloaded, and reinitialized), @module and @parent_type must
293// be the same as they were previously.
294//
295// As long as any instances of the type exist, the type plugin will
296// not be unloaded.
297//
298// Since 2.56 if @module is %NULL this will call g_type_register_static()
299// instead. This can be used when making a static build of the module.
300func (x *TypeModule) RegisterType(ParentTypeVar types.GType, TypeNameVar string, TypeInfoVar *TypeInfo, FlagsVar TypeFlags) types.GType {
301
302	cret := xTypeModuleRegisterType(x.GoPointer(), ParentTypeVar, TypeNameVar, TypeInfoVar, FlagsVar)
303	return cret
304}
305
306var xTypeModuleSetName func(uintptr, string)
307
308// Sets the name for a #GTypeModule
309func (x *TypeModule) SetName(NameVar string) {
310
311	xTypeModuleSetName(x.GoPointer(), NameVar)
312
313}
314
315var xTypeModuleUnuse func(uintptr)
316
317// Decreases the use count of a #GTypeModule by one. If the
318// result is zero, the module will be unloaded. (However, the
319// #GTypeModule will not be freed, and types associated with the
320// #GTypeModule are not unregistered. Once a #GTypeModule is
321// initialized, it must exist forever.)
322func (x *TypeModule) Unuse() {
323
324	xTypeModuleUnuse(x.GoPointer())
325
326}
327
328var xTypeModuleUse func(uintptr) bool
329
330// Increases the use count of a #GTypeModule by one. If the
331// use count was zero before, the plugin will be loaded.
332// If loading the plugin fails, the use count is reset to
333// its prior value.
334func (x *TypeModule) Use() bool {
335
336	cret := xTypeModuleUse(x.GoPointer())
337	return cret
338}
339
340func (c *TypeModule) GoPointer() uintptr {
341	if c == nil {
342		return 0
343	}
344	return c.Ptr
345}
346
347func (c *TypeModule) SetGoPointer(ptr uintptr) {
348	c.Ptr = ptr
349}
350
351// Calls the @complete_interface_info function from the
352// #GTypePluginClass of @plugin. There should be no need to use this
353// function outside of the GObject type system itself.
354func (x *TypeModule) CompleteInterfaceInfo(InstanceTypeVar types.GType, InterfaceTypeVar types.GType, InfoVar *InterfaceInfo) {
355
356	XGTypePluginCompleteInterfaceInfo(x.GoPointer(), InstanceTypeVar, InterfaceTypeVar, InfoVar)
357
358}
359
360// Calls the @complete_type_info function from the #GTypePluginClass of @plugin.
361// There should be no need to use this function outside of the GObject
362// type system itself.
363func (x *TypeModule) CompleteTypeInfo(GTypeVar types.GType, InfoVar *TypeInfo, ValueTableVar *TypeValueTable) {
364
365	XGTypePluginCompleteTypeInfo(x.GoPointer(), GTypeVar, InfoVar, ValueTableVar)
366
367}
368
369func init() {
370	core.SetPackageName("GOBJECT", "gobject-2.0")
371	core.SetSharedLibraries("GOBJECT", []string{"libgobject-2.0.so.0"})
372	var libs []uintptr
373	for _, libPath := range core.GetPaths("GOBJECT") {
374		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
375		if err != nil {
376			panic(err)
377		}
378		libs = append(libs, lib)
379	}
380
381	core.PuregoSafeRegister(&xTypeModuleGLibType, libs, "g_type_module_get_type")
382
383	core.PuregoSafeRegister(&xTypeModuleAddInterface, libs, "g_type_module_add_interface")
384	core.PuregoSafeRegister(&xTypeModuleRegisterEnum, libs, "g_type_module_register_enum")
385	core.PuregoSafeRegister(&xTypeModuleRegisterFlags, libs, "g_type_module_register_flags")
386	core.PuregoSafeRegister(&xTypeModuleRegisterType, libs, "g_type_module_register_type")
387	core.PuregoSafeRegister(&xTypeModuleSetName, libs, "g_type_module_set_name")
388	core.PuregoSafeRegister(&xTypeModuleUnuse, libs, "g_type_module_unuse")
389	core.PuregoSafeRegister(&xTypeModuleUse, libs, "g_type_module_use")
390
391}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 102

↑↓ moveenter openesc close