Commit Graph

21 Commits

Author SHA1 Message Date
Dan Winship
8e17040c15 Fix overloading of "source" and "target" terminology in GBinding
GBindingTransformFunc called its arguments "source_value" and
"target_value", but in the transform_from function of a bidirectional
binding, "source_value" comes from the target object, and
"target_value" comes from the source object, which quickly gets
confusing if you need to use g_binding_get_source(), etc, in the
function.

Of course developers can call their transform function arguments
whatever they want, but many will copy from the headers/docs to start
out, so use less confusing names here ("from_value" and "to_value").

Also, fix the documentation to describe the bidirectional case
correctly.

https://bugzilla.gnome.org/show_bug.cgi?id=709440
2013-10-06 14:24:43 -04:00
Emmanuele Bassi
d1959e4faa binding: Use hash table as a set 2013-06-12 11:24:55 +01:00
Emmanuele Bassi
25a3c8720c binding: Make unbind() release the reference on GBinding
The automatic memory management of GBinding is not optimal for high
order languages with garbage collectors semantics. If we leave the
binding instance inert but still referenced it will be leaked, so one
solution that does not throw away the baby of C convenience with the
bathwater of language bindability is to have unbind() perform an
implicit unref().

Hopefully, C developers will read the documentation and especially the
note that says that after calling unbind() the reference count on the
GBinding instance is decreased.

https://bugzilla.gnome.org/show_bug.cgi?id=698018
2013-06-12 11:24:55 +01:00
Emmanuele Bassi
a360b314aa binding: Add an explicit unbind()
Higher order languages with garbage collection can have issues releasing
a binding, as they do not control the last reference being dropped on
the binding, source, or target instances.

https://bugzilla.gnome.org/show_bug.cgi?id=698018
2013-05-02 15:50:21 -07:00
Matthias Clasen
1426a8ca07 Fix binding properties of the same object
This problem was pointed out in bug 639873.
The patch here is based on Matt Barnes patch,
I've added a testcase as well.
2012-03-04 20:49:04 -05:00
Javier Jardón
108480b7ba gobject: Use G_VALUE_INIT 2011-10-18 17:12:33 +01:00
Emmanuele Bassi
8e716cbb49 Fix annotations for source/target in g_object_bind_property_*
We use gpointer for convience of the C API users, but introspection
users will not like it.

https://bugzilla.gnome.org/show_bug.cgi?id=659838
2011-09-22 17:17:54 +01:00
Ryan Lortie
8073759f8c Remove all uses of G_CONST_RETURN
Just use 'const'.

https://bugzilla.gnome.org/show_bug.cgi?id=644611
2011-06-09 11:15:40 -04:00
Ryan Lortie
8f21e8145c gobject: remove -DG_DISABLE_CONST_RETURNS
GObject had a few cases of depending on G_CONST_RETURN not being defined
to 'const'.  Remove those in preparation for deprecation of
G_CONST_RETURN.
2011-06-09 11:11:30 -04:00
Colomban Wendling
6418769e4c Fix a typo in GBinding
https://bugzilla.gnome.org/show_bug.cgi?id=652081
2011-06-08 16:56:40 -04:00
Emmanuele Bassi
08f0a31289 Revert "Remove all uses of G_CONST_RETURN"
This reverts commit 36741245cc.

The removal has not been discussed, except on Bugzilla:

https://bugzilla.gnome.org/show_bug.cgi?id=644611
2011-03-15 09:03:28 +00:00
Ryan Lortie
36741245cc Remove all uses of G_CONST_RETURN
Just use 'const'.
2011-03-15 01:32:22 -04:00
Emmanuele Bassi
4bc9654c63 binding: Add a default marshaller for the closure API
The g_object_bind_property_with_closures() function should set a
marshaller if the two GClosures don't have one already. This simplifies
the caller code and avoids duplication.

We need to add a new marshaller to the gmarshal.list matching the
signature of the GBindingTransformFunc function.
2010-08-04 01:09:28 +01:00
Emmanuele Bassi
5e1c4b18a8 docs: Clarify user_data behavior for bind_property_full() 2010-08-03 10:34:59 +01:00
Emmanuele Bassi
90f7f171e6 binding: Add G_BINDING_INVERT_BOOLEAN
Since GSettings got the same functionality and flag in commit ca3b7b75b
GBinding should also have the ability to automatically invert a boolean
value without requiring a custom transformation function.
2010-08-03 10:29:50 +01:00
Emmanuele Bassi
3be3ad61d1 binding: Add a closure-based variant of bind_property_full()
Since using the function pointer version muddles the memory management
requirements of language bindings, we should implement a GClosure-based
variant on top of g_object_bind_property_full().

https://bugzilla.gnome.org/show_bug.cgi?id=622278
2010-08-03 09:51:49 +01:00
Ryan Lortie
0fc50fa5f7 gobject/: fully remove gobjectalias hacks 2010-07-07 19:40:48 -04:00
Matthias Clasen
4e97c96654 Remove a redundant branch
Since the name has been interned already at pspec creation time,
we can just call g_intern_string().
2010-07-05 23:13:18 -04:00
Emmanuele Bassi
f587cb57f2 binding: Add SYNC_CREATE to the flags
When creating a binding between two object properties we might want to
automatically synchronize the two values at the moment of the binding
creation, instead of waiting for the next change.

The G_BINDING_SYNC_CREATE flag does exactly what it says on the tin.

https://bugzilla.gnome.org/show_bug.cgi?id=622281
2010-06-23 15:19:24 +01:00
Emmanuele Bassi
33aa4b4c66 binding: Use a hash table
Since an object instance might have a lot of bindings, using a list
might become a performance issue when removing them. Using a simple
hash table guarantees constant time lookup, which is the most common
operation.
2010-06-16 15:08:10 +01:00
Emmanuele Bassi
6d1d9cf1b5 gobject: Add GBinding
GBinding is a simple, opaque object that represents a binding between a
property on a GObject instance (source) and property on another GObject
instance (target).

https://bugzilla.gnome.org/show_bug.cgi?id=348080
2010-06-15 16:06:18 +01:00