v0.2.2 9100209

ghook.go RawHistoryFolder

1// Package glib was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package glib
3
4import (
5	"structs"
6	"unsafe"
7
8	"github.com/ebitengine/purego"
9
10	"github.com/bnema/puregotk/pkg/core"
11)
12
13// Defines the type of a hook function that can be invoked
14// by g_hook_list_invoke_check().
15type HookCheckFunc func(uintptr) bool
16
17// Defines the type of function used by g_hook_list_marshal_check().
18type HookCheckMarshaller func(*Hook, uintptr) bool
19
20// Defines the type of function used to compare #GHook elements in
21// g_hook_insert_sorted().
22type HookCompareFunc func(*Hook, *Hook) int
23
24// Defines the type of function to be called when a hook in a
25// list of hooks gets finalized.
26type HookFinalizeFunc func(*HookList, *Hook)
27
28// Defines the type of the function passed to g_hook_find().
29type HookFindFunc func(*Hook, uintptr) bool
30
31// Defines the type of a hook function that can be invoked
32// by g_hook_list_invoke().
33type HookFunc func(uintptr)
34
35// Defines the type of function used by g_hook_list_marshal().
36type HookMarshaller func(*Hook, uintptr)
37
38// The #GHook struct represents a single hook function in a #GHookList.
39type Hook struct {
40	_ structs.HostLayout
41
42	Data uintptr
43
44	Next *Hook
45
46	Prev *Hook
47
48	RefCount uint
49
50	HookId uint
51
52	Flags uint
53
54	Func uintptr
55
56	Destroy DestroyNotify
57}
58
59func (x *Hook) GoPointer() uintptr {
60	return uintptr(unsafe.Pointer(x))
61}
62
63var xHookCompareIds func(uintptr, *Hook) int
64
65// Compares the ids of two #GHook elements, returning a negative value
66// if the second id is greater than the first.
67func (x *Hook) CompareIds(SiblingVar *Hook) int {
68
69	cret := xHookCompareIds(x.GoPointer(), SiblingVar)
70	return cret
71}
72
73// The #GHookList struct represents a list of hook functions.
74type HookList struct {
75	_ structs.HostLayout
76
77	SeqId uint
78
79	HookSize uint
80
81	IsSetup uint
82
83	Hooks *Hook
84
85	Dummy3 uintptr
86
87	FinalizeHook HookFinalizeFunc
88
89	Dummy [2]uintptr
90}
91
92func (x *HookList) GoPointer() uintptr {
93	return uintptr(unsafe.Pointer(x))
94}
95
96var xHookListClear func(uintptr)
97
98// Removes all the #GHook elements from a #GHookList.
99func (x *HookList) Clear() {
100
101	xHookListClear(x.GoPointer())
102
103}
104
105var xHookListInit func(uintptr, uint)
106
107// Initializes a #GHookList.
108// This must be called before the #GHookList is used.
109func (x *HookList) Init(HookSizeVar uint) {
110
111	xHookListInit(x.GoPointer(), HookSizeVar)
112
113}
114
115var xHookListInvoke func(uintptr, bool)
116
117// Calls all of the #GHook functions in a #GHookList.
118func (x *HookList) Invoke(MayRecurseVar bool) {
119
120	xHookListInvoke(x.GoPointer(), MayRecurseVar)
121
122}
123
124var xHookListInvokeCheck func(uintptr, bool)
125
126// Calls all of the #GHook functions in a #GHookList.
127// Any function which returns %FALSE is removed from the #GHookList.
128func (x *HookList) InvokeCheck(MayRecurseVar bool) {
129
130	xHookListInvokeCheck(x.GoPointer(), MayRecurseVar)
131
132}
133
134var xHookListMarshal func(uintptr, bool, uintptr, uintptr)
135
136// Calls a function on each valid #GHook.
137func (x *HookList) Marshal(MayRecurseVar bool, MarshallerVar *HookMarshaller, MarshalDataVar uintptr) {
138
139	var MarshallerVarRef uintptr
140	if MarshallerVar != nil {
141		MarshallerVarPtr := uintptr(unsafe.Pointer(MarshallerVar))
142		if cbRefPtr, ok := GetCallback(MarshallerVarPtr); ok {
143			MarshallerVarRef = cbRefPtr
144		} else {
145			fcb := func(arg0 *Hook, arg1 uintptr) {
146				cbFn := *MarshallerVar
147				cbFn(arg0, arg1)
148			}
149			MarshallerVarRef = purego.NewCallback(fcb)
150			SaveCallbackWithClosure(MarshallerVarPtr, MarshallerVarRef, MarshallerVar)
151		}
152	}
153
154	xHookListMarshal(x.GoPointer(), MayRecurseVar, MarshallerVarRef, MarshalDataVar)
155
156}
157
158var xHookListMarshalCheck func(uintptr, bool, uintptr, uintptr)
159
160// Calls a function on each valid #GHook and destroys it if the
161// function returns %FALSE.
162func (x *HookList) MarshalCheck(MayRecurseVar bool, MarshallerVar *HookCheckMarshaller, MarshalDataVar uintptr) {
163
164	var MarshallerVarRef uintptr
165	if MarshallerVar != nil {
166		MarshallerVarPtr := uintptr(unsafe.Pointer(MarshallerVar))
167		if cbRefPtr, ok := GetCallback(MarshallerVarPtr); ok {
168			MarshallerVarRef = cbRefPtr
169		} else {
170			fcb := func(arg0 *Hook, arg1 uintptr) bool {
171				cbFn := *MarshallerVar
172				return cbFn(arg0, arg1)
173			}
174			MarshallerVarRef = purego.NewCallback(fcb)
175			SaveCallbackWithClosure(MarshallerVarPtr, MarshallerVarRef, MarshallerVar)
176		}
177	}
178
179	xHookListMarshalCheck(x.GoPointer(), MayRecurseVar, MarshallerVarRef, MarshalDataVar)
180
181}
182
183const (
184	// The position of the first bit which is not reserved for internal
185	// use be the #GHook implementation, i.e.
186	// `1 << G_HOOK_FLAG_USER_SHIFT` is the first
187	// bit which can be used for application-defined flags.
188	HOOK_FLAG_USER_SHIFT int = 4
189)
190
191// Flags used internally in the #GHook implementation.
192type HookFlagMask int
193
194const (
195
196	// set if the hook has not been destroyed
197	GHookFlagActiveValue HookFlagMask = 1
198	// set if the hook is currently being run
199	GHookFlagInCallValue HookFlagMask = 2
200	// A mask covering all bits reserved for
201	//   hook flags; see %G_HOOK_FLAG_USER_SHIFT
202	GHookFlagMaskValue HookFlagMask = 15
203)
204
205var xHookDestroy func(*HookList, uint) bool
206
207// Destroys a #GHook, given its ID.
208func HookDestroy(HookListVar *HookList, HookIdVar uint) bool {
209
210	cret := xHookDestroy(HookListVar, HookIdVar)
211
212	return cret
213}
214
215var xHookDestroyLink func(*HookList, *Hook)
216
217// Removes one #GHook from a #GHookList, marking it
218// inactive and calling g_hook_unref() on it.
219func HookDestroyLink(HookListVar *HookList, HookVar *Hook) {
220
221	xHookDestroyLink(HookListVar, HookVar)
222
223}
224
225var xHookFree func(*HookList, *Hook)
226
227// Calls the #GHookList @finalize_hook function if it exists,
228// and frees the memory allocated for the #GHook.
229func HookFree(HookListVar *HookList, HookVar *Hook) {
230
231	xHookFree(HookListVar, HookVar)
232
233}
234
235var xHookInsertBefore func(*HookList, *Hook, *Hook)
236
237// Inserts a #GHook into a #GHookList, before a given #GHook.
238func HookInsertBefore(HookListVar *HookList, SiblingVar *Hook, HookVar *Hook) {
239
240	xHookInsertBefore(HookListVar, SiblingVar, HookVar)
241
242}
243
244var xHookInsertSorted func(*HookList, *Hook, uintptr)
245
246// Inserts a #GHook into a #GHookList, sorted by the given function.
247func HookInsertSorted(HookListVar *HookList, HookVar *Hook, FuncVar *HookCompareFunc) {
248
249	var FuncVarRef uintptr
250	if FuncVar != nil {
251		FuncVarPtr := uintptr(unsafe.Pointer(FuncVar))
252		if cbRefPtr, ok := GetCallback(FuncVarPtr); ok {
253			FuncVarRef = cbRefPtr
254		} else {
255			fcb := func(arg0 *Hook, arg1 *Hook) int {
256				cbFn := *FuncVar
257				return cbFn(arg0, arg1)
258			}
259			FuncVarRef = purego.NewCallback(fcb)
260			SaveCallbackWithClosure(FuncVarPtr, FuncVarRef, FuncVar)
261		}
262	}
263
264	xHookInsertSorted(HookListVar, HookVar, FuncVarRef)
265
266}
267
268var xHookPrepend func(*HookList, *Hook)
269
270// Prepends a #GHook on the start of a #GHookList.
271func HookPrepend(HookListVar *HookList, HookVar *Hook) {
272
273	xHookPrepend(HookListVar, HookVar)
274
275}
276
277var xHookUnref func(*HookList, *Hook)
278
279// Decrements the reference count of a #GHook.
280// If the reference count falls to 0, the #GHook is removed
281// from the #GHookList and g_hook_free() is called to free it.
282func HookUnref(HookListVar *HookList, HookVar *Hook) {
283
284	xHookUnref(HookListVar, HookVar)
285
286}
287
288func init() {
289	core.SetPackageName("GLIB", "glib-2.0")
290	core.SetSharedLibraries("GLIB", []string{"libgobject-2.0.so.0", "libglib-2.0.so.0"})
291	var libs []uintptr
292	for _, libPath := range core.GetPaths("GLIB") {
293		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
294		if err != nil {
295			panic(err)
296		}
297		libs = append(libs, lib)
298	}
299
300	core.PuregoSafeRegister(&xHookDestroy, libs, "g_hook_destroy")
301	core.PuregoSafeRegister(&xHookDestroyLink, libs, "g_hook_destroy_link")
302	core.PuregoSafeRegister(&xHookFree, libs, "g_hook_free")
303	core.PuregoSafeRegister(&xHookInsertBefore, libs, "g_hook_insert_before")
304	core.PuregoSafeRegister(&xHookInsertSorted, libs, "g_hook_insert_sorted")
305	core.PuregoSafeRegister(&xHookPrepend, libs, "g_hook_prepend")
306	core.PuregoSafeRegister(&xHookUnref, libs, "g_hook_unref")
307
308	core.PuregoSafeRegister(&xHookCompareIds, libs, "g_hook_compare_ids")
309
310	core.PuregoSafeRegister(&xHookListClear, libs, "g_hook_list_clear")
311	core.PuregoSafeRegister(&xHookListInit, libs, "g_hook_list_init")
312	core.PuregoSafeRegister(&xHookListInvoke, libs, "g_hook_list_invoke")
313	core.PuregoSafeRegister(&xHookListInvokeCheck, libs, "g_hook_list_invoke_check")
314	core.PuregoSafeRegister(&xHookListMarshal, libs, "g_hook_list_marshal")
315	core.PuregoSafeRegister(&xHookListMarshalCheck, libs, "g_hook_list_marshal_check")
316
317}

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