v0.2.1 c0399be

gactionmap.go RawHistoryFolder

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
16// This struct defines a single action.  It is for use with
17// [method@Gio.ActionMap.add_action_entries].
18//
19// The order of the items in the structure are intended to reflect
20// frequency of use.  It is permissible to use an incomplete initialiser
21// in order to leave some of the later values as `NULL`.  All values
22// after @name are optional.  Additional optional fields may be added in
23// the future.
24//
25// See [method@Gio.ActionMap.add_action_entries] for an example.
26type ActionEntry struct {
27	_ structs.HostLayout
28
29	Name uintptr
30
31	xActivate uintptr
32
33	ParameterType uintptr
34
35	State uintptr
36
37	xChangeState uintptr
38
39	Padding [3]uint
40}
41
42func (x *ActionEntry) GoPointer() uintptr {
43	return uintptr(unsafe.Pointer(x))
44}
45
46// OverrideActivate sets the "activate" callback function.
47// the callback to connect to the "activate" signal of the action.
48//
49//	Since GLib 2.40, this can be `NULL` for stateful actions, in which case
50//	the default handler is used. For boolean-stated actions with no
51//	parameter, this is a toggle. For other state types (and parameter type
52//	equal to the state type) this will be a function that just calls
53//	@change_state (which you should provide).
54func (x *ActionEntry) OverrideActivate(cb func(*SimpleAction, *glib.Variant, uintptr)) {
55	if cb == nil {
56		x.xActivate = 0
57	} else {
58		x.xActivate = purego.NewCallback(func(ActionVarp uintptr, ParameterVarp *glib.Variant, UserDataVarp uintptr) {
59			cb(SimpleActionNewFromInternalPtr(ActionVarp), ParameterVarp, UserDataVarp)
60		})
61	}
62}
63
64// GetActivate gets the "activate" callback function.
65// the callback to connect to the "activate" signal of the action.
66//
67//	Since GLib 2.40, this can be `NULL` for stateful actions, in which case
68//	the default handler is used. For boolean-stated actions with no
69//	parameter, this is a toggle. For other state types (and parameter type
70//	equal to the state type) this will be a function that just calls
71//	@change_state (which you should provide).
72func (x *ActionEntry) GetActivate() func(*SimpleAction, *glib.Variant, uintptr) {
73	if x.xActivate == 0 {
74		return nil
75	}
76	var rawCallback func(ActionVarp uintptr, ParameterVarp *glib.Variant, UserDataVarp uintptr)
77	purego.RegisterFunc(&rawCallback, x.xActivate)
78	return func(ActionVar *SimpleAction, ParameterVar *glib.Variant, UserDataVar uintptr) {
79		rawCallback(ActionVar.GoPointer(), ParameterVar, UserDataVar)
80	}
81}
82
83// OverrideChangeState sets the "change_state" callback function.
84// the callback to connect to the "change-state" signal of the
85//
86//	action.  All stateful actions should provide a handler here; stateless
87//	actions should not.
88func (x *ActionEntry) OverrideChangeState(cb func(*SimpleAction, *glib.Variant, uintptr)) {
89	if cb == nil {
90		x.xChangeState = 0
91	} else {
92		x.xChangeState = purego.NewCallback(func(ActionVarp uintptr, ValueVarp *glib.Variant, UserDataVarp uintptr) {
93			cb(SimpleActionNewFromInternalPtr(ActionVarp), ValueVarp, UserDataVarp)
94		})
95	}
96}
97
98// GetChangeState gets the "change_state" callback function.
99// the callback to connect to the "change-state" signal of the
100//
101//	action.  All stateful actions should provide a handler here; stateless
102//	actions should not.
103func (x *ActionEntry) GetChangeState() func(*SimpleAction, *glib.Variant, uintptr) {
104	if x.xChangeState == 0 {
105		return nil
106	}
107	var rawCallback func(ActionVarp uintptr, ValueVarp *glib.Variant, UserDataVarp uintptr)
108	purego.RegisterFunc(&rawCallback, x.xChangeState)
109	return func(ActionVar *SimpleAction, ValueVar *glib.Variant, UserDataVar uintptr) {
110		rawCallback(ActionVar.GoPointer(), ValueVar, UserDataVar)
111	}
112}
113
114// The virtual function table for [iface@Gio.ActionMap].
115type ActionMapInterface struct {
116	_ structs.HostLayout
117
118	GIface uintptr
119
120	xLookupAction uintptr
121
122	xAddAction uintptr
123
124	xRemoveAction uintptr
125}
126
127func (x *ActionMapInterface) GoPointer() uintptr {
128	return uintptr(unsafe.Pointer(x))
129}
130
131// OverrideLookupAction sets the "lookup_action" callback function.
132// the virtual function pointer for
133//
134//	[method@Gio.ActionMap.lookup_action]
135func (x *ActionMapInterface) OverrideLookupAction(cb func(ActionMap, string) *ActionBase) {
136	if cb == nil {
137		x.xLookupAction = 0
138	} else {
139		x.xLookupAction = purego.NewCallback(func(ActionMapVarp uintptr, ActionNameVarp string) uintptr {
140			ret := cb(&ActionMapBase{Ptr: ActionMapVarp}, ActionNameVarp)
141			if ret == nil {
142				return 0
143			}
144			return ret.GoPointer()
145		})
146	}
147}
148
149// GetLookupAction gets the "lookup_action" callback function.
150// the virtual function pointer for
151//
152//	[method@Gio.ActionMap.lookup_action]
153func (x *ActionMapInterface) GetLookupAction() func(ActionMap, string) *ActionBase {
154	if x.xLookupAction == 0 {
155		return nil
156	}
157	var rawCallback func(ActionMapVarp uintptr, ActionNameVarp string) uintptr
158	purego.RegisterFunc(&rawCallback, x.xLookupAction)
159	return func(ActionMapVar ActionMap, ActionNameVar string) *ActionBase {
160		rawRet := rawCallback(ActionMapVar.GoPointer(), ActionNameVar)
161		if rawRet == 0 {
162			return nil
163		}
164		ret := &ActionBase{}
165		ret.Ptr = rawRet
166		return ret
167	}
168}
169
170// OverrideAddAction sets the "add_action" callback function.
171// the virtual function pointer for
172//
173//	[method@Gio.ActionMap.add_action]
174func (x *ActionMapInterface) OverrideAddAction(cb func(ActionMap, Action)) {
175	if cb == nil {
176		x.xAddAction = 0
177	} else {
178		x.xAddAction = purego.NewCallback(func(ActionMapVarp uintptr, ActionVarp uintptr) {
179			cb(&ActionMapBase{Ptr: ActionMapVarp}, &ActionBase{Ptr: ActionVarp})
180		})
181	}
182}
183
184// GetAddAction gets the "add_action" callback function.
185// the virtual function pointer for
186//
187//	[method@Gio.ActionMap.add_action]
188func (x *ActionMapInterface) GetAddAction() func(ActionMap, Action) {
189	if x.xAddAction == 0 {
190		return nil
191	}
192	var rawCallback func(ActionMapVarp uintptr, ActionVarp uintptr)
193	purego.RegisterFunc(&rawCallback, x.xAddAction)
194	return func(ActionMapVar ActionMap, ActionVar Action) {
195		rawCallback(ActionMapVar.GoPointer(), ActionVar.GoPointer())
196	}
197}
198
199// OverrideRemoveAction sets the "remove_action" callback function.
200// the virtual function pointer for
201//
202//	[method@Gio.ActionMap.remove_action]
203func (x *ActionMapInterface) OverrideRemoveAction(cb func(ActionMap, string)) {
204	if cb == nil {
205		x.xRemoveAction = 0
206	} else {
207		x.xRemoveAction = purego.NewCallback(func(ActionMapVarp uintptr, ActionNameVarp string) {
208			cb(&ActionMapBase{Ptr: ActionMapVarp}, ActionNameVarp)
209		})
210	}
211}
212
213// GetRemoveAction gets the "remove_action" callback function.
214// the virtual function pointer for
215//
216//	[method@Gio.ActionMap.remove_action]
217func (x *ActionMapInterface) GetRemoveAction() func(ActionMap, string) {
218	if x.xRemoveAction == 0 {
219		return nil
220	}
221	var rawCallback func(ActionMapVarp uintptr, ActionNameVarp string)
222	purego.RegisterFunc(&rawCallback, x.xRemoveAction)
223	return func(ActionMapVar ActionMap, ActionNameVar string) {
224		rawCallback(ActionMapVar.GoPointer(), ActionNameVar)
225	}
226}
227
228// `GActionMap` is an interface for action containers.
229//
230// The `GActionMap` interface is implemented by [iface@Gio.ActionGroup]
231// implementations that operate by containing a number of named
232// [iface@Gio.Action] instances, such as [class@Gio.SimpleActionGroup].
233//
234// One useful application of this interface is to map the
235// names of actions from various action groups to unique,
236// prefixed names (e.g. by prepending "app." or "win.").
237// This is the motivation for the ‘Map’ part of the interface
238// name.
239type ActionMap interface {
240	GoPointer() uintptr
241	SetGoPointer(uintptr)
242	AddAction(ActionVar Action)
243	AddActionEntries(EntriesVar []ActionEntry, NEntriesVar int, UserDataVar uintptr)
244	LookupAction(ActionNameVar string) *ActionBase
245	RemoveAction(ActionNameVar string)
246	RemoveActionEntries(EntriesVar []ActionEntry, NEntriesVar int)
247}
248
249var xActionMapGLibType func() types.GType
250
251func ActionMapGLibType() types.GType {
252	return xActionMapGLibType()
253}
254
255type ActionMapBase struct {
256	Ptr uintptr
257}
258
259func (x *ActionMapBase) GoPointer() uintptr {
260	if x == nil {
261		return 0
262	}
263	return x.Ptr
264}
265
266func (x *ActionMapBase) SetGoPointer(ptr uintptr) {
267	x.Ptr = ptr
268}
269
270// Adds an action to the @action_map.
271//
272// If the action map already contains an action with the same name
273// as @action then the old action is dropped from the action map.
274//
275// The action map takes its own reference on @action.
276func (x *ActionMapBase) AddAction(ActionVar Action) {
277
278	XGActionMapAddAction(x.GoPointer(), ActionVar.GoPointer())
279
280}
281
282// A convenience function for creating multiple [class@Gio.SimpleAction]
283// instances and adding them to a [iface@Gio.ActionMap].
284//
285// Each action is constructed as per one [struct@Gio.ActionEntry].
286//
287// ```c
288// static void
289// activate_quit (GSimpleAction *simple,
290//
291//	GVariant      *parameter,
292//	gpointer       user_data)
293//
294//	{
295//	  exit (0);
296//	}
297//
298// static void
299// activate_print_string (GSimpleAction *simple,
300//
301//	GVariant      *parameter,
302//	gpointer       user_data)
303//
304//	{
305//	  g_print ("%s\n", g_variant_get_string (parameter, NULL));
306//	}
307//
308// static GActionGroup *
309// create_action_group (void)
310//
311//	{
312//	  const GActionEntry entries[] = {
313//	    { "quit",         activate_quit              },
314//	    { "print-string", activate_print_string, "s" }
315//	  };
316//	  GSimpleActionGroup *group;
317//
318//	  group = g_simple_action_group_new ();
319//	  g_action_map_add_action_entries (G_ACTION_MAP (group), entries, G_N_ELEMENTS (entries), NULL);
320//
321//	  return G_ACTION_GROUP (group);
322//	}
323//
324// ```
325func (x *ActionMapBase) AddActionEntries(EntriesVar []ActionEntry, NEntriesVar int, UserDataVar uintptr) {
326
327	XGActionMapAddActionEntries(x.GoPointer(), EntriesVar, NEntriesVar, UserDataVar)
328
329}
330
331// Looks up the action with the name @action_name in @action_map.
332//
333// If no such action exists, returns `NULL`.
334func (x *ActionMapBase) LookupAction(ActionNameVar string) *ActionBase {
335	var cls *ActionBase
336
337	cret := XGActionMapLookupAction(x.GoPointer(), ActionNameVar)
338
339	if cret == 0 {
340		return nil
341	}
342	gobject.IncreaseRef(cret)
343	cls = &ActionBase{}
344	cls.Ptr = cret
345	return cls
346}
347
348// Removes the named action from the action map.
349//
350// If no action of this name is in the map then nothing happens.
351func (x *ActionMapBase) RemoveAction(ActionNameVar string) {
352
353	XGActionMapRemoveAction(x.GoPointer(), ActionNameVar)
354
355}
356
357// Remove actions from a [iface@Gio.ActionMap]. This is meant as the reverse of
358// [method@Gio.ActionMap.add_action_entries].
359//
360// ```c
361//
362//	static const GActionEntry entries[] = {
363//	    { "quit",         activate_quit              },
364//	    { "print-string", activate_print_string, "s" }
365//	};
366//
367// void
368// add_actions (GActionMap *map)
369//
370//	{
371//	  g_action_map_add_action_entries (map, entries, G_N_ELEMENTS (entries), NULL);
372//	}
373//
374// void
375// remove_actions (GActionMap *map)
376//
377//	{
378//	  g_action_map_remove_action_entries (map, entries, G_N_ELEMENTS (entries));
379//	}
380//
381// ```
382func (x *ActionMapBase) RemoveActionEntries(EntriesVar []ActionEntry, NEntriesVar int) {
383
384	XGActionMapRemoveActionEntries(x.GoPointer(), EntriesVar, NEntriesVar)
385
386}
387
388var XGActionMapAddAction func(uintptr, uintptr)
389var XGActionMapAddActionEntries func(uintptr, []ActionEntry, int, uintptr)
390var XGActionMapLookupAction func(uintptr, string) uintptr
391var XGActionMapRemoveAction func(uintptr, string)
392var XGActionMapRemoveActionEntries func(uintptr, []ActionEntry, int)
393
394func init() {
395	core.SetPackageName("GIO", "gio-2.0")
396	core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"})
397	var libs []uintptr
398	for _, libPath := range core.GetPaths("GIO") {
399		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
400		if err != nil {
401			panic(err)
402		}
403		libs = append(libs, lib)
404	}
405
406	core.PuregoSafeRegister(&xActionMapGLibType, libs, "g_action_map_get_type")
407
408	core.PuregoSafeRegister(&XGActionMapAddAction, libs, "g_action_map_add_action")
409	core.PuregoSafeRegister(&XGActionMapAddActionEntries, libs, "g_action_map_add_action_entries")
410	core.PuregoSafeRegister(&XGActionMapLookupAction, libs, "g_action_map_lookup_action")
411	core.PuregoSafeRegister(&XGActionMapRemoveAction, libs, "g_action_map_remove_action")
412	core.PuregoSafeRegister(&XGActionMapRemoveActionEntries, libs, "g_action_map_remove_action_entries")
413
414}

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