v0.2.1 c0399be

gtkcustomsorter.go RawHistoryFolder

1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
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
15type CustomSorterClass struct {
16	_ structs.HostLayout
17
18	ParentClass SorterClass
19}
20
21func (x *CustomSorterClass) GoPointer() uintptr {
22	return uintptr(unsafe.Pointer(x))
23}
24
25// Sorts items via a callback function.
26type CustomSorter struct {
27	Sorter
28}
29
30var xCustomSorterGLibType func() types.GType
31
32func CustomSorterGLibType() types.GType {
33	return xCustomSorterGLibType()
34}
35
36func CustomSorterNewFromInternalPtr(ptr uintptr) *CustomSorter {
37	cls := &CustomSorter{}
38	cls.Ptr = ptr
39	return cls
40}
41
42var xNewCustomSorter func(uintptr, uintptr, uintptr) uintptr
43
44// Creates a new `GtkSorter` that works by calling
45// @sort_func to compare items.
46//
47// If @sort_func is %NULL, all items are considered equal.
48func NewCustomSorter(SortFuncVar *glib.CompareDataFunc, UserDataVar uintptr, UserDestroyVar *glib.DestroyNotify) *CustomSorter {
49	var cls *CustomSorter
50
51	var SortFuncVarRef uintptr
52	if SortFuncVar != nil {
53		SortFuncVarPtr := uintptr(unsafe.Pointer(SortFuncVar))
54		if cbRefPtr, ok := glib.GetCallback(SortFuncVarPtr); ok {
55			SortFuncVarRef = cbRefPtr
56		} else {
57			fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) int {
58				cbFn := *SortFuncVar
59				return cbFn(arg0, arg1, arg2)
60			}
61			SortFuncVarRef = purego.NewCallback(fcb)
62			glib.SaveCallbackWithClosure(SortFuncVarPtr, SortFuncVarRef, SortFuncVar)
63		}
64	}
65
66	var UserDestroyVarRef uintptr
67	if UserDestroyVar != nil {
68		UserDestroyVarPtr := uintptr(unsafe.Pointer(UserDestroyVar))
69		if cbRefPtr, ok := glib.GetCallback(UserDestroyVarPtr); ok {
70			UserDestroyVarRef = cbRefPtr
71		} else {
72			fcb := func(arg0 uintptr) {
73				cbFn := *UserDestroyVar
74				cbFn(arg0)
75			}
76			UserDestroyVarRef = purego.NewCallback(fcb)
77			glib.SaveCallbackWithClosure(UserDestroyVarPtr, UserDestroyVarRef, UserDestroyVar)
78		}
79	}
80
81	cret := xNewCustomSorter(SortFuncVarRef, UserDataVar, UserDestroyVarRef)
82
83	if cret == 0 {
84		return nil
85	}
86	cls = &CustomSorter{}
87	cls.Ptr = cret
88	return cls
89}
90
91var xCustomSorterSetSortFunc func(uintptr, uintptr, uintptr, uintptr)
92
93// Sets (or unsets) the function used for sorting items.
94//
95// If @sort_func is %NULL, all items are considered equal.
96//
97// If the sort func changes its sorting behavior,
98// gtk_sorter_changed() needs to be called.
99//
100// If a previous function was set, its @user_destroy will be
101// called now.
102func (x *CustomSorter) SetSortFunc(SortFuncVar *glib.CompareDataFunc, UserDataVar uintptr, UserDestroyVar *glib.DestroyNotify) {
103
104	var SortFuncVarRef uintptr
105	if SortFuncVar != nil {
106		SortFuncVarPtr := uintptr(unsafe.Pointer(SortFuncVar))
107		if cbRefPtr, ok := glib.GetCallback(SortFuncVarPtr); ok {
108			SortFuncVarRef = cbRefPtr
109		} else {
110			fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) int {
111				cbFn := *SortFuncVar
112				return cbFn(arg0, arg1, arg2)
113			}
114			SortFuncVarRef = purego.NewCallback(fcb)
115			glib.SaveCallbackWithClosure(SortFuncVarPtr, SortFuncVarRef, SortFuncVar)
116		}
117	}
118
119	var UserDestroyVarRef uintptr
120	if UserDestroyVar != nil {
121		UserDestroyVarPtr := uintptr(unsafe.Pointer(UserDestroyVar))
122		if cbRefPtr, ok := glib.GetCallback(UserDestroyVarPtr); ok {
123			UserDestroyVarRef = cbRefPtr
124		} else {
125			fcb := func(arg0 uintptr) {
126				cbFn := *UserDestroyVar
127				cbFn(arg0)
128			}
129			UserDestroyVarRef = purego.NewCallback(fcb)
130			glib.SaveCallbackWithClosure(UserDestroyVarPtr, UserDestroyVarRef, UserDestroyVar)
131		}
132	}
133
134	xCustomSorterSetSortFunc(x.GoPointer(), SortFuncVarRef, UserDataVar, UserDestroyVarRef)
135
136}
137
138func (c *CustomSorter) GoPointer() uintptr {
139	if c == nil {
140		return 0
141	}
142	return c.Ptr
143}
144
145func (c *CustomSorter) SetGoPointer(ptr uintptr) {
146	c.Ptr = ptr
147}
148
149func init() {
150	core.SetPackageName("GTK", "gtk4")
151	core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
152	var libs []uintptr
153	for _, libPath := range core.GetPaths("GTK") {
154		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
155		if err != nil {
156			panic(err)
157		}
158		libs = append(libs, lib)
159	}
160
161	core.PuregoSafeRegister(&xCustomSorterGLibType, libs, "gtk_custom_sorter_get_type")
162
163	core.PuregoSafeRegister(&xNewCustomSorter, libs, "gtk_custom_sorter_new")
164
165	core.PuregoSafeRegister(&xCustomSorterSetSortFunc, libs, "gtk_custom_sorter_set_sort_func")
166
167}

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