v0.2.1 c0399be

gtklockbutton.go RawHistoryFolder

1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
3
4import (
5	"github.com/ebitengine/purego"
6
7	"github.com/bnema/puregotk/pkg/core"
8	"github.com/bnema/puregotk/v4/gio"
9	"github.com/bnema/puregotk/v4/glib"
10	"github.com/bnema/puregotk/v4/gobject"
11	"github.com/bnema/puregotk/v4/gobject/types"
12)
13
14// `GtkLockButton` is a widget to obtain and revoke authorizations
15// needed to operate the controls.
16//
17// <picture>
18//
19//	<source srcset="lockbutton-dark.png" media="(prefers-color-scheme: dark)">
20//	<img alt="An example GtkLockButton" src="lockbutton.png">
21//
22// </picture>
23//
24// It is typically used in preference dialogs or control panels.
25//
26// The required authorization is represented by a `GPermission` object.
27// Concrete implementations of `GPermission` may use PolicyKit or some
28// other authorization framework. To obtain a PolicyKit-based
29// `GPermission`, use `polkit_permission_new()`.
30//
31// If the user is not currently allowed to perform the action, but can
32// obtain the permission, the widget looks like this:
33//
34// <picture>
35//
36//	<source srcset="lockbutton-dark.png" media="(prefers-color-scheme: dark)">
37//	<img alt="An locked GtkLockButton" src="lockbutton.png">
38//
39// </picture>
40//
41// and the user can click the button to request the permission. Depending
42// on the platform, this may pop up an authentication dialog or ask the user
43// to authenticate in some other way. Once the user has obtained the permission,
44// the widget changes to this:
45//
46// <picture>
47//
48//	<source srcset="lockbutton-unlocked-dark.png" media="(prefers-color-scheme: dark)">
49//	<img alt="An unlocked GtkLockButton" src="lockbutton-unlocked.png">
50//
51// </picture>
52//
53// and the permission can be dropped again by clicking the button. If the user
54// is not able to obtain the permission at all, the widget looks like this:
55//
56// <picture>
57//
58//	<source srcset="lockbutton-sorry-dark.png" media="(prefers-color-scheme: dark)">
59//	<img alt="An unobtainable GtkLockButton" src="lockbutton-sorry.png">
60//
61// </picture>
62//
63// If the user has the permission and cannot drop it, the button is hidden.
64//
65// The text (and tooltips) that are shown in the various cases can be adjusted
66// with the [property@Gtk.LockButton:text-lock],
67// [property@Gtk.LockButton:text-unlock],
68// [property@Gtk.LockButton:tooltip-lock],
69// [property@Gtk.LockButton:tooltip-unlock] and
70// [property@Gtk.LockButton:tooltip-not-authorized] properties.
71type LockButton struct {
72	Button
73}
74
75var xLockButtonGLibType func() types.GType
76
77func LockButtonGLibType() types.GType {
78	return xLockButtonGLibType()
79}
80
81func LockButtonNewFromInternalPtr(ptr uintptr) *LockButton {
82	cls := &LockButton{}
83	cls.Ptr = ptr
84	return cls
85}
86
87var xNewLockButton func(uintptr) uintptr
88
89// Creates a new lock button which reflects the @permission.
90func NewLockButton(PermissionVar *gio.Permission) *LockButton {
91	var cls *LockButton
92
93	cret := xNewLockButton(PermissionVar.GoPointer())
94
95	if cret == 0 {
96		return nil
97	}
98	gobject.IncreaseRef(cret)
99	cls = &LockButton{}
100	cls.Ptr = cret
101	return cls
102}
103
104var xLockButtonGetPermission func(uintptr) uintptr
105
106// Obtains the `GPermission` object that controls @button.
107func (x *LockButton) GetPermission() *gio.Permission {
108	var cls *gio.Permission
109
110	cret := xLockButtonGetPermission(x.GoPointer())
111
112	if cret == 0 {
113		return nil
114	}
115	gobject.IncreaseRef(cret)
116	cls = &gio.Permission{}
117	cls.Ptr = cret
118	return cls
119}
120
121var xLockButtonSetPermission func(uintptr, uintptr)
122
123// Sets the `GPermission` object that controls @button.
124func (x *LockButton) SetPermission(PermissionVar *gio.Permission) {
125
126	xLockButtonSetPermission(x.GoPointer(), PermissionVar.GoPointer())
127
128}
129
130func (c *LockButton) GoPointer() uintptr {
131	if c == nil {
132		return 0
133	}
134	return c.Ptr
135}
136
137func (c *LockButton) SetGoPointer(ptr uintptr) {
138	c.Ptr = ptr
139}
140
141// SetPropertyTextLock sets the "text-lock" property.
142// The text to display when prompting the user to lock.
143func (x *LockButton) SetPropertyTextLock(value string) {
144	var v gobject.Value
145	v.Init(gobject.TypeStringVal)
146	v.SetString(&value)
147	x.SetProperty("text-lock", &v)
148}
149
150// GetPropertyTextLock gets the "text-lock" property.
151// The text to display when prompting the user to lock.
152func (x *LockButton) GetPropertyTextLock() string {
153	var v gobject.Value
154	x.GetProperty("text-lock", &v)
155	return v.GetString()
156}
157
158// SetPropertyTextUnlock sets the "text-unlock" property.
159// The text to display when prompting the user to unlock.
160func (x *LockButton) SetPropertyTextUnlock(value string) {
161	var v gobject.Value
162	v.Init(gobject.TypeStringVal)
163	v.SetString(&value)
164	x.SetProperty("text-unlock", &v)
165}
166
167// GetPropertyTextUnlock gets the "text-unlock" property.
168// The text to display when prompting the user to unlock.
169func (x *LockButton) GetPropertyTextUnlock() string {
170	var v gobject.Value
171	x.GetProperty("text-unlock", &v)
172	return v.GetString()
173}
174
175// SetPropertyTooltipLock sets the "tooltip-lock" property.
176// The tooltip to display when prompting the user to lock.
177func (x *LockButton) SetPropertyTooltipLock(value string) {
178	var v gobject.Value
179	v.Init(gobject.TypeStringVal)
180	v.SetString(&value)
181	x.SetProperty("tooltip-lock", &v)
182}
183
184// GetPropertyTooltipLock gets the "tooltip-lock" property.
185// The tooltip to display when prompting the user to lock.
186func (x *LockButton) GetPropertyTooltipLock() string {
187	var v gobject.Value
188	x.GetProperty("tooltip-lock", &v)
189	return v.GetString()
190}
191
192// SetPropertyTooltipNotAuthorized sets the "tooltip-not-authorized" property.
193// The tooltip to display when the user cannot obtain authorization.
194func (x *LockButton) SetPropertyTooltipNotAuthorized(value string) {
195	var v gobject.Value
196	v.Init(gobject.TypeStringVal)
197	v.SetString(&value)
198	x.SetProperty("tooltip-not-authorized", &v)
199}
200
201// GetPropertyTooltipNotAuthorized gets the "tooltip-not-authorized" property.
202// The tooltip to display when the user cannot obtain authorization.
203func (x *LockButton) GetPropertyTooltipNotAuthorized() string {
204	var v gobject.Value
205	x.GetProperty("tooltip-not-authorized", &v)
206	return v.GetString()
207}
208
209// SetPropertyTooltipUnlock sets the "tooltip-unlock" property.
210// The tooltip to display when prompting the user to unlock.
211func (x *LockButton) SetPropertyTooltipUnlock(value string) {
212	var v gobject.Value
213	v.Init(gobject.TypeStringVal)
214	v.SetString(&value)
215	x.SetProperty("tooltip-unlock", &v)
216}
217
218// GetPropertyTooltipUnlock gets the "tooltip-unlock" property.
219// The tooltip to display when prompting the user to unlock.
220func (x *LockButton) GetPropertyTooltipUnlock() string {
221	var v gobject.Value
222	x.GetProperty("tooltip-unlock", &v)
223	return v.GetString()
224}
225
226// Requests the user's screen reader to announce the given message.
227//
228// This kind of notification is useful for messages that
229// either have only a visual representation or that are not
230// exposed visually at all, e.g. a notification about a
231// successful operation.
232//
233// Also, by using this API, you can ensure that the message
234// does not interrupts the user's current screen reader output.
235func (x *LockButton) Announce(MessageVar string, PriorityVar AccessibleAnnouncementPriority) {
236
237	XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar)
238
239}
240
241// Retrieves the accessible parent for an accessible object.
242//
243// This function returns `NULL` for top level widgets.
244func (x *LockButton) GetAccessibleParent() *AccessibleBase {
245	var cls *AccessibleBase
246
247	cret := XGtkAccessibleGetAccessibleParent(x.GoPointer())
248
249	if cret == 0 {
250		return nil
251	}
252	cls = &AccessibleBase{}
253	cls.Ptr = cret
254	return cls
255}
256
257// Retrieves the accessible role of an accessible object.
258func (x *LockButton) GetAccessibleRole() AccessibleRole {
259
260	cret := XGtkAccessibleGetAccessibleRole(x.GoPointer())
261	return cret
262}
263
264// Retrieves the implementation for the given accessible object.
265func (x *LockButton) GetAtContext() *ATContext {
266	var cls *ATContext
267
268	cret := XGtkAccessibleGetAtContext(x.GoPointer())
269
270	if cret == 0 {
271		return nil
272	}
273	cls = &ATContext{}
274	cls.Ptr = cret
275	return cls
276}
277
278// Queries the coordinates and dimensions of this accessible
279//
280// This functionality can be overridden by `GtkAccessible`
281// implementations, e.g. to get the bounds from an ignored
282// child widget.
283func (x *LockButton) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool {
284
285	cret := XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
286	return cret
287}
288
289// Retrieves the first accessible child of an accessible object.
290func (x *LockButton) GetFirstAccessibleChild() *AccessibleBase {
291	var cls *AccessibleBase
292
293	cret := XGtkAccessibleGetFirstAccessibleChild(x.GoPointer())
294
295	if cret == 0 {
296		return nil
297	}
298	cls = &AccessibleBase{}
299	cls.Ptr = cret
300	return cls
301}
302
303// Retrieves the next accessible sibling of an accessible object
304func (x *LockButton) GetNextAccessibleSibling() *AccessibleBase {
305	var cls *AccessibleBase
306
307	cret := XGtkAccessibleGetNextAccessibleSibling(x.GoPointer())
308
309	if cret == 0 {
310		return nil
311	}
312	cls = &AccessibleBase{}
313	cls.Ptr = cret
314	return cls
315}
316
317// Queries a platform state, such as focus.
318//
319// This functionality can be overridden by `GtkAccessible`
320// implementations, e.g. to get platform state from an ignored
321// child widget, as is the case for `GtkText` wrappers.
322func (x *LockButton) GetPlatformState(StateVar AccessiblePlatformState) bool {
323
324	cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar)
325	return cret
326}
327
328// Resets the accessible property to its default value.
329func (x *LockButton) ResetProperty(PropertyVar AccessibleProperty) {
330
331	XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar)
332
333}
334
335// Resets the accessible relation to its default value.
336func (x *LockButton) ResetRelation(RelationVar AccessibleRelation) {
337
338	XGtkAccessibleResetRelation(x.GoPointer(), RelationVar)
339
340}
341
342// Resets the accessible state to its default value.
343func (x *LockButton) ResetState(StateVar AccessibleState) {
344
345	XGtkAccessibleResetState(x.GoPointer(), StateVar)
346
347}
348
349// Sets the parent and sibling of an accessible object.
350//
351// This function is meant to be used by accessible implementations that are
352// not part of the widget hierarchy, and but act as a logical bridge between
353// widgets. For instance, if a widget creates an object that holds metadata
354// for each child, and you want that object to implement the `GtkAccessible`
355// interface, you will use this function to ensure that the parent of each
356// child widget is the metadata object, and the parent of each metadata
357// object is the container widget.
358func (x *LockButton) SetAccessibleParent(ParentVar Accessible, NextSiblingVar Accessible) {
359
360	XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer())
361
362}
363
364// Updates the next accessible sibling.
365//
366// That might be useful when a new child of a custom accessible
367// is created, and it needs to be linked to a previous child.
368func (x *LockButton) UpdateNextAccessibleSibling(NewSiblingVar Accessible) {
369
370	XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer())
371
372}
373
374// Informs ATs that the platform state has changed.
375//
376// This function should be used by `GtkAccessible` implementations that
377// have a platform state but are not widgets. Widgets handle platform
378// states automatically.
379func (x *LockButton) UpdatePlatformState(StateVar AccessiblePlatformState) {
380
381	XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar)
382
383}
384
385// Updates a list of accessible properties.
386//
387// See the [enum@Gtk.AccessibleProperty] documentation for the
388// value types of accessible properties.
389//
390// This function should be called by `GtkWidget` types whenever
391// an accessible property change must be communicated to assistive
392// technologies.
393//
394// Example:
395// ```c
396// value = gtk_adjustment_get_value (adjustment);
397// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
398//
399//	GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
400//	-1);
401//
402// ```
403func (x *LockButton) UpdateProperty(FirstPropertyVar AccessibleProperty, varArgs ...interface{}) {
404
405	XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...)
406
407}
408
409// Updates an array of accessible properties.
410//
411// This function should be called by `GtkWidget` types whenever an accessible
412// property change must be communicated to assistive technologies.
413//
414// This function is meant to be used by language bindings.
415func (x *LockButton) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []AccessibleProperty, ValuesVar []gobject.Value) {
416
417	XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar)
418
419}
420
421// Updates a list of accessible relations.
422//
423// This function should be called by `GtkWidget` types whenever an accessible
424// relation change must be communicated to assistive technologies.
425//
426// If the [enum@Gtk.AccessibleRelation] requires a list of references,
427// you should pass each reference individually, followed by `NULL`, e.g.
428//
429// ```c
430// gtk_accessible_update_relation (accessible,
431//
432//	GTK_ACCESSIBLE_RELATION_CONTROLS,
433//	  ref1, NULL,
434//	GTK_ACCESSIBLE_RELATION_LABELLED_BY,
435//	  ref1, ref2, ref3, NULL,
436//	-1);
437//
438// ```
439func (x *LockButton) UpdateRelation(FirstRelationVar AccessibleRelation, varArgs ...interface{}) {
440
441	XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...)
442
443}
444
445// Updates an array of accessible relations.
446//
447// This function should be called by `GtkWidget` types whenever an accessible
448// relation change must be communicated to assistive technologies.
449//
450// This function is meant to be used by language bindings.
451func (x *LockButton) UpdateRelationValue(NRelationsVar int, RelationsVar []AccessibleRelation, ValuesVar []gobject.Value) {
452
453	XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar)
454
455}
456
457// Updates a list of accessible states.
458//
459// See the [enum@Gtk.AccessibleState] documentation for the
460// value types of accessible states.
461//
462// This function should be called by `GtkWidget` types whenever
463// an accessible state change must be communicated to assistive
464// technologies.
465//
466// Example:
467//
468// ```c
469// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
470// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
471//
472//	GTK_ACCESSIBLE_STATE_CHECKED, value,
473//	-1);
474//
475// ```
476func (x *LockButton) UpdateState(FirstStateVar AccessibleState, varArgs ...interface{}) {
477
478	XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...)
479
480}
481
482// Updates an array of accessible states.
483//
484// This function should be called by `GtkWidget` types whenever an accessible
485// state change must be communicated to assistive technologies.
486//
487// This function is meant to be used by language bindings.
488func (x *LockButton) UpdateStateValue(NStatesVar int, StatesVar []AccessibleState, ValuesVar []gobject.Value) {
489
490	XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar)
491
492}
493
494// Gets the action name for @actionable.
495func (x *LockButton) GetActionName() string {
496
497	cret := XGtkActionableGetActionName(x.GoPointer())
498	return cret
499}
500
501// Gets the current target value of @actionable.
502func (x *LockButton) GetActionTargetValue() *glib.Variant {
503
504	cret := XGtkActionableGetActionTargetValue(x.GoPointer())
505	return cret
506}
507
508// Specifies the name of the action with which this widget should be
509// associated.
510//
511// If @action_name is %NULL then the widget will be unassociated from
512// any previous action.
513//
514// Usually this function is used when the widget is located (or will be
515// located) within the hierarchy of a `GtkApplicationWindow`.
516//
517// Names are of the form “win.save” or “app.quit” for actions on the
518// containing [class@ApplicationWindow] or its associated [class@Application],
519// respectively. This is the same form used for actions in the [class@Gio.Menu]
520// associated with the window.
521func (x *LockButton) SetActionName(ActionNameVar *string) {
522
523	ActionNameVarPtr := core.GStrdupNullable(ActionNameVar)
524	defer core.GFreeNullable(ActionNameVarPtr)
525
526	XGtkActionableSetActionName(x.GoPointer(), ActionNameVarPtr)
527
528}
529
530// Sets the target of an actionable widget.
531//
532// This is a convenience function that calls [ctor@GLib.Variant.new] for
533// @format_string and uses the result to call
534// [method@Gtk.Actionable.set_action_target_value].
535//
536// If you are setting a string-valued target and want to set
537// the action name at the same time, you can use
538// [method@Gtk.Actionable.set_detailed_action_name].
539func (x *LockButton) SetActionTarget(FormatStringVar string, varArgs ...interface{}) {
540
541	XGtkActionableSetActionTarget(x.GoPointer(), FormatStringVar, varArgs...)
542
543}
544
545// Sets the target value of an actionable widget.
546//
547// If @target_value is %NULL then the target value is unset.
548//
549// The target value has two purposes. First, it is used as the parameter
550// to activation of the action associated with the `GtkActionable` widget.
551// Second, it is used to determine if the widget should be rendered as
552// “active” — the widget is active if the state is equal to the given target.
553//
554// Consider the example of associating a set of buttons with a [iface@Gio.Action]
555// with string state in a typical “radio button” situation. Each button
556// will be associated with the same action, but with a different target
557// value for that action. Clicking on a particular button will activate
558// the action with the target of that button, which will typically cause
559// the action’s state to change to that value. Since the action’s state
560// is now equal to the target value of the button, the button will now
561// be rendered as active (and the other buttons, with different targets,
562// rendered inactive).
563func (x *LockButton) SetActionTargetValue(TargetValueVar *glib.Variant) {
564
565	XGtkActionableSetActionTargetValue(x.GoPointer(), TargetValueVar)
566
567}
568
569// Sets the action-name and associated string target value of an
570// actionable widget.
571//
572// @detailed_action_name is a string in the format accepted by
573// [func@Gio.Action.parse_detailed_name].
574func (x *LockButton) SetDetailedActionName(DetailedActionNameVar string) {
575
576	XGtkActionableSetDetailedActionName(x.GoPointer(), DetailedActionNameVar)
577
578}
579
580// Gets the ID of the @buildable object.
581//
582// `GtkBuilder` sets the name based on the ID attribute
583// of the `<object>` tag used to construct the @buildable.
584func (x *LockButton) GetBuildableId() string {
585
586	cret := XGtkBuildableGetBuildableId(x.GoPointer())
587	return cret
588}
589
590func init() {
591	core.SetPackageName("GTK", "gtk4")
592	core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
593	var libs []uintptr
594	for _, libPath := range core.GetPaths("GTK") {
595		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
596		if err != nil {
597			panic(err)
598		}
599		libs = append(libs, lib)
600	}
601
602	core.PuregoSafeRegister(&xLockButtonGLibType, libs, "gtk_lock_button_get_type")
603
604	core.PuregoSafeRegister(&xNewLockButton, libs, "gtk_lock_button_new")
605
606	core.PuregoSafeRegister(&xLockButtonGetPermission, libs, "gtk_lock_button_get_permission")
607	core.PuregoSafeRegister(&xLockButtonSetPermission, libs, "gtk_lock_button_set_permission")
608
609}

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