[gnome-builder] egg-binding-set: Prevent invalid source
- From: Garrett Regier <gregier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] egg-binding-set: Prevent invalid source
- Date: Sun, 3 May 2015 20:38:22 +0000 (UTC)
commit 8610548e083025f626629250dd15d5b379c98016
Author: Garrett Regier <garrettregier gmail com>
Date: Sun May 3 13:38:11 2015 -0700
egg-binding-set: Prevent invalid source
When setting the source we need to check that
it has every one of the properties registered.
Otherwise we will start spewing warnings all over.
contrib/egg/egg-binding-set.c | 22 +++++++++++++++++++++-
1 files changed, 21 insertions(+), 1 deletions(-)
---
diff --git a/contrib/egg/egg-binding-set.c b/contrib/egg/egg-binding-set.c
index 054831c..8c280eb 100644
--- a/contrib/egg/egg-binding-set.c
+++ b/contrib/egg/egg-binding-set.c
@@ -273,6 +273,26 @@ egg_binding_set_get_source (EggBindingSet *self)
return self->source;
}
+static gboolean
+egg_binding_set_check_source (EggBindingSet *self,
+ gpointer source)
+{
+ gsize i;
+
+ for (i = 0; i < self->lazy_bindings->len; i++)
+ {
+ LazyBinding *lazy_binding;
+
+ lazy_binding = g_ptr_array_index (self->lazy_bindings, i);
+
+ g_return_val_if_fail (g_object_class_find_property (G_OBJECT_GET_CLASS (source),
+ lazy_binding->source_property) != NULL,
+ FALSE);
+ }
+
+ return TRUE;
+}
+
void
egg_binding_set_set_source (EggBindingSet *self,
gpointer source)
@@ -302,7 +322,7 @@ egg_binding_set_set_source (EggBindingSet *self,
}
}
- if (source != NULL)
+ if (source != NULL && egg_binding_set_check_source (self, source))
{
gsize i;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]