v0.2.1 c0399be

gtkcustomfilter.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
15// User function that is called to determine if the @item should be matched.
16//
17// If the filter matches the item, this function must return true.
18// If the item should be filtered out, false must be returned.
19type CustomFilterFunc func(uintptr, uintptr) bool
20
21type CustomFilterClass struct {
22	_ structs.HostLayout
23
24	ParentClass FilterClass
25}
26
27func (x *CustomFilterClass) GoPointer() uintptr {
28	return uintptr(unsafe.Pointer(x))
29}
30
31// Determines whether to include items with a callback.
32type CustomFilter struct {
33	Filter
34}
35
36var xCustomFilterGLibType func() types.GType
37
38func CustomFilterGLibType() types.GType {
39	return xCustomFilterGLibType()
40}
41
42func CustomFilterNewFromInternalPtr(ptr uintptr) *CustomFilter {
43	cls := &CustomFilter{}
44	cls.Ptr = ptr
45	return cls
46}
47
48var xNewCustomFilter func(uintptr, uintptr, uintptr) uintptr
49
50// Creates a new filter using the given function to filter items.
51//
52// If @match_func is `NULL`, the filter matches all items.
53//
54// If the filter func changes its filtering behavior,
55// [method@Gtk.Filter.changed] needs to be called.
56func NewCustomFilter(MatchFuncVar *CustomFilterFunc, UserDataVar uintptr, UserDestroyVar *glib.DestroyNotify) *CustomFilter {
57	var cls *CustomFilter
58
59	var MatchFuncVarRef uintptr
60	if MatchFuncVar != nil {
61		MatchFuncVarPtr := uintptr(unsafe.Pointer(MatchFuncVar))
62		if cbRefPtr, ok := glib.GetCallback(MatchFuncVarPtr); ok {
63			MatchFuncVarRef = cbRefPtr
64		} else {
65			fcb := func(arg0 uintptr, arg1 uintptr) bool {
66				cbFn := *MatchFuncVar
67				return cbFn(arg0, arg1)
68			}
69			MatchFuncVarRef = purego.NewCallback(fcb)
70			glib.SaveCallbackWithClosure(MatchFuncVarPtr, MatchFuncVarRef, MatchFuncVar)
71		}
72	}
73
74	var UserDestroyVarRef uintptr
75	if UserDestroyVar != nil {
76		UserDestroyVarPtr := uintptr(unsafe.Pointer(UserDestroyVar))
77		if cbRefPtr, ok := glib.GetCallback(UserDestroyVarPtr); ok {
78			UserDestroyVarRef = cbRefPtr
79		} else {
80			fcb := func(arg0 uintptr) {
81				cbFn := *UserDestroyVar
82				cbFn(arg0)
83			}
84			UserDestroyVarRef = purego.NewCallback(fcb)
85			glib.SaveCallbackWithClosure(UserDestroyVarPtr, UserDestroyVarRef, UserDestroyVar)
86		}
87	}
88
89	cret := xNewCustomFilter(MatchFuncVarRef, UserDataVar, UserDestroyVarRef)
90
91	if cret == 0 {
92		return nil
93	}
94	cls = &CustomFilter{}
95	cls.Ptr = cret
96	return cls
97}
98
99var xCustomFilterSetFilterFunc func(uintptr, uintptr, uintptr, uintptr)
100
101// Sets the function used for filtering items.
102//
103// If @match_func is `NULL`, the filter matches all items.
104//
105// If the filter func changes its filtering behavior,
106// [method@Gtk.Filter.changed] needs to be called.
107//
108// If a previous function was set, its @user_destroy
109// will be called.
110func (x *CustomFilter) SetFilterFunc(MatchFuncVar *CustomFilterFunc, UserDataVar uintptr, UserDestroyVar *glib.DestroyNotify) {
111
112	var MatchFuncVarRef uintptr
113	if MatchFuncVar != nil {
114		MatchFuncVarPtr := uintptr(unsafe.Pointer(MatchFuncVar))
115		if cbRefPtr, ok := glib.GetCallback(MatchFuncVarPtr); ok {
116			MatchFuncVarRef = cbRefPtr
117		} else {
118			fcb := func(arg0 uintptr, arg1 uintptr) bool {
119				cbFn := *MatchFuncVar
120				return cbFn(arg0, arg1)
121			}
122			MatchFuncVarRef = purego.NewCallback(fcb)
123			glib.SaveCallbackWithClosure(MatchFuncVarPtr, MatchFuncVarRef, MatchFuncVar)
124		}
125	}
126
127	var UserDestroyVarRef uintptr
128	if UserDestroyVar != nil {
129		UserDestroyVarPtr := uintptr(unsafe.Pointer(UserDestroyVar))
130		if cbRefPtr, ok := glib.GetCallback(UserDestroyVarPtr); ok {
131			UserDestroyVarRef = cbRefPtr
132		} else {
133			fcb := func(arg0 uintptr) {
134				cbFn := *UserDestroyVar
135				cbFn(arg0)
136			}
137			UserDestroyVarRef = purego.NewCallback(fcb)
138			glib.SaveCallbackWithClosure(UserDestroyVarPtr, UserDestroyVarRef, UserDestroyVar)
139		}
140	}
141
142	xCustomFilterSetFilterFunc(x.GoPointer(), MatchFuncVarRef, UserDataVar, UserDestroyVarRef)
143
144}
145
146func (c *CustomFilter) GoPointer() uintptr {
147	if c == nil {
148		return 0
149	}
150	return c.Ptr
151}
152
153func (c *CustomFilter) SetGoPointer(ptr uintptr) {
154	c.Ptr = ptr
155}
156
157func init() {
158	core.SetPackageName("GTK", "gtk4")
159	core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
160	var libs []uintptr
161	for _, libPath := range core.GetPaths("GTK") {
162		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
163		if err != nil {
164			panic(err)
165		}
166		libs = append(libs, lib)
167	}
168
169	core.PuregoSafeRegister(&xCustomFilterGLibType, libs, "gtk_custom_filter_get_type")
170
171	core.PuregoSafeRegister(&xNewCustomFilter, libs, "gtk_custom_filter_new")
172
173	core.PuregoSafeRegister(&xCustomFilterSetFilterFunc, libs, "gtk_custom_filter_set_filter_func")
174
175}

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