v0.2.2 9100209

gbinding.go RawHistoryFolder

1// Package gobject was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gobject
3
4import (
5	"github.com/ebitengine/purego"
6
7	"github.com/bnema/puregotk/pkg/core"
8	"github.com/bnema/puregotk/v4/gobject/types"
9)
10
11// A function to be called to transform @from_value to @to_value.
12//
13// If this is the @transform_to function of a binding, then @from_value
14// is the @source_property on the @source object, and @to_value is the
15// @target_property on the @target object. If this is the
16// @transform_from function of a %G_BINDING_BIDIRECTIONAL binding,
17// then those roles are reversed.
18type BindingTransformFunc func(uintptr, *Value, *Value, uintptr) bool
19
20// Flags to be passed to g_object_bind_property() or
21// g_object_bind_property_full().
22//
23// This enumeration can be extended at later date.
24type BindingFlags int
25
26var xBindingFlagsGLibType func() types.GType
27
28func BindingFlagsGLibType() types.GType {
29	return xBindingFlagsGLibType()
30}
31
32const (
33
34	// The default binding; if the source property
35	//   changes, the target property is updated with its value.
36	GBindingDefaultValue BindingFlags = 0
37	// Bidirectional binding; if either the
38	//   property of the source or the property of the target changes,
39	//   the other is updated.
40	GBindingBidirectionalValue BindingFlags = 1
41	// Synchronize the values of the source and
42	//   target properties when creating the binding; the direction of
43	//   the synchronization is always from the source to the target.
44	GBindingSyncCreateValue BindingFlags = 2
45	// If the two properties being bound are
46	//   booleans, setting one to %TRUE will result in the other being
47	//   set to %FALSE and vice versa. This flag will only work for
48	//   boolean properties, and cannot be used when passing custom
49	//   transformation functions to g_object_bind_property_full().
50	GBindingInvertBooleanValue BindingFlags = 4
51)
52
53// `GObject` instance (or source) and another property on another `GObject`
54// instance (or target).
55//
56// Whenever the source property changes, the same value is applied to the
57// target property; for instance, the following binding:
58//
59// ```c
60//
61//	g_object_bind_property (object1, "property-a",
62//	                        object2, "property-b",
63//	                        G_BINDING_DEFAULT);
64//
65// ```
66//
67// will cause the property named "property-b" of @object2 to be updated
68// every time [method@GObject.set] or the specific accessor changes the value of
69// the property "property-a" of @object1.
70//
71// It is possible to create a bidirectional binding between two properties
72// of two `GObject` instances, so that if either property changes, the
73// other is updated as well, for instance:
74//
75// ```c
76//
77//	g_object_bind_property (object1, "property-a",
78//	                        object2, "property-b",
79//	                        G_BINDING_BIDIRECTIONAL);
80//
81// ```
82//
83// will keep the two properties in sync.
84//
85// It is also possible to set a custom transformation function (in both
86// directions, in case of a bidirectional binding) to apply a custom
87// transformation from the source value to the target value before
88// applying it; for instance, the following binding:
89//
90// ```c
91//
92//	g_object_bind_property_full (adjustment1, "value",
93//	                             adjustment2, "value",
94//	                             G_BINDING_BIDIRECTIONAL,
95//	                             celsius_to_fahrenheit,
96//	                             fahrenheit_to_celsius,
97//	                             NULL, NULL);
98//
99// ```
100//
101// will keep the "value" property of the two adjustments in sync; the
102// @celsius_to_fahrenheit function will be called whenever the "value"
103// property of @adjustment1 changes and will transform the current value
104// of the property before applying it to the "value" property of @adjustment2.
105//
106// Vice versa, the @fahrenheit_to_celsius function will be called whenever
107// the "value" property of @adjustment2 changes, and will transform the
108// current value of the property before applying it to the "value" property
109// of @adjustment1.
110//
111// Note that #GBinding does not resolve cycles by itself; a cycle like
112//
113// ```
114//
115//	object1:propertyA -> object2:propertyB
116//	object2:propertyB -> object3:propertyC
117//	object3:propertyC -> object1:propertyA
118//
119// ```
120//
121// might lead to an infinite loop. The loop, in this particular case,
122// can be avoided if the objects emit the `GObject::notify` signal only
123// if the value has effectively been changed. A binding is implemented
124// using the `GObject::notify` signal, so it is susceptible to all the
125// various ways of blocking a signal emission, like [func@GObject.signal_stop_emission]
126// or [func@GObject.signal_handler_block].
127//
128// A binding will be severed, and the resources it allocates freed, whenever
129// either one of the `GObject` instances it refers to are finalized, or when
130// the #GBinding instance loses its last reference.
131//
132// Bindings for languages with garbage collection can use
133// [method@GObject.Binding.unbind] to explicitly release a binding between the source
134// and target properties, instead of relying on the last reference on the
135// binding, source, and target instances to drop.
136type Binding struct {
137	Object
138}
139
140var xBindingGLibType func() types.GType
141
142func BindingGLibType() types.GType {
143	return xBindingGLibType()
144}
145
146func BindingNewFromInternalPtr(ptr uintptr) *Binding {
147	cls := &Binding{}
148	cls.Ptr = ptr
149	return cls
150}
151
152var xBindingDupSource func(uintptr) uintptr
153
154// Retrieves the #GObject instance used as the source of the binding.
155//
156// A #GBinding can outlive the source #GObject as the binding does not hold a
157// strong reference to the source. If the source is destroyed before the
158// binding then this function will return %NULL.
159func (x *Binding) DupSource() *Object {
160	var cls *Object
161
162	cret := xBindingDupSource(x.GoPointer())
163
164	if cret == 0 {
165		return nil
166	}
167	cls = &Object{}
168	cls.Ptr = cret
169	return cls
170}
171
172var xBindingDupTarget func(uintptr) uintptr
173
174// Retrieves the #GObject instance used as the target of the binding.
175//
176// A #GBinding can outlive the target #GObject as the binding does not hold a
177// strong reference to the target. If the target is destroyed before the
178// binding then this function will return %NULL.
179func (x *Binding) DupTarget() *Object {
180	var cls *Object
181
182	cret := xBindingDupTarget(x.GoPointer())
183
184	if cret == 0 {
185		return nil
186	}
187	cls = &Object{}
188	cls.Ptr = cret
189	return cls
190}
191
192var xBindingGetFlags func(uintptr) BindingFlags
193
194// Retrieves the flags passed when constructing the #GBinding.
195func (x *Binding) GetFlags() BindingFlags {
196
197	cret := xBindingGetFlags(x.GoPointer())
198	return cret
199}
200
201var xBindingGetSource func(uintptr) uintptr
202
203// Retrieves the #GObject instance used as the source of the binding.
204//
205// A #GBinding can outlive the source #GObject as the binding does not hold a
206// strong reference to the source. If the source is destroyed before the
207// binding then this function will return %NULL.
208//
209// Use g_binding_dup_source() if the source or binding are used from different
210// threads as otherwise the pointer returned from this function might become
211// invalid if the source is finalized from another thread in the meantime.
212func (x *Binding) GetSource() *Object {
213	var cls *Object
214
215	cret := xBindingGetSource(x.GoPointer())
216
217	if cret == 0 {
218		return nil
219	}
220	IncreaseRef(cret)
221	cls = &Object{}
222	cls.Ptr = cret
223	return cls
224}
225
226var xBindingGetSourceProperty func(uintptr) string
227
228// Retrieves the name of the property of #GBinding:source used as the source
229// of the binding.
230func (x *Binding) GetSourceProperty() string {
231
232	cret := xBindingGetSourceProperty(x.GoPointer())
233	return cret
234}
235
236var xBindingGetTarget func(uintptr) uintptr
237
238// Retrieves the #GObject instance used as the target of the binding.
239//
240// A #GBinding can outlive the target #GObject as the binding does not hold a
241// strong reference to the target. If the target is destroyed before the
242// binding then this function will return %NULL.
243//
244// Use g_binding_dup_target() if the target or binding are used from different
245// threads as otherwise the pointer returned from this function might become
246// invalid if the target is finalized from another thread in the meantime.
247func (x *Binding) GetTarget() *Object {
248	var cls *Object
249
250	cret := xBindingGetTarget(x.GoPointer())
251
252	if cret == 0 {
253		return nil
254	}
255	IncreaseRef(cret)
256	cls = &Object{}
257	cls.Ptr = cret
258	return cls
259}
260
261var xBindingGetTargetProperty func(uintptr) string
262
263// Retrieves the name of the property of #GBinding:target used as the target
264// of the binding.
265func (x *Binding) GetTargetProperty() string {
266
267	cret := xBindingGetTargetProperty(x.GoPointer())
268	return cret
269}
270
271var xBindingUnbind func(uintptr)
272
273// Explicitly releases the binding between the source and the target
274// property expressed by @binding.
275//
276// This function will release the reference that is being held on
277// the @binding instance if the binding is still bound; if you want to hold on
278// to the #GBinding instance after calling g_binding_unbind(), you will need
279// to hold a reference to it.
280//
281// Note however that this function does not take ownership of @binding, it
282// only unrefs the reference that was initially created by
283// g_object_bind_property() and is owned by the binding.
284func (x *Binding) Unbind() {
285
286	xBindingUnbind(x.GoPointer())
287
288}
289
290func (c *Binding) GoPointer() uintptr {
291	if c == nil {
292		return 0
293	}
294	return c.Ptr
295}
296
297func (c *Binding) SetGoPointer(ptr uintptr) {
298	c.Ptr = ptr
299}
300
301// SetPropertySourceProperty sets the "source-property" property.
302// The name of the property of #GBinding:source that should be used
303// as the source of the binding.
304//
305// This should be in [canonical form][canonical-parameter-names] to get the
306// best performance.
307func (x *Binding) SetPropertySourceProperty(value string) {
308	var v Value
309	v.Init(TypeStringVal)
310	v.SetString(&value)
311	x.SetProperty("source-property", &v)
312}
313
314// GetPropertySourceProperty gets the "source-property" property.
315// The name of the property of #GBinding:source that should be used
316// as the source of the binding.
317//
318// This should be in [canonical form][canonical-parameter-names] to get the
319// best performance.
320func (x *Binding) GetPropertySourceProperty() string {
321	var v Value
322	x.GetProperty("source-property", &v)
323	return v.GetString()
324}
325
326// SetPropertyTargetProperty sets the "target-property" property.
327// The name of the property of #GBinding:target that should be used
328// as the target of the binding.
329//
330// This should be in [canonical form][canonical-parameter-names] to get the
331// best performance.
332func (x *Binding) SetPropertyTargetProperty(value string) {
333	var v Value
334	v.Init(TypeStringVal)
335	v.SetString(&value)
336	x.SetProperty("target-property", &v)
337}
338
339// GetPropertyTargetProperty gets the "target-property" property.
340// The name of the property of #GBinding:target that should be used
341// as the target of the binding.
342//
343// This should be in [canonical form][canonical-parameter-names] to get the
344// best performance.
345func (x *Binding) GetPropertyTargetProperty() string {
346	var v Value
347	x.GetProperty("target-property", &v)
348	return v.GetString()
349}
350
351func init() {
352	core.SetPackageName("GOBJECT", "gobject-2.0")
353	core.SetSharedLibraries("GOBJECT", []string{"libgobject-2.0.so.0"})
354	var libs []uintptr
355	for _, libPath := range core.GetPaths("GOBJECT") {
356		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
357		if err != nil {
358			panic(err)
359		}
360		libs = append(libs, lib)
361	}
362
363	core.PuregoSafeRegister(&xBindingFlagsGLibType, libs, "g_binding_flags_get_type")
364
365	core.PuregoSafeRegister(&xBindingGLibType, libs, "g_binding_get_type")
366
367	core.PuregoSafeRegister(&xBindingDupSource, libs, "g_binding_dup_source")
368	core.PuregoSafeRegister(&xBindingDupTarget, libs, "g_binding_dup_target")
369	core.PuregoSafeRegister(&xBindingGetFlags, libs, "g_binding_get_flags")
370	core.PuregoSafeRegister(&xBindingGetSource, libs, "g_binding_get_source")
371	core.PuregoSafeRegister(&xBindingGetSourceProperty, libs, "g_binding_get_source_property")
372	core.PuregoSafeRegister(&xBindingGetTarget, libs, "g_binding_get_target")
373	core.PuregoSafeRegister(&xBindingGetTargetProperty, libs, "g_binding_get_target_property")
374	core.PuregoSafeRegister(&xBindingUnbind, libs, "g_binding_unbind")
375
376}

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