Some more work-in-progress
diff --git a/gobject/gmultibinding.c b/gobject/gmultibinding.c
index 9399f1b..52d9890 100644
--- a/gobject/gmultibinding.c
+++ b/gobject/gmultibinding.c
@@ -154,17 +154,24 @@
GValue *to_values;
gboolean res;
gint i;
+ gint notified;
if (binding->is_frozen)
return;
+ notified = -1;
from_values = g_new0 (GValue, binding->n_sources);
for (i = 0; i < binding->n_sources; i++)
{
g_value_init (&from_values[i], G_PARAM_SPEC_VALUE_TYPE (binding->source_pspec[i]));
g_object_get_property (binding->source[i], binding->source_pspec[i]->name, &from_values[i]);
+
+ if (gobject == binding->source[i])
+ notified = i;
}
+ g_assert (0 <= notified && notified < binding->n_sources);
+
to_values = g_new0 (GValue, binding->n_targets);
for (i = 0; i < binding->n_targets; i++)
{
@@ -172,7 +179,7 @@
g_object_get_property (binding->target[i], binding->target_pspec[i]->name, &to_values[i]);
}
- res = binding->transform (binding, (const GValue *)from_values, to_values, binding->transform_data);
+ res = binding->transform (binding, notified, (const GValue *)from_values, to_values, binding->transform_data);
if (res)
{
@@ -339,6 +346,7 @@
gint n_targets,
GObject *targets[],
const gchar *target_properties[],
+ GMultiBindingFlags flags,
GMultiBindingTransformFunc transform,
gpointer user_data,
GDestroyNotify notify)
@@ -443,5 +451,8 @@
}
}
+ if (flags & G_MULTI_BINDING_SYNC_CREATE)
+ on_source_notify (binding->source[0], binding->source_pspec[0], binding);
+
return binding;
}
diff --git a/gobject/gmultibinding.h b/gobject/gmultibinding.h
index 36c1430..948b9ef 100644
--- a/gobject/gmultibinding.h
+++ b/gobject/gmultibinding.h
@@ -34,6 +34,11 @@
#define G_MULTI_BINDING(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_MULTI_BINDING, GMultiBinding))
#define G_IS_MULTI_BINDING(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_MULTI_BINDING))
+typedef enum { /*< prefix=G_MULTI_BINDING >*/
+ G_MULTI_BINDING_DEFAULT = 0,
+ G_MULTI_BINDING_SYNC_CREATE = 1 << 1
+} GMultiBindingFlags;
+
/**
* GMultiBinding:
*
@@ -45,6 +50,7 @@
typedef struct _GMultiBinding GMultiBinding;
typedef gboolean (* GMultiBindingTransformFunc) (GMultiBinding *binding,
+ gint notified,
const GValue from_values[],
GValue to_values[],
gpointer user_data);
@@ -74,15 +80,26 @@
void g_multi_binding_unbind (GMultiBinding *binding);
GLIB_AVAILABLE_IN_ALL
-GMultiBinding *g_object_multi_bind_property_v (gint n_sources,
+GMultiBinding *g_object_bind_properties_v (gint n_sources,
GObject *sources[],
const gchar *source_properties[],
gint n_targets,
GObject *targets[],
const gchar *target_properties[],
+ GMultiBindingFlags flags,
GMultiBindingTransformFunc transform,
gpointer user_data,
GDestroyNotify notify);
-
+GLIB_AVAILABLE_IN_ALL
+GMultiBinding *g_object_bind_properties (GObject *source,
+ const gchar *property,
+ ...
+ GObject *target,
+ const gchar *property,
+ ...
+ GMultiBindingFlags flags,
+ GMultiBindingTransformFunc transform,
+ gpointer user_data,
+ GDestroyNotify notify);
#endif /* __G_MULTI_BINDING_H__ */
diff --git a/gobject/tests/multibinding.c b/gobject/tests/multibinding.c
index afff184..3305e76 100644
--- a/gobject/tests/multibinding.c
+++ b/gobject/tests/multibinding.c
@@ -237,6 +237,7 @@
static gboolean
munge_two_ints (GMultiBinding *binding,
+ gint notified,
const GValue from_values[],
GValue to_values[],
gpointer user_data)
@@ -273,6 +274,7 @@
target_props[1] = "bar";
binding = g_object_multi_bind_property_v (2, sources, source_props,
2, targets, target_props,
+ G_MULTI_BINDING_DEFAULT,
munge_two_ints,
NULL, NULL);
g_object_add_weak_pointer (G_OBJECT (binding), (gpointer *) &binding);