summaryrefslogtreecommitdiff
path: root/gobject/gbinding.c
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@linux.intel.com>2010-06-21 12:26:42 +0100
committerEmmanuele Bassi <ebassi@linux.intel.com>2010-06-23 15:19:24 +0100
commitf587cb57f249a8f4b869231ca20f5f19602a20ec (patch)
treee5aa9ea71cfdae03043e8dfb2ecd4af39d49572b /gobject/gbinding.c
parentd3af9c0ec59465e4076791881bc89fe51539f3fd (diff)
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
Diffstat (limited to 'gobject/gbinding.c')
-rw-r--r--gobject/gbinding.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gobject/gbinding.c b/gobject/gbinding.c
index 628ede942..8bb91a83b 100644
--- a/gobject/gbinding.c
+++ b/gobject/gbinding.c
@@ -124,6 +124,7 @@ g_binding_flags_get_type (void)
static const GFlagsValue values[] = {
{ G_BINDING_DEFAULT, "G_BINDING_DEFAULT", "default" },
{ G_BINDING_BIDIRECTIONAL, "G_BINDING_BIDIRECTIONAL", "bidirectional" },
+ { G_BINDING_SYNC_CREATE, "G_BINDING_SYNC_CREATE", "sync-create" },
{ 0, NULL, NULL }
};
GType g_define_type_id =
@@ -893,6 +894,14 @@ g_object_bind_property_full (gpointer source,
binding->transform_data = user_data;
binding->notify = notify;
+ /* synchronize the target with the source by faking an emission of
+ * the ::notify signal for the source property; this will also take
+ * care of the bidirectional binding case because the eventual change
+ * will emit a notification on the target
+ */
+ if (flags & G_BINDING_SYNC_CREATE)
+ on_source_notify (binding->source, binding->source_pspec, binding);
+
return binding;
}