v0.2.1 c0399be

gtkactionable.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"
13	"github.com/bnema/puregotk/v4/gobject/types"
14)
15
16// The interface vtable for `GtkActionable`.
17type ActionableInterface struct {
18	_ structs.HostLayout
19
20	GIface uintptr
21
22	xGetActionName uintptr
23
24	xSetActionName uintptr
25
26	xGetActionTargetValue uintptr
27
28	xSetActionTargetValue uintptr
29}
30
31func (x *ActionableInterface) GoPointer() uintptr {
32	return uintptr(unsafe.Pointer(x))
33}
34
35// OverrideGetActionName sets the "get_action_name" callback function.
36// virtual function for [method@Actionable.get_action_name]
37func (x *ActionableInterface) OverrideGetActionName(cb func(Actionable) string) {
38	if cb == nil {
39		x.xGetActionName = 0
40	} else {
41		x.xGetActionName = purego.NewCallback(func(ActionableVarp uintptr) string {
42			return cb(&ActionableBase{Ptr: ActionableVarp})
43		})
44	}
45}
46
47// GetGetActionName gets the "get_action_name" callback function.
48// virtual function for [method@Actionable.get_action_name]
49func (x *ActionableInterface) GetGetActionName() func(Actionable) string {
50	if x.xGetActionName == 0 {
51		return nil
52	}
53	var rawCallback func(ActionableVarp uintptr) string
54	purego.RegisterFunc(&rawCallback, x.xGetActionName)
55	return func(ActionableVar Actionable) string {
56		return rawCallback(ActionableVar.GoPointer())
57	}
58}
59
60// OverrideSetActionName sets the "set_action_name" callback function.
61// virtual function for [method@Actionable.set_action_name]
62func (x *ActionableInterface) OverrideSetActionName(cb func(Actionable, string)) {
63	if cb == nil {
64		x.xSetActionName = 0
65	} else {
66		x.xSetActionName = purego.NewCallback(func(ActionableVarp uintptr, ActionNameVarp string) {
67			cb(&ActionableBase{Ptr: ActionableVarp}, ActionNameVarp)
68		})
69	}
70}
71
72// GetSetActionName gets the "set_action_name" callback function.
73// virtual function for [method@Actionable.set_action_name]
74func (x *ActionableInterface) GetSetActionName() func(Actionable, string) {
75	if x.xSetActionName == 0 {
76		return nil
77	}
78	var rawCallback func(ActionableVarp uintptr, ActionNameVarp string)
79	purego.RegisterFunc(&rawCallback, x.xSetActionName)
80	return func(ActionableVar Actionable, ActionNameVar string) {
81		rawCallback(ActionableVar.GoPointer(), ActionNameVar)
82	}
83}
84
85// OverrideGetActionTargetValue sets the "get_action_target_value" callback function.
86// virtual function for [method@Actionable.get_action_target_value]
87func (x *ActionableInterface) OverrideGetActionTargetValue(cb func(Actionable) *glib.Variant) {
88	if cb == nil {
89		x.xGetActionTargetValue = 0
90	} else {
91		x.xGetActionTargetValue = purego.NewCallback(func(ActionableVarp uintptr) *glib.Variant {
92			return cb(&ActionableBase{Ptr: ActionableVarp})
93		})
94	}
95}
96
97// GetGetActionTargetValue gets the "get_action_target_value" callback function.
98// virtual function for [method@Actionable.get_action_target_value]
99func (x *ActionableInterface) GetGetActionTargetValue() func(Actionable) *glib.Variant {
100	if x.xGetActionTargetValue == 0 {
101		return nil
102	}
103	var rawCallback func(ActionableVarp uintptr) *glib.Variant
104	purego.RegisterFunc(&rawCallback, x.xGetActionTargetValue)
105	return func(ActionableVar Actionable) *glib.Variant {
106		return rawCallback(ActionableVar.GoPointer())
107	}
108}
109
110// OverrideSetActionTargetValue sets the "set_action_target_value" callback function.
111// virtual function for [method@Actionable.set_action_target_value]
112func (x *ActionableInterface) OverrideSetActionTargetValue(cb func(Actionable, *glib.Variant)) {
113	if cb == nil {
114		x.xSetActionTargetValue = 0
115	} else {
116		x.xSetActionTargetValue = purego.NewCallback(func(ActionableVarp uintptr, TargetValueVarp *glib.Variant) {
117			cb(&ActionableBase{Ptr: ActionableVarp}, TargetValueVarp)
118		})
119	}
120}
121
122// GetSetActionTargetValue gets the "set_action_target_value" callback function.
123// virtual function for [method@Actionable.set_action_target_value]
124func (x *ActionableInterface) GetSetActionTargetValue() func(Actionable, *glib.Variant) {
125	if x.xSetActionTargetValue == 0 {
126		return nil
127	}
128	var rawCallback func(ActionableVarp uintptr, TargetValueVarp *glib.Variant)
129	purego.RegisterFunc(&rawCallback, x.xSetActionTargetValue)
130	return func(ActionableVar Actionable, TargetValueVar *glib.Variant) {
131		rawCallback(ActionableVar.GoPointer(), TargetValueVar)
132	}
133}
134
135// Provides a way to associate widgets with actions.
136//
137// It primarily consists of two properties: [property@Gtk.Actionable:action-name]
138// and [property@Gtk.Actionable:action-target]. There are also some convenience
139// APIs for setting these properties.
140//
141// The action will be looked up in action groups that are found among
142// the widgets ancestors. Most commonly, these will be the actions with
143// the “win.” or “app.” prefix that are associated with the
144// `GtkApplicationWindow` or `GtkApplication`, but other action groups that
145// are added with [method@Gtk.Widget.insert_action_group] will be consulted
146// as well.
147type Actionable interface {
148	GoPointer() uintptr
149	SetGoPointer(uintptr)
150	GetActionName() string
151	GetActionTargetValue() *glib.Variant
152	SetActionName(ActionNameVar *string)
153	SetActionTarget(FormatStringVar string, varArgs ...interface{})
154	SetActionTargetValue(TargetValueVar *glib.Variant)
155	SetDetailedActionName(DetailedActionNameVar string)
156}
157
158var xActionableGLibType func() types.GType
159
160func ActionableGLibType() types.GType {
161	return xActionableGLibType()
162}
163
164type ActionableBase struct {
165	Ptr uintptr
166}
167
168func (x *ActionableBase) GoPointer() uintptr {
169	if x == nil {
170		return 0
171	}
172	return x.Ptr
173}
174
175func (x *ActionableBase) SetGoPointer(ptr uintptr) {
176	x.Ptr = ptr
177}
178
179// Gets the action name for @actionable.
180func (x *ActionableBase) GetActionName() string {
181
182	cret := XGtkActionableGetActionName(x.GoPointer())
183	return cret
184}
185
186// Gets the current target value of @actionable.
187func (x *ActionableBase) GetActionTargetValue() *glib.Variant {
188
189	cret := XGtkActionableGetActionTargetValue(x.GoPointer())
190	return cret
191}
192
193// Specifies the name of the action with which this widget should be
194// associated.
195//
196// If @action_name is %NULL then the widget will be unassociated from
197// any previous action.
198//
199// Usually this function is used when the widget is located (or will be
200// located) within the hierarchy of a `GtkApplicationWindow`.
201//
202// Names are of the form “win.save” or “app.quit” for actions on the
203// containing [class@ApplicationWindow] or its associated [class@Application],
204// respectively. This is the same form used for actions in the [class@Gio.Menu]
205// associated with the window.
206func (x *ActionableBase) SetActionName(ActionNameVar *string) {
207
208	ActionNameVarPtr := core.GStrdupNullable(ActionNameVar)
209	defer core.GFreeNullable(ActionNameVarPtr)
210
211	XGtkActionableSetActionName(x.GoPointer(), ActionNameVarPtr)
212
213}
214
215// Sets the target of an actionable widget.
216//
217// This is a convenience function that calls [ctor@GLib.Variant.new] for
218// @format_string and uses the result to call
219// [method@Gtk.Actionable.set_action_target_value].
220//
221// If you are setting a string-valued target and want to set
222// the action name at the same time, you can use
223// [method@Gtk.Actionable.set_detailed_action_name].
224func (x *ActionableBase) SetActionTarget(FormatStringVar string, varArgs ...interface{}) {
225
226	XGtkActionableSetActionTarget(x.GoPointer(), FormatStringVar, varArgs...)
227
228}
229
230// Sets the target value of an actionable widget.
231//
232// If @target_value is %NULL then the target value is unset.
233//
234// The target value has two purposes. First, it is used as the parameter
235// to activation of the action associated with the `GtkActionable` widget.
236// Second, it is used to determine if the widget should be rendered as
237// “active” — the widget is active if the state is equal to the given target.
238//
239// Consider the example of associating a set of buttons with a [iface@Gio.Action]
240// with string state in a typical “radio button” situation. Each button
241// will be associated with the same action, but with a different target
242// value for that action. Clicking on a particular button will activate
243// the action with the target of that button, which will typically cause
244// the action’s state to change to that value. Since the action’s state
245// is now equal to the target value of the button, the button will now
246// be rendered as active (and the other buttons, with different targets,
247// rendered inactive).
248func (x *ActionableBase) SetActionTargetValue(TargetValueVar *glib.Variant) {
249
250	XGtkActionableSetActionTargetValue(x.GoPointer(), TargetValueVar)
251
252}
253
254// Sets the action-name and associated string target value of an
255// actionable widget.
256//
257// @detailed_action_name is a string in the format accepted by
258// [func@Gio.Action.parse_detailed_name].
259func (x *ActionableBase) SetDetailedActionName(DetailedActionNameVar string) {
260
261	XGtkActionableSetDetailedActionName(x.GoPointer(), DetailedActionNameVar)
262
263}
264
265// SetPropertyActionName sets the "action-name" property.
266// The name of the action with which this widget should be associated.
267func (x *ActionableBase) SetPropertyActionName(value string) {
268	obj := gobject.Object{}
269	obj.Ptr = x.GoPointer()
270	var v gobject.Value
271	v.Init(gobject.TypeStringVal)
272	v.SetString(&value)
273	obj.SetProperty("action-name", &v)
274}
275
276// GetPropertyActionName gets the "action-name" property.
277// The name of the action with which this widget should be associated.
278func (x *ActionableBase) GetPropertyActionName() string {
279	obj := gobject.Object{}
280	obj.Ptr = x.GoPointer()
281	var v gobject.Value
282	obj.GetProperty("action-name", &v)
283	return v.GetString()
284}
285
286// SetPropertyActionTarget sets the "action-target" property.
287// The target value of the actionable widget's action.
288func (x *ActionableBase) SetPropertyActionTarget(value uintptr) {
289	obj := gobject.Object{}
290	obj.Ptr = x.GoPointer()
291	var v gobject.Value
292	v.Init(gobject.TypePointerVal)
293	v.SetPointer(value)
294	obj.SetProperty("action-target", &v)
295}
296
297// GetPropertyActionTarget gets the "action-target" property.
298// The target value of the actionable widget's action.
299func (x *ActionableBase) GetPropertyActionTarget() uintptr {
300	obj := gobject.Object{}
301	obj.Ptr = x.GoPointer()
302	var v gobject.Value
303	obj.GetProperty("action-target", &v)
304	return v.GetPointer()
305}
306
307var XGtkActionableGetActionName func(uintptr) string
308var XGtkActionableGetActionTargetValue func(uintptr) *glib.Variant
309var XGtkActionableSetActionName func(uintptr, uintptr)
310var XGtkActionableSetActionTarget func(uintptr, string, ...interface{})
311var XGtkActionableSetActionTargetValue func(uintptr, *glib.Variant)
312var XGtkActionableSetDetailedActionName func(uintptr, string)
313
314func init() {
315	core.SetPackageName("GTK", "gtk4")
316	core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
317	var libs []uintptr
318	for _, libPath := range core.GetPaths("GTK") {
319		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
320		if err != nil {
321			panic(err)
322		}
323		libs = append(libs, lib)
324	}
325
326	core.PuregoSafeRegister(&xActionableGLibType, libs, "gtk_actionable_get_type")
327
328	core.PuregoSafeRegister(&XGtkActionableGetActionName, libs, "gtk_actionable_get_action_name")
329	core.PuregoSafeRegister(&XGtkActionableGetActionTargetValue, libs, "gtk_actionable_get_action_target_value")
330	core.PuregoSafeRegister(&XGtkActionableSetActionName, libs, "gtk_actionable_set_action_name")
331	core.PuregoSafeRegister(&XGtkActionableSetActionTarget, libs, "gtk_actionable_set_action_target")
332	core.PuregoSafeRegister(&XGtkActionableSetActionTargetValue, libs, "gtk_actionable_set_action_target_value")
333	core.PuregoSafeRegister(&XGtkActionableSetDetailedActionName, libs, "gtk_actionable_set_detailed_action_name")
334
335}

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