v0.2.2 9100209

gsimpleactiongroup.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
16type SimpleActionGroupClass struct {
17	_ structs.HostLayout
18
19	ParentClass gobject.ObjectClass
20
21	Padding [12]uintptr
22}
23
24func (x *SimpleActionGroupClass) GoPointer() uintptr {
25	return uintptr(unsafe.Pointer(x))
26}
27
28type SimpleActionGroupPrivate struct {
29	_ structs.HostLayout
30}
31
32func (x *SimpleActionGroupPrivate) GoPointer() uintptr {
33	return uintptr(unsafe.Pointer(x))
34}
35
36// `GSimpleActionGroup` is a hash table filled with [iface@Gio.Action] objects,
37// implementing the [iface@Gio.ActionGroup] and [iface@Gio.ActionMap]
38// interfaces.
39type SimpleActionGroup struct {
40	gobject.Object
41}
42
43var xSimpleActionGroupGLibType func() types.GType
44
45func SimpleActionGroupGLibType() types.GType {
46	return xSimpleActionGroupGLibType()
47}
48
49func SimpleActionGroupNewFromInternalPtr(ptr uintptr) *SimpleActionGroup {
50	cls := &SimpleActionGroup{}
51	cls.Ptr = ptr
52	return cls
53}
54
55var xNewSimpleActionGroup func() uintptr
56
57// Creates a new, empty, #GSimpleActionGroup.
58func NewSimpleActionGroup() *SimpleActionGroup {
59	var cls *SimpleActionGroup
60
61	cret := xNewSimpleActionGroup()
62
63	if cret == 0 {
64		return nil
65	}
66	cls = &SimpleActionGroup{}
67	cls.Ptr = cret
68	return cls
69}
70
71var xSimpleActionGroupAddEntries func(uintptr, []ActionEntry, int, uintptr)
72
73// A convenience function for creating multiple #GSimpleAction instances
74// and adding them to the action group.
75func (x *SimpleActionGroup) AddEntries(EntriesVar []ActionEntry, NEntriesVar int, UserDataVar uintptr) {
76
77	xSimpleActionGroupAddEntries(x.GoPointer(), EntriesVar, NEntriesVar, UserDataVar)
78
79}
80
81var xSimpleActionGroupInsert func(uintptr, uintptr)
82
83// Adds an action to the action group.
84//
85// If the action group already contains an action with the same name as
86// @action then the old action is dropped from the group.
87//
88// The action group takes its own reference on @action.
89func (x *SimpleActionGroup) Insert(ActionVar Action) {
90
91	xSimpleActionGroupInsert(x.GoPointer(), ActionVar.GoPointer())
92
93}
94
95var xSimpleActionGroupLookup func(uintptr, string) uintptr
96
97// Looks up the action with the name @action_name in the group.
98//
99// If no such action exists, returns %NULL.
100func (x *SimpleActionGroup) Lookup(ActionNameVar string) *ActionBase {
101	var cls *ActionBase
102
103	cret := xSimpleActionGroupLookup(x.GoPointer(), ActionNameVar)
104
105	if cret == 0 {
106		return nil
107	}
108	gobject.IncreaseRef(cret)
109	cls = &ActionBase{}
110	cls.Ptr = cret
111	return cls
112}
113
114var xSimpleActionGroupRemove func(uintptr, string)
115
116// Removes the named action from the action group.
117//
118// If no action of this name is in the group then nothing happens.
119func (x *SimpleActionGroup) Remove(ActionNameVar string) {
120
121	xSimpleActionGroupRemove(x.GoPointer(), ActionNameVar)
122
123}
124
125func (c *SimpleActionGroup) GoPointer() uintptr {
126	if c == nil {
127		return 0
128	}
129	return c.Ptr
130}
131
132func (c *SimpleActionGroup) SetGoPointer(ptr uintptr) {
133	c.Ptr = ptr
134}
135
136// Emits the [signal@Gio.ActionGroup::action-added] signal on @action_group.
137//
138// This function should only be called by [type@Gio.ActionGroup] implementations.
139func (x *SimpleActionGroup) ActionAdded(ActionNameVar string) {
140
141	XGActionGroupActionAdded(x.GoPointer(), ActionNameVar)
142
143}
144
145// Emits the [signal@Gio.ActionGroup::action-enabled-changed] signal on @action_group.
146//
147// This function should only be called by [type@Gio.ActionGroup] implementations.
148func (x *SimpleActionGroup) ActionEnabledChanged(ActionNameVar string, EnabledVar bool) {
149
150	XGActionGroupActionEnabledChanged(x.GoPointer(), ActionNameVar, EnabledVar)
151
152}
153
154// Emits the [signal@Gio.ActionGroup::action-removed] signal on @action_group.
155//
156// This function should only be called by [type@Gio.ActionGroup] implementations.
157func (x *SimpleActionGroup) ActionRemoved(ActionNameVar string) {
158
159	XGActionGroupActionRemoved(x.GoPointer(), ActionNameVar)
160
161}
162
163// Emits the [signal@Gio.ActionGroup::action-state-changed] signal on @action_group.
164//
165// This function should only be called by [type@Gio.ActionGroup] implementations.
166func (x *SimpleActionGroup) ActionStateChanged(ActionNameVar string, StateVar *glib.Variant) {
167
168	XGActionGroupActionStateChanged(x.GoPointer(), ActionNameVar, StateVar)
169
170}
171
172// Activate the named action within @action_group.
173//
174// If the action is expecting a parameter, then the correct type of
175// parameter must be given as @parameter.  If the action is expecting no
176// parameters then @parameter must be `NULL`.  See
177// [method@Gio.ActionGroup.get_action_parameter_type].
178//
179// If the [type@Gio.ActionGroup] implementation supports asynchronous remote
180// activation over D-Bus, this call may return before the relevant
181// D-Bus traffic has been sent, or any replies have been received. In
182// order to block on such asynchronous activation calls,
183// [method@Gio.DBusConnection.flush] should be called prior to the code, which
184// depends on the result of the action activation. Without flushing
185// the D-Bus connection, there is no guarantee that the action would
186// have been activated.
187//
188// The following code which runs in a remote app instance, shows an
189// example of a ‘quit’ action being activated on the primary app
190// instance over D-Bus. Here [method@Gio.DBusConnection.flush] is called
191// before `exit()`. Without `g_dbus_connection_flush()`, the ‘quit’ action
192// may fail to be activated on the primary instance.
193//
194// ```c
195// // call ‘quit’ action on primary instance
196// g_action_group_activate_action (G_ACTION_GROUP (app), "quit", NULL);
197//
198// // make sure the action is activated now
199// g_dbus_connection_flush (…);
200//
201// g_debug ("Application has been terminated. Exiting.");
202//
203// exit (0);
204// ```
205func (x *SimpleActionGroup) ActivateAction(ActionNameVar string, ParameterVar *glib.Variant) {
206
207	XGActionGroupActivateAction(x.GoPointer(), ActionNameVar, ParameterVar)
208
209}
210
211// Request for the state of the named action within @action_group to be
212// changed to @value.
213//
214// The action must be stateful and @value must be of the correct type.
215// See [method@Gio.ActionGroup.get_action_state_type].
216//
217// This call merely requests a change.  The action may refuse to change
218// its state or may change its state to something other than @value.
219// See [method@Gio.ActionGroup.get_action_state_hint].
220//
221// If the @value GVariant is floating, it is consumed.
222func (x *SimpleActionGroup) ChangeActionState(ActionNameVar string, ValueVar *glib.Variant) {
223
224	XGActionGroupChangeActionState(x.GoPointer(), ActionNameVar, ValueVar)
225
226}
227
228// Checks if the named action within @action_group is currently enabled.
229//
230// An action must be enabled in order to be activated or in order to
231// have its state changed from outside callers.
232func (x *SimpleActionGroup) GetActionEnabled(ActionNameVar string) bool {
233
234	cret := XGActionGroupGetActionEnabled(x.GoPointer(), ActionNameVar)
235	return cret
236}
237
238// Queries the type of the parameter that must be given when activating
239// the named action within @action_group.
240//
241// When activating the action using [method@Gio.ActionGroup.activate_action],
242// the [type@GLib.Variant] given to that function must be of the type returned
243// by this function.
244//
245// In the case that this function returns `NULL`, you must not give any
246// [type@GLib.Variant], but `NULL` instead.
247//
248// The parameter type of a particular action will never change but it is
249// possible for an action to be removed and for a new action to be added
250// with the same name but a different parameter type.
251func (x *SimpleActionGroup) GetActionParameterType(ActionNameVar string) *glib.VariantType {
252
253	cret := XGActionGroupGetActionParameterType(x.GoPointer(), ActionNameVar)
254	return cret
255}
256
257// Queries the current state of the named action within @action_group.
258//
259// If the action is not stateful then `NULL` will be returned.  If the
260// action is stateful then the type of the return value is the type
261// given by [method@Gio.ActionGroup.get_action_state_type].
262//
263// The return value (if non-`NULL`) should be freed with
264// [method@GLib.Variant.unref] when it is no longer required.
265func (x *SimpleActionGroup) GetActionState(ActionNameVar string) *glib.Variant {
266
267	cret := XGActionGroupGetActionState(x.GoPointer(), ActionNameVar)
268	return cret
269}
270
271// Requests a hint about the valid range of values for the state of the
272// named action within @action_group.
273//
274// If `NULL` is returned it either means that the action is not stateful
275// or that there is no hint about the valid range of values for the
276// state of the action.
277//
278// If a [type@GLib.Variant] array is returned then each item in the array is a
279// possible value for the state.  If a [type@GLib.Variant] pair (ie: two-tuple) is
280// returned then the tuple specifies the inclusive lower and upper bound
281// of valid values for the state.
282//
283// In any case, the information is merely a hint.  It may be possible to
284// have a state value outside of the hinted range and setting a value
285// within the range may fail.
286//
287// The return value (if non-`NULL`) should be freed with
288// [method@GLib.Variant.unref] when it is no longer required.
289func (x *SimpleActionGroup) GetActionStateHint(ActionNameVar string) *glib.Variant {
290
291	cret := XGActionGroupGetActionStateHint(x.GoPointer(), ActionNameVar)
292	return cret
293}
294
295// Queries the type of the state of the named action within
296// @action_group.
297//
298// If the action is stateful then this function returns the
299// [type@GLib.VariantType] of the state.  All calls to
300// [method@Gio.ActionGroup.change_action_state] must give a [type@GLib.Variant] of this
301// type and [method@Gio.ActionGroup.get_action_state] will return a [type@GLib.Variant]
302// of the same type.
303//
304// If the action is not stateful then this function will return `NULL`.
305// In that case, [method@Gio.ActionGroup.get_action_state] will return `NULL`
306// and you must not call [method@Gio.ActionGroup.change_action_state].
307//
308// The state type of a particular action will never change but it is
309// possible for an action to be removed and for a new action to be added
310// with the same name but a different state type.
311func (x *SimpleActionGroup) GetActionStateType(ActionNameVar string) *glib.VariantType {
312
313	cret := XGActionGroupGetActionStateType(x.GoPointer(), ActionNameVar)
314	return cret
315}
316
317// Checks if the named action exists within @action_group.
318func (x *SimpleActionGroup) HasAction(ActionNameVar string) bool {
319
320	cret := XGActionGroupHasAction(x.GoPointer(), ActionNameVar)
321	return cret
322}
323
324// Lists the actions contained within @action_group.
325//
326// The caller is responsible for freeing the list with [func@GLib.strfreev] when
327// it is no longer required.
328func (x *SimpleActionGroup) ListActions() []string {
329
330	cret := XGActionGroupListActions(x.GoPointer())
331	return cret
332}
333
334// Queries all aspects of the named action within an @action_group.
335//
336// This function acquires the information available from
337// [method@Gio.ActionGroup.has_action], [method@Gio.ActionGroup.get_action_enabled],
338// [method@Gio.ActionGroup.get_action_parameter_type],
339// [method@Gio.ActionGroup.get_action_state_type],
340// [method@Gio.ActionGroup.get_action_state_hint] and
341// [method@Gio.ActionGroup.get_action_state] with a single function call.
342//
343// This provides two main benefits.
344//
345// The first is the improvement in efficiency that comes with not having
346// to perform repeated lookups of the action in order to discover
347// different things about it.  The second is that implementing
348// [type@Gio.ActionGroup] can now be done by only overriding this one virtual
349// function.
350//
351// The interface provides a default implementation of this function that
352// calls the individual functions, as required, to fetch the
353// information.  The interface also provides default implementations of
354// those functions that call this function.  All implementations,
355// therefore, must override either this function or all of the others.
356//
357// If the action exists, `TRUE` is returned and any of the requested
358// fields (as indicated by having a non-`NULL` reference passed in) are
359// filled.  If the action doesn’t exist, `FALSE` is returned and the
360// fields may or may not have been modified.
361func (x *SimpleActionGroup) QueryAction(ActionNameVar string, EnabledVar *bool, ParameterTypeVar **glib.VariantType, StateTypeVar **glib.VariantType, StateHintVar **glib.Variant, StateVar **glib.Variant) bool {
362
363	cret := XGActionGroupQueryAction(x.GoPointer(), ActionNameVar, EnabledVar, ParameterTypeVar, StateTypeVar, StateHintVar, StateVar)
364	return cret
365}
366
367// Adds an action to the @action_map.
368//
369// If the action map already contains an action with the same name
370// as @action then the old action is dropped from the action map.
371//
372// The action map takes its own reference on @action.
373func (x *SimpleActionGroup) AddAction(ActionVar Action) {
374
375	XGActionMapAddAction(x.GoPointer(), ActionVar.GoPointer())
376
377}
378
379// A convenience function for creating multiple [class@Gio.SimpleAction]
380// instances and adding them to a [iface@Gio.ActionMap].
381//
382// Each action is constructed as per one [struct@Gio.ActionEntry].
383//
384// ```c
385// static void
386// activate_quit (GSimpleAction *simple,
387//
388//	GVariant      *parameter,
389//	gpointer       user_data)
390//
391//	{
392//	  exit (0);
393//	}
394//
395// static void
396// activate_print_string (GSimpleAction *simple,
397//
398//	GVariant      *parameter,
399//	gpointer       user_data)
400//
401//	{
402//	  g_print ("%s\n", g_variant_get_string (parameter, NULL));
403//	}
404//
405// static GActionGroup *
406// create_action_group (void)
407//
408//	{
409//	  const GActionEntry entries[] = {
410//	    { "quit",         activate_quit              },
411//	    { "print-string", activate_print_string, "s" }
412//	  };
413//	  GSimpleActionGroup *group;
414//
415//	  group = g_simple_action_group_new ();
416//	  g_action_map_add_action_entries (G_ACTION_MAP (group), entries, G_N_ELEMENTS (entries), NULL);
417//
418//	  return G_ACTION_GROUP (group);
419//	}
420//
421// ```
422func (x *SimpleActionGroup) AddActionEntries(EntriesVar []ActionEntry, NEntriesVar int, UserDataVar uintptr) {
423
424	XGActionMapAddActionEntries(x.GoPointer(), EntriesVar, NEntriesVar, UserDataVar)
425
426}
427
428// Looks up the action with the name @action_name in @action_map.
429//
430// If no such action exists, returns `NULL`.
431func (x *SimpleActionGroup) LookupAction(ActionNameVar string) *ActionBase {
432	var cls *ActionBase
433
434	cret := XGActionMapLookupAction(x.GoPointer(), ActionNameVar)
435
436	if cret == 0 {
437		return nil
438	}
439	gobject.IncreaseRef(cret)
440	cls = &ActionBase{}
441	cls.Ptr = cret
442	return cls
443}
444
445// Removes the named action from the action map.
446//
447// If no action of this name is in the map then nothing happens.
448func (x *SimpleActionGroup) RemoveAction(ActionNameVar string) {
449
450	XGActionMapRemoveAction(x.GoPointer(), ActionNameVar)
451
452}
453
454// Remove actions from a [iface@Gio.ActionMap]. This is meant as the reverse of
455// [method@Gio.ActionMap.add_action_entries].
456//
457// ```c
458//
459//	static const GActionEntry entries[] = {
460//	    { "quit",         activate_quit              },
461//	    { "print-string", activate_print_string, "s" }
462//	};
463//
464// void
465// add_actions (GActionMap *map)
466//
467//	{
468//	  g_action_map_add_action_entries (map, entries, G_N_ELEMENTS (entries), NULL);
469//	}
470//
471// void
472// remove_actions (GActionMap *map)
473//
474//	{
475//	  g_action_map_remove_action_entries (map, entries, G_N_ELEMENTS (entries));
476//	}
477//
478// ```
479func (x *SimpleActionGroup) RemoveActionEntries(EntriesVar []ActionEntry, NEntriesVar int) {
480
481	XGActionMapRemoveActionEntries(x.GoPointer(), EntriesVar, NEntriesVar)
482
483}
484
485func init() {
486	core.SetPackageName("GIO", "gio-2.0")
487	core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"})
488	var libs []uintptr
489	for _, libPath := range core.GetPaths("GIO") {
490		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
491		if err != nil {
492			panic(err)
493		}
494		libs = append(libs, lib)
495	}
496
497	core.PuregoSafeRegister(&xSimpleActionGroupGLibType, libs, "g_simple_action_group_get_type")
498
499	core.PuregoSafeRegister(&xNewSimpleActionGroup, libs, "g_simple_action_group_new")
500
501	core.PuregoSafeRegister(&xSimpleActionGroupAddEntries, libs, "g_simple_action_group_add_entries")
502	core.PuregoSafeRegister(&xSimpleActionGroupInsert, libs, "g_simple_action_group_insert")
503	core.PuregoSafeRegister(&xSimpleActionGroupLookup, libs, "g_simple_action_group_lookup")
504	core.PuregoSafeRegister(&xSimpleActionGroupRemove, libs, "g_simple_action_group_remove")
505
506}

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