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/types"
13)
14
15// The virtual function table for [type@Gio.ActionGroup].
16type ActionGroupInterface struct {
17 _ structs.HostLayout
18
19 GIface uintptr
20
21 xHasAction uintptr
22
23 xListActions uintptr
24
25 xGetActionEnabled uintptr
26
27 xGetActionParameterType uintptr
28
29 xGetActionStateType uintptr
30
31 xGetActionStateHint uintptr
32
33 xGetActionState uintptr
34
35 xChangeActionState uintptr
36
37 xActivateAction uintptr
38
39 xActionAdded uintptr
40
41 xActionRemoved uintptr
42
43 xActionEnabledChanged uintptr
44
45 xActionStateChanged uintptr
46
47 xQueryAction uintptr
48}
49
50func (x *ActionGroupInterface) GoPointer() uintptr {
51 return uintptr(unsafe.Pointer(x))
52}
53
54// OverrideHasAction sets the "has_action" callback function.
55// the virtual function pointer for [method@Gio.ActionGroup.has_action]
56func (x *ActionGroupInterface) OverrideHasAction(cb func(ActionGroup, string) bool) {
57 if cb == nil {
58 x.xHasAction = 0
59 } else {
60 x.xHasAction = purego.NewCallback(func(ActionGroupVarp uintptr, ActionNameVarp string) bool {
61 return cb(&ActionGroupBase{Ptr: ActionGroupVarp}, ActionNameVarp)
62 })
63 }
64}
65
66// GetHasAction gets the "has_action" callback function.
67// the virtual function pointer for [method@Gio.ActionGroup.has_action]
68func (x *ActionGroupInterface) GetHasAction() func(ActionGroup, string) bool {
69 if x.xHasAction == 0 {
70 return nil
71 }
72 var rawCallback func(ActionGroupVarp uintptr, ActionNameVarp string) bool
73 purego.RegisterFunc(&rawCallback, x.xHasAction)
74 return func(ActionGroupVar ActionGroup, ActionNameVar string) bool {
75 return rawCallback(ActionGroupVar.GoPointer(), ActionNameVar)
76 }
77}
78
79// OverrideListActions sets the "list_actions" callback function.
80// the virtual function pointer for [method@Gio.ActionGroup.list_actions]
81func (x *ActionGroupInterface) OverrideListActions(cb func(ActionGroup) []string) {
82 if cb == nil {
83 x.xListActions = 0
84 } else {
85 x.xListActions = purego.NewCallback(func(ActionGroupVarp uintptr) []string {
86 return cb(&ActionGroupBase{Ptr: ActionGroupVarp})
87 })
88 }
89}
90
91// GetListActions gets the "list_actions" callback function.
92// the virtual function pointer for [method@Gio.ActionGroup.list_actions]
93func (x *ActionGroupInterface) GetListActions() func(ActionGroup) []string {
94 if x.xListActions == 0 {
95 return nil
96 }
97 var rawCallback func(ActionGroupVarp uintptr) []string
98 purego.RegisterFunc(&rawCallback, x.xListActions)
99 return func(ActionGroupVar ActionGroup) []string {
100 return rawCallback(ActionGroupVar.GoPointer())
101 }
102}
103
104// OverrideGetActionEnabled sets the "get_action_enabled" callback function.
105// the virtual function pointer for [method@Gio.ActionGroup.get_action_enabled]
106func (x *ActionGroupInterface) OverrideGetActionEnabled(cb func(ActionGroup, string) bool) {
107 if cb == nil {
108 x.xGetActionEnabled = 0
109 } else {
110 x.xGetActionEnabled = purego.NewCallback(func(ActionGroupVarp uintptr, ActionNameVarp string) bool {
111 return cb(&ActionGroupBase{Ptr: ActionGroupVarp}, ActionNameVarp)
112 })
113 }
114}
115
116// GetGetActionEnabled gets the "get_action_enabled" callback function.
117// the virtual function pointer for [method@Gio.ActionGroup.get_action_enabled]
118func (x *ActionGroupInterface) GetGetActionEnabled() func(ActionGroup, string) bool {
119 if x.xGetActionEnabled == 0 {
120 return nil
121 }
122 var rawCallback func(ActionGroupVarp uintptr, ActionNameVarp string) bool
123 purego.RegisterFunc(&rawCallback, x.xGetActionEnabled)
124 return func(ActionGroupVar ActionGroup, ActionNameVar string) bool {
125 return rawCallback(ActionGroupVar.GoPointer(), ActionNameVar)
126 }
127}
128
129// OverrideGetActionParameterType sets the "get_action_parameter_type" callback function.
130// the virtual function pointer for [method@Gio.ActionGroup.get_action_parameter_type]
131func (x *ActionGroupInterface) OverrideGetActionParameterType(cb func(ActionGroup, string) *glib.VariantType) {
132 if cb == nil {
133 x.xGetActionParameterType = 0
134 } else {
135 x.xGetActionParameterType = purego.NewCallback(func(ActionGroupVarp uintptr, ActionNameVarp string) *glib.VariantType {
136 return cb(&ActionGroupBase{Ptr: ActionGroupVarp}, ActionNameVarp)
137 })
138 }
139}
140
141// GetGetActionParameterType gets the "get_action_parameter_type" callback function.
142// the virtual function pointer for [method@Gio.ActionGroup.get_action_parameter_type]
143func (x *ActionGroupInterface) GetGetActionParameterType() func(ActionGroup, string) *glib.VariantType {
144 if x.xGetActionParameterType == 0 {
145 return nil
146 }
147 var rawCallback func(ActionGroupVarp uintptr, ActionNameVarp string) *glib.VariantType
148 purego.RegisterFunc(&rawCallback, x.xGetActionParameterType)
149 return func(ActionGroupVar ActionGroup, ActionNameVar string) *glib.VariantType {
150 return rawCallback(ActionGroupVar.GoPointer(), ActionNameVar)
151 }
152}
153
154// OverrideGetActionStateType sets the "get_action_state_type" callback function.
155// the virtual function pointer for [method@Gio.ActionGroup.get_action_state_type]
156func (x *ActionGroupInterface) OverrideGetActionStateType(cb func(ActionGroup, string) *glib.VariantType) {
157 if cb == nil {
158 x.xGetActionStateType = 0
159 } else {
160 x.xGetActionStateType = purego.NewCallback(func(ActionGroupVarp uintptr, ActionNameVarp string) *glib.VariantType {
161 return cb(&ActionGroupBase{Ptr: ActionGroupVarp}, ActionNameVarp)
162 })
163 }
164}
165
166// GetGetActionStateType gets the "get_action_state_type" callback function.
167// the virtual function pointer for [method@Gio.ActionGroup.get_action_state_type]
168func (x *ActionGroupInterface) GetGetActionStateType() func(ActionGroup, string) *glib.VariantType {
169 if x.xGetActionStateType == 0 {
170 return nil
171 }
172 var rawCallback func(ActionGroupVarp uintptr, ActionNameVarp string) *glib.VariantType
173 purego.RegisterFunc(&rawCallback, x.xGetActionStateType)
174 return func(ActionGroupVar ActionGroup, ActionNameVar string) *glib.VariantType {
175 return rawCallback(ActionGroupVar.GoPointer(), ActionNameVar)
176 }
177}
178
179// OverrideGetActionStateHint sets the "get_action_state_hint" callback function.
180// the virtual function pointer for [method@Gio.ActionGroup.get_action_state_hint]
181func (x *ActionGroupInterface) OverrideGetActionStateHint(cb func(ActionGroup, string) *glib.Variant) {
182 if cb == nil {
183 x.xGetActionStateHint = 0
184 } else {
185 x.xGetActionStateHint = purego.NewCallback(func(ActionGroupVarp uintptr, ActionNameVarp string) *glib.Variant {
186 return cb(&ActionGroupBase{Ptr: ActionGroupVarp}, ActionNameVarp)
187 })
188 }
189}
190
191// GetGetActionStateHint gets the "get_action_state_hint" callback function.
192// the virtual function pointer for [method@Gio.ActionGroup.get_action_state_hint]
193func (x *ActionGroupInterface) GetGetActionStateHint() func(ActionGroup, string) *glib.Variant {
194 if x.xGetActionStateHint == 0 {
195 return nil
196 }
197 var rawCallback func(ActionGroupVarp uintptr, ActionNameVarp string) *glib.Variant
198 purego.RegisterFunc(&rawCallback, x.xGetActionStateHint)
199 return func(ActionGroupVar ActionGroup, ActionNameVar string) *glib.Variant {
200 return rawCallback(ActionGroupVar.GoPointer(), ActionNameVar)
201 }
202}
203
204// OverrideGetActionState sets the "get_action_state" callback function.
205// the virtual function pointer for [method@Gio.ActionGroup.get_action_state]
206func (x *ActionGroupInterface) OverrideGetActionState(cb func(ActionGroup, string) *glib.Variant) {
207 if cb == nil {
208 x.xGetActionState = 0
209 } else {
210 x.xGetActionState = purego.NewCallback(func(ActionGroupVarp uintptr, ActionNameVarp string) *glib.Variant {
211 return cb(&ActionGroupBase{Ptr: ActionGroupVarp}, ActionNameVarp)
212 })
213 }
214}
215
216// GetGetActionState gets the "get_action_state" callback function.
217// the virtual function pointer for [method@Gio.ActionGroup.get_action_state]
218func (x *ActionGroupInterface) GetGetActionState() func(ActionGroup, string) *glib.Variant {
219 if x.xGetActionState == 0 {
220 return nil
221 }
222 var rawCallback func(ActionGroupVarp uintptr, ActionNameVarp string) *glib.Variant
223 purego.RegisterFunc(&rawCallback, x.xGetActionState)
224 return func(ActionGroupVar ActionGroup, ActionNameVar string) *glib.Variant {
225 return rawCallback(ActionGroupVar.GoPointer(), ActionNameVar)
226 }
227}
228
229// OverrideChangeActionState sets the "change_action_state" callback function.
230// the virtual function pointer for [method@Gio.ActionGroup.change_action_state]
231func (x *ActionGroupInterface) OverrideChangeActionState(cb func(ActionGroup, string, *glib.Variant)) {
232 if cb == nil {
233 x.xChangeActionState = 0
234 } else {
235 x.xChangeActionState = purego.NewCallback(func(ActionGroupVarp uintptr, ActionNameVarp string, ValueVarp *glib.Variant) {
236 cb(&ActionGroupBase{Ptr: ActionGroupVarp}, ActionNameVarp, ValueVarp)
237 })
238 }
239}
240
241// GetChangeActionState gets the "change_action_state" callback function.
242// the virtual function pointer for [method@Gio.ActionGroup.change_action_state]
243func (x *ActionGroupInterface) GetChangeActionState() func(ActionGroup, string, *glib.Variant) {
244 if x.xChangeActionState == 0 {
245 return nil
246 }
247 var rawCallback func(ActionGroupVarp uintptr, ActionNameVarp string, ValueVarp *glib.Variant)
248 purego.RegisterFunc(&rawCallback, x.xChangeActionState)
249 return func(ActionGroupVar ActionGroup, ActionNameVar string, ValueVar *glib.Variant) {
250 rawCallback(ActionGroupVar.GoPointer(), ActionNameVar, ValueVar)
251 }
252}
253
254// OverrideActivateAction sets the "activate_action" callback function.
255// the virtual function pointer for [method@Gio.ActionGroup.activate_action]
256func (x *ActionGroupInterface) OverrideActivateAction(cb func(ActionGroup, string, *glib.Variant)) {
257 if cb == nil {
258 x.xActivateAction = 0
259 } else {
260 x.xActivateAction = purego.NewCallback(func(ActionGroupVarp uintptr, ActionNameVarp string, ParameterVarp *glib.Variant) {
261 cb(&ActionGroupBase{Ptr: ActionGroupVarp}, ActionNameVarp, ParameterVarp)
262 })
263 }
264}
265
266// GetActivateAction gets the "activate_action" callback function.
267// the virtual function pointer for [method@Gio.ActionGroup.activate_action]
268func (x *ActionGroupInterface) GetActivateAction() func(ActionGroup, string, *glib.Variant) {
269 if x.xActivateAction == 0 {
270 return nil
271 }
272 var rawCallback func(ActionGroupVarp uintptr, ActionNameVarp string, ParameterVarp *glib.Variant)
273 purego.RegisterFunc(&rawCallback, x.xActivateAction)
274 return func(ActionGroupVar ActionGroup, ActionNameVar string, ParameterVar *glib.Variant) {
275 rawCallback(ActionGroupVar.GoPointer(), ActionNameVar, ParameterVar)
276 }
277}
278
279// OverrideActionAdded sets the "action_added" callback function.
280// the class closure for the [signal@Gio.ActionGroup::action-added] signal
281func (x *ActionGroupInterface) OverrideActionAdded(cb func(ActionGroup, string)) {
282 if cb == nil {
283 x.xActionAdded = 0
284 } else {
285 x.xActionAdded = purego.NewCallback(func(ActionGroupVarp uintptr, ActionNameVarp string) {
286 cb(&ActionGroupBase{Ptr: ActionGroupVarp}, ActionNameVarp)
287 })
288 }
289}
290
291// GetActionAdded gets the "action_added" callback function.
292// the class closure for the [signal@Gio.ActionGroup::action-added] signal
293func (x *ActionGroupInterface) GetActionAdded() func(ActionGroup, string) {
294 if x.xActionAdded == 0 {
295 return nil
296 }
297 var rawCallback func(ActionGroupVarp uintptr, ActionNameVarp string)
298 purego.RegisterFunc(&rawCallback, x.xActionAdded)
299 return func(ActionGroupVar ActionGroup, ActionNameVar string) {
300 rawCallback(ActionGroupVar.GoPointer(), ActionNameVar)
301 }
302}
303
304// OverrideActionRemoved sets the "action_removed" callback function.
305// the class closure for the [signal@Gio.ActionGroup::action-removed] signal
306func (x *ActionGroupInterface) OverrideActionRemoved(cb func(ActionGroup, string)) {
307 if cb == nil {
308 x.xActionRemoved = 0
309 } else {
310 x.xActionRemoved = purego.NewCallback(func(ActionGroupVarp uintptr, ActionNameVarp string) {
311 cb(&ActionGroupBase{Ptr: ActionGroupVarp}, ActionNameVarp)
312 })
313 }
314}
315
316// GetActionRemoved gets the "action_removed" callback function.
317// the class closure for the [signal@Gio.ActionGroup::action-removed] signal
318func (x *ActionGroupInterface) GetActionRemoved() func(ActionGroup, string) {
319 if x.xActionRemoved == 0 {
320 return nil
321 }
322 var rawCallback func(ActionGroupVarp uintptr, ActionNameVarp string)
323 purego.RegisterFunc(&rawCallback, x.xActionRemoved)
324 return func(ActionGroupVar ActionGroup, ActionNameVar string) {
325 rawCallback(ActionGroupVar.GoPointer(), ActionNameVar)
326 }
327}
328
329// OverrideActionEnabledChanged sets the "action_enabled_changed" callback function.
330// the class closure for the [signal@Gio.ActionGroup::action-enabled-changed] signal
331func (x *ActionGroupInterface) OverrideActionEnabledChanged(cb func(ActionGroup, string, bool)) {
332 if cb == nil {
333 x.xActionEnabledChanged = 0
334 } else {
335 x.xActionEnabledChanged = purego.NewCallback(func(ActionGroupVarp uintptr, ActionNameVarp string, EnabledVarp bool) {
336 cb(&ActionGroupBase{Ptr: ActionGroupVarp}, ActionNameVarp, EnabledVarp)
337 })
338 }
339}
340
341// GetActionEnabledChanged gets the "action_enabled_changed" callback function.
342// the class closure for the [signal@Gio.ActionGroup::action-enabled-changed] signal
343func (x *ActionGroupInterface) GetActionEnabledChanged() func(ActionGroup, string, bool) {
344 if x.xActionEnabledChanged == 0 {
345 return nil
346 }
347 var rawCallback func(ActionGroupVarp uintptr, ActionNameVarp string, EnabledVarp bool)
348 purego.RegisterFunc(&rawCallback, x.xActionEnabledChanged)
349 return func(ActionGroupVar ActionGroup, ActionNameVar string, EnabledVar bool) {
350 rawCallback(ActionGroupVar.GoPointer(), ActionNameVar, EnabledVar)
351 }
352}
353
354// OverrideActionStateChanged sets the "action_state_changed" callback function.
355// the class closure for the [signal@Gio.ActionGroup::action-enabled-changed] signal
356func (x *ActionGroupInterface) OverrideActionStateChanged(cb func(ActionGroup, string, *glib.Variant)) {
357 if cb == nil {
358 x.xActionStateChanged = 0
359 } else {
360 x.xActionStateChanged = purego.NewCallback(func(ActionGroupVarp uintptr, ActionNameVarp string, StateVarp *glib.Variant) {
361 cb(&ActionGroupBase{Ptr: ActionGroupVarp}, ActionNameVarp, StateVarp)
362 })
363 }
364}
365
366// GetActionStateChanged gets the "action_state_changed" callback function.
367// the class closure for the [signal@Gio.ActionGroup::action-enabled-changed] signal
368func (x *ActionGroupInterface) GetActionStateChanged() func(ActionGroup, string, *glib.Variant) {
369 if x.xActionStateChanged == 0 {
370 return nil
371 }
372 var rawCallback func(ActionGroupVarp uintptr, ActionNameVarp string, StateVarp *glib.Variant)
373 purego.RegisterFunc(&rawCallback, x.xActionStateChanged)
374 return func(ActionGroupVar ActionGroup, ActionNameVar string, StateVar *glib.Variant) {
375 rawCallback(ActionGroupVar.GoPointer(), ActionNameVar, StateVar)
376 }
377}
378
379// OverrideQueryAction sets the "query_action" callback function.
380// the virtual function pointer for [method@Gio.ActionGroup.query_action]
381func (x *ActionGroupInterface) OverrideQueryAction(cb func(ActionGroup, string, *bool, **glib.VariantType, **glib.VariantType, **glib.Variant, **glib.Variant) bool) {
382 if cb == nil {
383 x.xQueryAction = 0
384 } else {
385 x.xQueryAction = purego.NewCallback(func(ActionGroupVarp uintptr, ActionNameVarp string, EnabledVarp *bool, ParameterTypeVarp **glib.VariantType, StateTypeVarp **glib.VariantType, StateHintVarp **glib.Variant, StateVarp **glib.Variant) bool {
386 return cb(&ActionGroupBase{Ptr: ActionGroupVarp}, ActionNameVarp, EnabledVarp, ParameterTypeVarp, StateTypeVarp, StateHintVarp, StateVarp)
387 })
388 }
389}
390
391// GetQueryAction gets the "query_action" callback function.
392// the virtual function pointer for [method@Gio.ActionGroup.query_action]
393func (x *ActionGroupInterface) GetQueryAction() func(ActionGroup, string, *bool, **glib.VariantType, **glib.VariantType, **glib.Variant, **glib.Variant) bool {
394 if x.xQueryAction == 0 {
395 return nil
396 }
397 var rawCallback func(ActionGroupVarp uintptr, ActionNameVarp string, EnabledVarp *bool, ParameterTypeVarp **glib.VariantType, StateTypeVarp **glib.VariantType, StateHintVarp **glib.Variant, StateVarp **glib.Variant) bool
398 purego.RegisterFunc(&rawCallback, x.xQueryAction)
399 return func(ActionGroupVar ActionGroup, ActionNameVar string, EnabledVar *bool, ParameterTypeVar **glib.VariantType, StateTypeVar **glib.VariantType, StateHintVar **glib.Variant, StateVar **glib.Variant) bool {
400 return rawCallback(ActionGroupVar.GoPointer(), ActionNameVar, EnabledVar, ParameterTypeVar, StateTypeVar, StateHintVar, StateVar)
401 }
402}
403
404// `GActionGroup` represents a group of actions.
405//
406// Actions can be used to expose functionality in a structured way, either
407// from one part of a program to another, or to the outside world. Action
408// groups are often used together with a [type@Gio.MenuModel] that provides additional
409// representation data for displaying the actions to the user, e.g. in a menu.
410//
411// The main way to interact with the actions in a `GActionGroup` is to
412// activate them with [method@Gio.ActionGroup.activate_action]. Activating an
413// action may require a [type@GLib.Variant] parameter. The required type of the
414// parameter can be inquired with [method@Gio.ActionGroup.get_action_parameter_type].
415// Actions may be disabled, see [method@Gio.ActionGroup.get_action_enabled].
416// Activating a disabled action has no effect.
417//
418// Actions may optionally have a state in the form of a [type@GLib.Variant]. The current
419// state of an action can be inquired with [method@Gio.ActionGroup.get_action_state].
420// Activating a stateful action may change its state, but it is also possible to
421// set the state by calling [method@Gio.ActionGroup.change_action_state].
422//
423// As typical example, consider a text editing application which has an
424// option to change the current font to ‘bold’. A good way to represent
425// this would be a stateful action, with a boolean state. Activating the
426// action would toggle the state.
427//
428// Each action in the group has a unique name (which is a string). All
429// method calls, except [method@Gio.ActionGroup.list_actions] take the name of
430// an action as an argument.
431//
432// The `GActionGroup` API is meant to be the ‘public’ API to the action
433// group. The calls here are exactly the interaction that ‘external
434// forces’ (eg: UI, incoming D-Bus messages, etc.) are supposed to have
435// with actions. ‘Internal’ APIs (ie: ones meant only to be accessed by
436// the action group implementation) are found on subclasses. This is
437// why you will find – for example – [method@Gio.ActionGroup.get_action_enabled]
438// but not an equivalent `set_action_enabled()` method.
439//
440// Signals are emitted on the action group in response to state changes
441// on individual actions.
442//
443// Implementations of `GActionGroup` should provide implementations for
444// the virtual functions [method@Gio.ActionGroup.list_actions] and
445// [method@Gio.ActionGroup.query_action]. The other virtual functions should
446// not be implemented — their ‘wrappers’ are actually implemented with
447// calls to [method@Gio.ActionGroup.query_action].
448type ActionGroup interface {
449 GoPointer() uintptr
450 SetGoPointer(uintptr)
451 ActionAdded(ActionNameVar string)
452 ActionEnabledChanged(ActionNameVar string, EnabledVar bool)
453 ActionRemoved(ActionNameVar string)
454 ActionStateChanged(ActionNameVar string, StateVar *glib.Variant)
455 ActivateAction(ActionNameVar string, ParameterVar *glib.Variant)
456 ChangeActionState(ActionNameVar string, ValueVar *glib.Variant)
457 GetActionEnabled(ActionNameVar string) bool
458 GetActionParameterType(ActionNameVar string) *glib.VariantType
459 GetActionState(ActionNameVar string) *glib.Variant
460 GetActionStateHint(ActionNameVar string) *glib.Variant
461 GetActionStateType(ActionNameVar string) *glib.VariantType
462 HasAction(ActionNameVar string) bool
463 ListActions() []string
464 QueryAction(ActionNameVar string, EnabledVar *bool, ParameterTypeVar **glib.VariantType, StateTypeVar **glib.VariantType, StateHintVar **glib.Variant, StateVar **glib.Variant) bool
465}
466
467var xActionGroupGLibType func() types.GType
468
469func ActionGroupGLibType() types.GType {
470 return xActionGroupGLibType()
471}
472
473type ActionGroupBase struct {
474 Ptr uintptr
475}
476
477func (x *ActionGroupBase) GoPointer() uintptr {
478 if x == nil {
479 return 0
480 }
481 return x.Ptr
482}
483
484func (x *ActionGroupBase) SetGoPointer(ptr uintptr) {
485 x.Ptr = ptr
486}
487
488// Emits the [signal@Gio.ActionGroup::action-added] signal on @action_group.
489//
490// This function should only be called by [type@Gio.ActionGroup] implementations.
491func (x *ActionGroupBase) ActionAdded(ActionNameVar string) {
492
493 XGActionGroupActionAdded(x.GoPointer(), ActionNameVar)
494
495}
496
497// Emits the [signal@Gio.ActionGroup::action-enabled-changed] signal on @action_group.
498//
499// This function should only be called by [type@Gio.ActionGroup] implementations.
500func (x *ActionGroupBase) ActionEnabledChanged(ActionNameVar string, EnabledVar bool) {
501
502 XGActionGroupActionEnabledChanged(x.GoPointer(), ActionNameVar, EnabledVar)
503
504}
505
506// Emits the [signal@Gio.ActionGroup::action-removed] signal on @action_group.
507//
508// This function should only be called by [type@Gio.ActionGroup] implementations.
509func (x *ActionGroupBase) ActionRemoved(ActionNameVar string) {
510
511 XGActionGroupActionRemoved(x.GoPointer(), ActionNameVar)
512
513}
514
515// Emits the [signal@Gio.ActionGroup::action-state-changed] signal on @action_group.
516//
517// This function should only be called by [type@Gio.ActionGroup] implementations.
518func (x *ActionGroupBase) ActionStateChanged(ActionNameVar string, StateVar *glib.Variant) {
519
520 XGActionGroupActionStateChanged(x.GoPointer(), ActionNameVar, StateVar)
521
522}
523
524// Activate the named action within @action_group.
525//
526// If the action is expecting a parameter, then the correct type of
527// parameter must be given as @parameter. If the action is expecting no
528// parameters then @parameter must be `NULL`. See
529// [method@Gio.ActionGroup.get_action_parameter_type].
530//
531// If the [type@Gio.ActionGroup] implementation supports asynchronous remote
532// activation over D-Bus, this call may return before the relevant
533// D-Bus traffic has been sent, or any replies have been received. In
534// order to block on such asynchronous activation calls,
535// [method@Gio.DBusConnection.flush] should be called prior to the code, which
536// depends on the result of the action activation. Without flushing
537// the D-Bus connection, there is no guarantee that the action would
538// have been activated.
539//
540// The following code which runs in a remote app instance, shows an
541// example of a ‘quit’ action being activated on the primary app
542// instance over D-Bus. Here [method@Gio.DBusConnection.flush] is called
543// before `exit()`. Without `g_dbus_connection_flush()`, the ‘quit’ action
544// may fail to be activated on the primary instance.
545//
546// ```c
547// // call ‘quit’ action on primary instance
548// g_action_group_activate_action (G_ACTION_GROUP (app), "quit", NULL);
549//
550// // make sure the action is activated now
551// g_dbus_connection_flush (…);
552//
553// g_debug ("Application has been terminated. Exiting.");
554//
555// exit (0);
556// ```
557func (x *ActionGroupBase) ActivateAction(ActionNameVar string, ParameterVar *glib.Variant) {
558
559 XGActionGroupActivateAction(x.GoPointer(), ActionNameVar, ParameterVar)
560
561}
562
563// Request for the state of the named action within @action_group to be
564// changed to @value.
565//
566// The action must be stateful and @value must be of the correct type.
567// See [method@Gio.ActionGroup.get_action_state_type].
568//
569// This call merely requests a change. The action may refuse to change
570// its state or may change its state to something other than @value.
571// See [method@Gio.ActionGroup.get_action_state_hint].
572//
573// If the @value GVariant is floating, it is consumed.
574func (x *ActionGroupBase) ChangeActionState(ActionNameVar string, ValueVar *glib.Variant) {
575
576 XGActionGroupChangeActionState(x.GoPointer(), ActionNameVar, ValueVar)
577
578}
579
580// Checks if the named action within @action_group is currently enabled.
581//
582// An action must be enabled in order to be activated or in order to
583// have its state changed from outside callers.
584func (x *ActionGroupBase) GetActionEnabled(ActionNameVar string) bool {
585
586 cret := XGActionGroupGetActionEnabled(x.GoPointer(), ActionNameVar)
587 return cret
588}
589
590// Queries the type of the parameter that must be given when activating
591// the named action within @action_group.
592//
593// When activating the action using [method@Gio.ActionGroup.activate_action],
594// the [type@GLib.Variant] given to that function must be of the type returned
595// by this function.
596//
597// In the case that this function returns `NULL`, you must not give any
598// [type@GLib.Variant], but `NULL` instead.
599//
600// The parameter type of a particular action will never change but it is
601// possible for an action to be removed and for a new action to be added
602// with the same name but a different parameter type.
603func (x *ActionGroupBase) GetActionParameterType(ActionNameVar string) *glib.VariantType {
604
605 cret := XGActionGroupGetActionParameterType(x.GoPointer(), ActionNameVar)
606 return cret
607}
608
609// Queries the current state of the named action within @action_group.
610//
611// If the action is not stateful then `NULL` will be returned. If the
612// action is stateful then the type of the return value is the type
613// given by [method@Gio.ActionGroup.get_action_state_type].
614//
615// The return value (if non-`NULL`) should be freed with
616// [method@GLib.Variant.unref] when it is no longer required.
617func (x *ActionGroupBase) GetActionState(ActionNameVar string) *glib.Variant {
618
619 cret := XGActionGroupGetActionState(x.GoPointer(), ActionNameVar)
620 return cret
621}
622
623// Requests a hint about the valid range of values for the state of the
624// named action within @action_group.
625//
626// If `NULL` is returned it either means that the action is not stateful
627// or that there is no hint about the valid range of values for the
628// state of the action.
629//
630// If a [type@GLib.Variant] array is returned then each item in the array is a
631// possible value for the state. If a [type@GLib.Variant] pair (ie: two-tuple) is
632// returned then the tuple specifies the inclusive lower and upper bound
633// of valid values for the state.
634//
635// In any case, the information is merely a hint. It may be possible to
636// have a state value outside of the hinted range and setting a value
637// within the range may fail.
638//
639// The return value (if non-`NULL`) should be freed with
640// [method@GLib.Variant.unref] when it is no longer required.
641func (x *ActionGroupBase) GetActionStateHint(ActionNameVar string) *glib.Variant {
642
643 cret := XGActionGroupGetActionStateHint(x.GoPointer(), ActionNameVar)
644 return cret
645}
646
647// Queries the type of the state of the named action within
648// @action_group.
649//
650// If the action is stateful then this function returns the
651// [type@GLib.VariantType] of the state. All calls to
652// [method@Gio.ActionGroup.change_action_state] must give a [type@GLib.Variant] of this
653// type and [method@Gio.ActionGroup.get_action_state] will return a [type@GLib.Variant]
654// of the same type.
655//
656// If the action is not stateful then this function will return `NULL`.
657// In that case, [method@Gio.ActionGroup.get_action_state] will return `NULL`
658// and you must not call [method@Gio.ActionGroup.change_action_state].
659//
660// The state type of a particular action will never change but it is
661// possible for an action to be removed and for a new action to be added
662// with the same name but a different state type.
663func (x *ActionGroupBase) GetActionStateType(ActionNameVar string) *glib.VariantType {
664
665 cret := XGActionGroupGetActionStateType(x.GoPointer(), ActionNameVar)
666 return cret
667}
668
669// Checks if the named action exists within @action_group.
670func (x *ActionGroupBase) HasAction(ActionNameVar string) bool {
671
672 cret := XGActionGroupHasAction(x.GoPointer(), ActionNameVar)
673 return cret
674}
675
676// Lists the actions contained within @action_group.
677//
678// The caller is responsible for freeing the list with [func@GLib.strfreev] when
679// it is no longer required.
680func (x *ActionGroupBase) ListActions() []string {
681
682 cret := XGActionGroupListActions(x.GoPointer())
683 return cret
684}
685
686// Queries all aspects of the named action within an @action_group.
687//
688// This function acquires the information available from
689// [method@Gio.ActionGroup.has_action], [method@Gio.ActionGroup.get_action_enabled],
690// [method@Gio.ActionGroup.get_action_parameter_type],
691// [method@Gio.ActionGroup.get_action_state_type],
692// [method@Gio.ActionGroup.get_action_state_hint] and
693// [method@Gio.ActionGroup.get_action_state] with a single function call.
694//
695// This provides two main benefits.
696//
697// The first is the improvement in efficiency that comes with not having
698// to perform repeated lookups of the action in order to discover
699// different things about it. The second is that implementing
700// [type@Gio.ActionGroup] can now be done by only overriding this one virtual
701// function.
702//
703// The interface provides a default implementation of this function that
704// calls the individual functions, as required, to fetch the
705// information. The interface also provides default implementations of
706// those functions that call this function. All implementations,
707// therefore, must override either this function or all of the others.
708//
709// If the action exists, `TRUE` is returned and any of the requested
710// fields (as indicated by having a non-`NULL` reference passed in) are
711// filled. If the action doesn’t exist, `FALSE` is returned and the
712// fields may or may not have been modified.
713func (x *ActionGroupBase) QueryAction(ActionNameVar string, EnabledVar *bool, ParameterTypeVar **glib.VariantType, StateTypeVar **glib.VariantType, StateHintVar **glib.Variant, StateVar **glib.Variant) bool {
714
715 cret := XGActionGroupQueryAction(x.GoPointer(), ActionNameVar, EnabledVar, ParameterTypeVar, StateTypeVar, StateHintVar, StateVar)
716 return cret
717}
718
719var XGActionGroupActionAdded func(uintptr, string)
720var XGActionGroupActionEnabledChanged func(uintptr, string, bool)
721var XGActionGroupActionRemoved func(uintptr, string)
722var XGActionGroupActionStateChanged func(uintptr, string, *glib.Variant)
723var XGActionGroupActivateAction func(uintptr, string, *glib.Variant)
724var XGActionGroupChangeActionState func(uintptr, string, *glib.Variant)
725var XGActionGroupGetActionEnabled func(uintptr, string) bool
726var XGActionGroupGetActionParameterType func(uintptr, string) *glib.VariantType
727var XGActionGroupGetActionState func(uintptr, string) *glib.Variant
728var XGActionGroupGetActionStateHint func(uintptr, string) *glib.Variant
729var XGActionGroupGetActionStateType func(uintptr, string) *glib.VariantType
730var XGActionGroupHasAction func(uintptr, string) bool
731var XGActionGroupListActions func(uintptr) []string
732var XGActionGroupQueryAction func(uintptr, string, *bool, **glib.VariantType, **glib.VariantType, **glib.Variant, **glib.Variant) bool
733
734func init() {
735 core.SetPackageName("GIO", "gio-2.0")
736 core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"})
737 var libs []uintptr
738 for _, libPath := range core.GetPaths("GIO") {
739 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
740 if err != nil {
741 panic(err)
742 }
743 libs = append(libs, lib)
744 }
745
746 core.PuregoSafeRegister(&xActionGroupGLibType, libs, "g_action_group_get_type")
747
748 core.PuregoSafeRegister(&XGActionGroupActionAdded, libs, "g_action_group_action_added")
749 core.PuregoSafeRegister(&XGActionGroupActionEnabledChanged, libs, "g_action_group_action_enabled_changed")
750 core.PuregoSafeRegister(&XGActionGroupActionRemoved, libs, "g_action_group_action_removed")
751 core.PuregoSafeRegister(&XGActionGroupActionStateChanged, libs, "g_action_group_action_state_changed")
752 core.PuregoSafeRegister(&XGActionGroupActivateAction, libs, "g_action_group_activate_action")
753 core.PuregoSafeRegister(&XGActionGroupChangeActionState, libs, "g_action_group_change_action_state")
754 core.PuregoSafeRegister(&XGActionGroupGetActionEnabled, libs, "g_action_group_get_action_enabled")
755 core.PuregoSafeRegister(&XGActionGroupGetActionParameterType, libs, "g_action_group_get_action_parameter_type")
756 core.PuregoSafeRegister(&XGActionGroupGetActionState, libs, "g_action_group_get_action_state")
757 core.PuregoSafeRegister(&XGActionGroupGetActionStateHint, libs, "g_action_group_get_action_state_hint")
758 core.PuregoSafeRegister(&XGActionGroupGetActionStateType, libs, "g_action_group_get_action_state_type")
759 core.PuregoSafeRegister(&XGActionGroupHasAction, libs, "g_action_group_has_action")
760 core.PuregoSafeRegister(&XGActionGroupListActions, libs, "g_action_group_list_actions")
761 core.PuregoSafeRegister(&XGActionGroupQueryAction, libs, "g_action_group_query_action")
762
763}