[gnome-builder] binding-set: Rename to EggBindingGroup
- From: Garrett Regier <gregier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] binding-set: Rename to EggBindingGroup
- Date: Tue, 2 Jun 2015 23:22:29 +0000 (UTC)
commit a2fcc232e86891c2377c880dff50af1a9b1447d8
Author: Garrett Regier <garrett regier riftio com>
Date: Tue Jun 2 06:16:35 2015 -0700
binding-set: Rename to EggBindingGroup
This follows the same naming as EggSignalGroup
and avoids odd function names like
egg_binding_set_set_source().
contrib/egg/Makefile.am | 4 +-
.../egg/{egg-binding-set.c => egg-binding-group.c} | 290 ++++++++++----------
contrib/egg/egg-binding-group.h | 63 +++++
contrib/egg/egg-binding-set.h | 62 -----
contrib/egg/egg-state-machine.c | 14 +-
libide/ide-source-view.c | 30 +-
src/greeter/gb-greeter-project-row.c | 42 ++--
tests/Makefile.am | 8 +-
...-egg-binding-set.c => test-egg-binding-group.c} | 198 +++++++-------
9 files changed, 356 insertions(+), 355 deletions(-)
---
diff --git a/contrib/egg/Makefile.am b/contrib/egg/Makefile.am
index 3f327be..0423186 100644
--- a/contrib/egg/Makefile.am
+++ b/contrib/egg/Makefile.am
@@ -1,8 +1,8 @@
noinst_LTLIBRARIES = libegg.la
libegg_la_SOURCES = \
- egg-binding-set.c \
- egg-binding-set.h \
+ egg-binding-group.c \
+ egg-binding-group.h \
egg-counter.c \
egg-counter.h \
egg-heap.c \
diff --git a/contrib/egg/egg-binding-set.c b/contrib/egg/egg-binding-group.c
similarity index 64%
rename from contrib/egg/egg-binding-set.c
rename to contrib/egg/egg-binding-group.c
index d28a5b6..145c1b9 100644
--- a/contrib/egg/egg-binding-set.c
+++ b/contrib/egg/egg-binding-group.c
@@ -1,4 +1,4 @@
-/* egg-binding-set.c
+/* egg-binding-group.c
*
* Copyright (C) 2015 Christian Hergert <christian hergert me>
* Copyright (C) 2015 Garrett Regier <garrettregier gmail com>
@@ -17,19 +17,19 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#define G_LOG_DOMAIN "egg-binding-set"
+#define G_LOG_DOMAIN "egg-binding-group"
#include <glib/gi18n.h>
-#include "egg-binding-set.h"
+#include "egg-binding-group.h"
/**
- * SECTION:egg-binding-set
- * @title: EggBindingSet
+ * SECTION:egg-binding-group
+ * @title: EggBindingGroup
* @short_description: Manage a collection of #GBindings on
- * a #GObject as a set.
+ * a #GObject as a group.
*
- * #EggBindingSet manages to simplify the process of binding
+ * #EggBindingGroup manages to simplify the process of binding
* many properties from a #GObject as a group. As such there is no API
* to unbind a property from the group.
*
@@ -37,10 +37,10 @@
* bindings. This automatically causes the unbinding of the properties
* from the old instance and binding to the new instance.
*
- * This should not be confused with #GtkBindingSet.
+ * This should not be confused with #GtkBindingGroup.
*/
-struct _EggBindingSet
+struct _EggBindingGroup
{
GObject parent_instance;
@@ -50,20 +50,20 @@ struct _EggBindingSet
typedef struct
{
- EggBindingSet *set;
- const gchar *source_property;
- const gchar *target_property;
- GObject *target;
- GBinding *binding;
- gpointer user_data;
- GDestroyNotify user_data_destroy;
- gpointer transform_to;
- gpointer transform_from;
- GBindingFlags binding_flags;
- guint using_closures : 1;
+ EggBindingGroup *group;
+ const gchar *source_property;
+ const gchar *target_property;
+ GObject *target;
+ GBinding *binding;
+ gpointer user_data;
+ GDestroyNotify user_data_destroy;
+ gpointer transform_to;
+ gpointer transform_from;
+ GBindingFlags binding_flags;
+ guint using_closures : 1;
} LazyBinding;
-G_DEFINE_TYPE (EggBindingSet, egg_binding_set, G_TYPE_OBJECT)
+G_DEFINE_TYPE (EggBindingGroup, egg_binding_group, G_TYPE_OBJECT)
enum {
PROP_0,
@@ -103,12 +103,12 @@ _g_flags_to_string (GFlagsClass *flags_class,
#endif
static void
-egg_binding_set_connect (EggBindingSet *self,
- LazyBinding *lazy_binding)
+egg_binding_group_connect (EggBindingGroup *self,
+ LazyBinding *lazy_binding)
{
GBinding *binding;
- g_assert (EGG_IS_BINDING_SET (self));
+ g_assert (EGG_IS_BINDING_GROUP (self));
g_assert (self->source != NULL);
g_assert (lazy_binding != NULL);
g_assert (lazy_binding->binding == NULL);
@@ -165,7 +165,7 @@ egg_binding_set_connect (EggBindingSet *self,
}
static void
-egg_binding_set_disconnect (LazyBinding *lazy_binding)
+egg_binding_group_disconnect (LazyBinding *lazy_binding)
{
g_assert (lazy_binding != NULL);
@@ -177,13 +177,13 @@ egg_binding_set_disconnect (LazyBinding *lazy_binding)
}
static void
-egg_binding_set__source_weak_notify (gpointer data,
- GObject *where_object_was)
+egg_binding_group__source_weak_notify (gpointer data,
+ GObject *where_object_was)
{
- EggBindingSet *self = data;
+ EggBindingGroup *self = data;
gsize i;
- g_assert (EGG_IS_BINDING_SET (self));
+ g_assert (EGG_IS_BINDING_GROUP (self));
self->source = NULL;
@@ -197,13 +197,13 @@ egg_binding_set__source_weak_notify (gpointer data,
}
static void
-egg_binding_set__target_weak_notify (gpointer data,
- GObject *where_object_was)
+egg_binding_group__target_weak_notify (gpointer data,
+ GObject *where_object_was)
{
- EggBindingSet *self = data;
+ EggBindingGroup *self = data;
gsize i;
- g_assert (EGG_IS_BINDING_SET (self));
+ g_assert (EGG_IS_BINDING_GROUP (self));
for (i = 0; i < self->lazy_bindings->len; i++)
{
@@ -230,14 +230,14 @@ lazy_binding_free (gpointer data)
if (lazy_binding->target != NULL)
{
g_object_weak_unref (lazy_binding->target,
- egg_binding_set__target_weak_notify,
- lazy_binding->set);
+ egg_binding_group__target_weak_notify,
+ lazy_binding->group);
lazy_binding->target = NULL;
}
- egg_binding_set_disconnect (lazy_binding);
+ egg_binding_group_disconnect (lazy_binding);
- lazy_binding->set = NULL;
+ lazy_binding->group = NULL;
lazy_binding->source_property = NULL;
lazy_binding->target_property = NULL;
@@ -254,16 +254,16 @@ lazy_binding_free (gpointer data)
}
static void
-egg_binding_set_dispose (GObject *object)
+egg_binding_group_dispose (GObject *object)
{
- EggBindingSet *self = (EggBindingSet *)object;
+ EggBindingGroup *self = (EggBindingGroup *)object;
- g_assert (EGG_IS_BINDING_SET (self));
+ g_assert (EGG_IS_BINDING_GROUP (self));
if (self->source != NULL)
{
g_object_weak_unref (self->source,
- egg_binding_set__source_weak_notify,
+ egg_binding_group__source_weak_notify,
self);
self->source = NULL;
}
@@ -271,34 +271,34 @@ egg_binding_set_dispose (GObject *object)
if (self->lazy_bindings->len != 0)
g_ptr_array_remove_range (self->lazy_bindings, 0, self->lazy_bindings->len);
- G_OBJECT_CLASS (egg_binding_set_parent_class)->dispose (object);
+ G_OBJECT_CLASS (egg_binding_group_parent_class)->dispose (object);
}
static void
-egg_binding_set_finalize (GObject *object)
+egg_binding_group_finalize (GObject *object)
{
- EggBindingSet *self = (EggBindingSet *)object;
+ EggBindingGroup *self = (EggBindingGroup *)object;
g_assert (self->lazy_bindings != NULL);
g_assert (self->lazy_bindings->len == 0);
g_clear_pointer (&self->lazy_bindings, g_ptr_array_unref);
- G_OBJECT_CLASS (egg_binding_set_parent_class)->finalize (object);
+ G_OBJECT_CLASS (egg_binding_group_parent_class)->finalize (object);
}
static void
-egg_binding_set_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
+egg_binding_group_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- EggBindingSet *self = EGG_BINDING_SET (object);
+ EggBindingGroup *self = EGG_BINDING_GROUP (object);
switch (prop_id)
{
case PROP_SOURCE:
- g_value_set_object (value, egg_binding_set_get_source (self));
+ g_value_set_object (value, egg_binding_group_get_source (self));
break;
default:
@@ -307,17 +307,17 @@ egg_binding_set_get_property (GObject *object,
}
static void
-egg_binding_set_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
+egg_binding_group_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- EggBindingSet *self = EGG_BINDING_SET (object);
+ EggBindingGroup *self = EGG_BINDING_GROUP (object);
switch (prop_id)
{
case PROP_SOURCE:
- egg_binding_set_set_source (self, g_value_get_object (value));
+ egg_binding_group_set_source (self, g_value_get_object (value));
break;
default:
@@ -326,17 +326,17 @@ egg_binding_set_set_property (GObject *object,
}
static void
-egg_binding_set_class_init (EggBindingSetClass *klass)
+egg_binding_group_class_init (EggBindingGroupClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->dispose = egg_binding_set_dispose;
- object_class->finalize = egg_binding_set_finalize;
- object_class->get_property = egg_binding_set_get_property;
- object_class->set_property = egg_binding_set_set_property;
+ object_class->dispose = egg_binding_group_dispose;
+ object_class->finalize = egg_binding_group_finalize;
+ object_class->get_property = egg_binding_group_get_property;
+ object_class->set_property = egg_binding_group_set_property;
/**
- * EggBindingSet:source
+ * EggBindingGroup:source
*
* The source object used for binding properties.
*/
@@ -351,43 +351,43 @@ egg_binding_set_class_init (EggBindingSetClass *klass)
}
static void
-egg_binding_set_init (EggBindingSet *self)
+egg_binding_group_init (EggBindingGroup *self)
{
self->lazy_bindings = g_ptr_array_new_with_free_func (lazy_binding_free);
}
/**
- * egg_binding_set_new:
+ * egg_binding_group_new:
*
- * Creates a new #EggBindingSet.
+ * Creates a new #EggBindingGroup.
*
- * Returns: a new #EggBindingSet
+ * Returns: a new #EggBindingGroup
*/
-EggBindingSet *
-egg_binding_set_new (void)
+EggBindingGroup *
+egg_binding_group_new (void)
{
- return g_object_new (EGG_TYPE_BINDING_SET, NULL);
+ return g_object_new (EGG_TYPE_BINDING_GROUP, NULL);
}
/**
- * egg_binding_set_get_source:
- * @self: the #EggBindingSet
+ * egg_binding_group_get_source:
+ * @self: the #EggBindingGroup
*
* Gets the source object used for binding properties.
*
* Returns: (nullable): the source object.
*/
GObject *
-egg_binding_set_get_source (EggBindingSet *self)
+egg_binding_group_get_source (EggBindingGroup *self)
{
- g_return_val_if_fail (EGG_IS_BINDING_SET (self), NULL);
+ g_return_val_if_fail (EGG_IS_BINDING_GROUP (self), NULL);
return self->source;
}
static gboolean
-egg_binding_set_check_source (EggBindingSet *self,
- gpointer source)
+egg_binding_group_check_source (EggBindingGroup *self,
+ gpointer source)
{
gsize i;
@@ -406,8 +406,8 @@ egg_binding_set_check_source (EggBindingSet *self,
}
/**
- * egg_binding_set_set_source:
- * @self: the #EggBindingSet
+ * egg_binding_group_set_source:
+ * @self: the #EggBindingGroup
* @source: (type GObject) (nullable): the source #GObject
*
* Sets @source as the source object used for creating property
@@ -417,10 +417,10 @@ egg_binding_set_check_source (EggBindingSet *self,
* Note: All properties that have been bound must exist on @source.
*/
void
-egg_binding_set_set_source (EggBindingSet *self,
- gpointer source)
+egg_binding_group_set_source (EggBindingGroup *self,
+ gpointer source)
{
- g_return_if_fail (EGG_IS_BINDING_SET (self));
+ g_return_if_fail (EGG_IS_BINDING_GROUP (self));
g_return_if_fail (!source || G_IS_OBJECT (source));
g_return_if_fail (source != (gpointer)self);
@@ -432,7 +432,7 @@ egg_binding_set_set_source (EggBindingSet *self,
gsize i;
g_object_weak_unref (self->source,
- egg_binding_set__source_weak_notify,
+ egg_binding_group__source_weak_notify,
self);
self->source = NULL;
@@ -441,17 +441,17 @@ egg_binding_set_set_source (EggBindingSet *self,
LazyBinding *lazy_binding;
lazy_binding = g_ptr_array_index (self->lazy_bindings, i);
- egg_binding_set_disconnect (lazy_binding);
+ egg_binding_group_disconnect (lazy_binding);
}
}
- if (source != NULL && egg_binding_set_check_source (self, source))
+ if (source != NULL && egg_binding_group_check_source (self, source))
{
gsize i;
self->source = source;
g_object_weak_ref (self->source,
- egg_binding_set__source_weak_notify,
+ egg_binding_group__source_weak_notify,
self);
for (i = 0; i < self->lazy_bindings->len; i++)
@@ -459,7 +459,7 @@ egg_binding_set_set_source (EggBindingSet *self,
LazyBinding *lazy_binding;
lazy_binding = g_ptr_array_index (self->lazy_bindings, i);
- egg_binding_set_connect (self, lazy_binding);
+ egg_binding_group_connect (self, lazy_binding);
}
}
@@ -467,20 +467,20 @@ egg_binding_set_set_source (EggBindingSet *self,
}
void
-egg_binding_set_bind_helper (EggBindingSet *self,
- const gchar *source_property,
- gpointer target,
- const gchar *target_property,
- GBindingFlags flags,
- gpointer transform_to,
- gpointer transform_from,
- gpointer user_data,
- GDestroyNotify user_data_destroy,
- gboolean using_closures)
+egg_binding_group_bind_helper (EggBindingGroup *self,
+ const gchar *source_property,
+ gpointer target,
+ const gchar *target_property,
+ GBindingFlags flags,
+ gpointer transform_to,
+ gpointer transform_from,
+ gpointer user_data,
+ GDestroyNotify user_data_destroy,
+ gboolean using_closures)
{
LazyBinding *lazy_binding;
- g_return_if_fail (EGG_IS_BINDING_SET (self));
+ g_return_if_fail (EGG_IS_BINDING_GROUP (self));
g_return_if_fail (source_property != NULL);
g_return_if_fail (self->source == NULL ||
g_object_class_find_property (G_OBJECT_GET_CLASS (self->source),
@@ -493,7 +493,7 @@ egg_binding_set_bind_helper (EggBindingSet *self,
strcmp (source_property, target_property) != 0);
lazy_binding = g_slice_new0 (LazyBinding);
- lazy_binding->set = self;
+ lazy_binding->group = self;
lazy_binding->source_property = g_intern_string (source_property);
lazy_binding->target_property = g_intern_string (target_property);
lazy_binding->target = target;
@@ -515,18 +515,18 @@ egg_binding_set_bind_helper (EggBindingSet *self,
}
g_object_weak_ref (target,
- egg_binding_set__target_weak_notify,
+ egg_binding_group__target_weak_notify,
self);
g_ptr_array_add (self->lazy_bindings, lazy_binding);
if (self->source != NULL)
- egg_binding_set_connect (self, lazy_binding);
+ egg_binding_group_connect (self, lazy_binding);
}
/**
- * egg_binding_set_bind:
- * @self: the #EggBindingSet
+ * egg_binding_group_bind:
+ * @self: the #EggBindingGroup
* @source_property: the property on the source to bind
* @target: (type GObject): the target #GObject
* @target_property: the property on @target to bind
@@ -540,22 +540,22 @@ egg_binding_set_bind_helper (EggBindingSet *self,
* See: g_object_bind_property().
*/
void
-egg_binding_set_bind (EggBindingSet *self,
- const gchar *source_property,
- gpointer target,
- const gchar *target_property,
- GBindingFlags flags)
+egg_binding_group_bind (EggBindingGroup *self,
+ const gchar *source_property,
+ gpointer target,
+ const gchar *target_property,
+ GBindingFlags flags)
{
- egg_binding_set_bind_full (self, source_property,
- target, target_property,
- flags,
- NULL, NULL,
- NULL, NULL);
+ egg_binding_group_bind_full (self, source_property,
+ target, target_property,
+ flags,
+ NULL, NULL,
+ NULL, NULL);
}
/**
- * egg_binding_set_bind_full:
- * @self: the #EggBindingSet
+ * egg_binding_group_bind_full:
+ * @self: the #EggBindingGroup
* @source_property: the property on the source to bind
* @target: (type GObject): the target #GObject
* @target_property: the property on @target to bind
@@ -577,27 +577,27 @@ egg_binding_set_bind (EggBindingSet *self,
* See: g_object_bind_property_full().
*/
void
-egg_binding_set_bind_full (EggBindingSet *self,
- const gchar *source_property,
- gpointer target,
- const gchar *target_property,
- GBindingFlags flags,
- GBindingTransformFunc transform_to,
- GBindingTransformFunc transform_from,
- gpointer user_data,
- GDestroyNotify user_data_destroy)
+egg_binding_group_bind_full (EggBindingGroup *self,
+ const gchar *source_property,
+ gpointer target,
+ const gchar *target_property,
+ GBindingFlags flags,
+ GBindingTransformFunc transform_to,
+ GBindingTransformFunc transform_from,
+ gpointer user_data,
+ GDestroyNotify user_data_destroy)
{
- egg_binding_set_bind_helper (self, source_property,
- target, target_property,
- flags,
- transform_to, transform_from,
- user_data, user_data_destroy,
- FALSE);
+ egg_binding_group_bind_helper (self, source_property,
+ target, target_property,
+ flags,
+ transform_to, transform_from,
+ user_data, user_data_destroy,
+ FALSE);
}
/**
- * egg_binding_set_bind_with_closures: (rename-to egg_binding_set_bind_full)
- * @self: the #EggBindingSet
+ * egg_binding_group_bind_with_closures: (rename-to egg_binding_group_bind_full)
+ * @self: the #EggBindingGroup
* @source_property: the property on the source to bind
* @target: (type GObject): the target #GObject
* @target_property: the property on @target to bind
@@ -615,24 +615,24 @@ egg_binding_set_bind_full (EggBindingSet *self,
* #G_BINDING_SYNC_CREATE is automatically specified.
*
* This function is the language bindings friendly version of
- * egg_binding_set_bind_property_full(), using #GClosures
+ * egg_binding_group_bind_property_full(), using #GClosures
* instead of function pointers.
*
* See: g_object_bind_property_with_closures().
*/
void
-egg_binding_set_bind_with_closures (EggBindingSet *self,
- const gchar *source_property,
- gpointer target,
- const gchar *target_property,
- GBindingFlags flags,
- GClosure *transform_to,
- GClosure *transform_from)
+egg_binding_group_bind_with_closures (EggBindingGroup *self,
+ const gchar *source_property,
+ gpointer target,
+ const gchar *target_property,
+ GBindingFlags flags,
+ GClosure *transform_to,
+ GClosure *transform_from)
{
- egg_binding_set_bind_helper (self, source_property,
- target, target_property,
- flags,
- transform_to, transform_from,
- NULL, NULL,
- TRUE);
+ egg_binding_group_bind_helper (self, source_property,
+ target, target_property,
+ flags,
+ transform_to, transform_from,
+ NULL, NULL,
+ TRUE);
}
diff --git a/contrib/egg/egg-binding-group.h b/contrib/egg/egg-binding-group.h
new file mode 100644
index 0000000..58dd30e
--- /dev/null
+++ b/contrib/egg/egg-binding-group.h
@@ -0,0 +1,63 @@
+/* egg-binding-group.h
+ *
+ * Copyright (C) 2015 Christian Hergert <christian hergert me>
+ * Copyright (C) 2015 Garrett Regier <garrettregier gmail com>
+ *
+ * This file is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef EGG_BINDING_GROUP_H
+#define EGG_BINDING_GROUP_H
+
+#include <gio/gio.h>
+
+G_BEGIN_DECLS
+
+#define EGG_TYPE_BINDING_GROUP (egg_binding_group_get_type())
+
+G_DECLARE_FINAL_TYPE (EggBindingGroup, egg_binding_group, EGG, BINDING_GROUP, GObject)
+
+EggBindingGroup *
+ egg_binding_group_new (void);
+
+GObject *egg_binding_group_get_source (EggBindingGroup *self);
+void egg_binding_group_set_source (EggBindingGroup *self,
+ gpointer source);
+
+void egg_binding_group_bind (EggBindingGroup *self,
+ const gchar *source_property,
+ gpointer target,
+ const gchar *target_property,
+ GBindingFlags flags);
+void egg_binding_group_bind_full (EggBindingGroup *self,
+ const gchar *source_property,
+ gpointer target,
+ const gchar *target_property,
+ GBindingFlags flags,
+ GBindingTransformFunc transform_to,
+ GBindingTransformFunc transform_from,
+ gpointer user_data,
+ GDestroyNotify notify);
+void egg_binding_group_bind_with_closures
+ (EggBindingGroup *self,
+ const gchar *source_property,
+ gpointer target,
+ const gchar *target_property,
+ GBindingFlags flags,
+ GClosure *transform_to,
+ GClosure *transform_from);
+
+G_END_DECLS
+
+#endif /* EGG_BINDING_GROUP_H */
diff --git a/contrib/egg/egg-state-machine.c b/contrib/egg/egg-state-machine.c
index b4f795e..1e8180d 100644
--- a/contrib/egg/egg-state-machine.c
+++ b/contrib/egg/egg-state-machine.c
@@ -21,7 +21,7 @@
#include <glib/gi18n.h>
#include <gobject/gvaluecollector.h>
-#include "egg-binding-set.h"
+#include "egg-binding-group.h"
#include "egg-signal-group.h"
#include "egg-state-machine.h"
@@ -138,7 +138,7 @@ egg_state_machine__binding_source_weak_notify (gpointer data,
g_hash_table_iter_init (&iter, priv->states);
while (g_hash_table_iter_next (&iter, NULL, (gpointer)&state))
{
- EggBindingSet *bindings;
+ EggBindingGroup *bindings;
bindings = g_hash_table_lookup (state->bindings, where_object_was);
@@ -243,7 +243,7 @@ egg_state_apply (EggStateMachine *self,
g_hash_table_iter_init (&iter, state->bindings);
while (g_hash_table_iter_next (&iter, &key, &value))
- egg_binding_set_set_source (value, key);
+ egg_binding_group_set_source (value, key);
g_hash_table_iter_init (&iter, state->signals);
while (g_hash_table_iter_next (&iter, &key, &value))
@@ -282,7 +282,7 @@ egg_state_unapply (EggStateMachine *self,
g_hash_table_iter_init (&iter, state->bindings);
while (g_hash_table_iter_next (&iter, &key, &value))
- egg_binding_set_set_source (value, NULL);
+ egg_binding_group_set_source (value, NULL);
g_hash_table_iter_init (&iter, state->signals);
while (g_hash_table_iter_next (&iter, &key, &value))
@@ -627,7 +627,7 @@ egg_state_machine_add_binding (EggStateMachine *self,
const gchar *target_property,
GBindingFlags flags)
{
- EggBindingSet *bindings;
+ EggBindingGroup *bindings;
EggState *state_obj;
g_return_if_fail (EGG_IS_STATE_MACHINE (self));
@@ -643,7 +643,7 @@ egg_state_machine_add_binding (EggStateMachine *self,
if (bindings == NULL)
{
- bindings = egg_binding_set_new ();
+ bindings = egg_binding_group_new ();
g_hash_table_insert (state_obj->bindings, source_object, bindings);
g_object_weak_ref (source_object,
@@ -651,7 +651,7 @@ egg_state_machine_add_binding (EggStateMachine *self,
self);
}
- egg_binding_set_bind (bindings, source_property, target_object, target_property, flags);
+ egg_binding_group_bind (bindings, source_property, target_object, target_property, flags);
}
void
diff --git a/libide/ide-source-view.c b/libide/ide-source-view.c
index 9dd7aae..82cbd8c 100644
--- a/libide/ide-source-view.c
+++ b/libide/ide-source-view.c
@@ -20,7 +20,7 @@
#include <glib/gi18n.h>
#include <stdlib.h>
-#include "egg-binding-set.h"
+#include "egg-binding-group.h"
#include "egg-signal-group.h"
#include "ide-animation.h"
@@ -104,7 +104,7 @@ typedef struct
IdeAnimation *hadj_animation;
IdeAnimation *vadj_animation;
- EggBindingSet *file_setting_bindings;
+ EggBindingGroup *file_setting_bindings;
EggSignalGroup *buffer_signals;
guint change_sequence;
@@ -859,7 +859,7 @@ ide_source_view_connect_settings (IdeSourceView *self,
g_assert (IDE_IS_SOURCE_VIEW (self));
g_assert (IDE_IS_FILE_SETTINGS (file_settings));
- egg_binding_set_set_source (priv->file_setting_bindings, file_settings);
+ egg_binding_group_set_source (priv->file_setting_bindings, file_settings);
}
static void
@@ -871,7 +871,7 @@ ide_source_view_disconnect_settings (IdeSourceView *self,
g_assert (IDE_IS_SOURCE_VIEW (self));
g_assert (IDE_IS_FILE_SETTINGS (file_settings));
- egg_binding_set_set_source (priv->file_setting_bindings, NULL);
+ egg_binding_group_set_source (priv->file_setting_bindings, NULL);
}
static void
@@ -5800,17 +5800,17 @@ ide_source_view_init (IdeSourceView *self)
priv->selections = g_queue_new ();
priv->show_line_diagnostics = TRUE;
- priv->file_setting_bindings = egg_binding_set_new ();
- egg_binding_set_bind (priv->file_setting_bindings, "indent-width",
- self, "indent-width", G_BINDING_SYNC_CREATE);
- egg_binding_set_bind (priv->file_setting_bindings, "tab-width",
- self, "tab-width", G_BINDING_SYNC_CREATE);
- egg_binding_set_bind (priv->file_setting_bindings, "right-margin-position",
- self, "right-margin-position", G_BINDING_SYNC_CREATE);
- egg_binding_set_bind (priv->file_setting_bindings, "indent-style",
- self, "indent-style", G_BINDING_SYNC_CREATE);
- egg_binding_set_bind (priv->file_setting_bindings, "show-right-margin",
- self, "show-right-margin", G_BINDING_SYNC_CREATE);
+ priv->file_setting_bindings = egg_binding_group_new ();
+ egg_binding_group_bind (priv->file_setting_bindings, "indent-width",
+ self, "indent-width", G_BINDING_SYNC_CREATE);
+ egg_binding_group_bind (priv->file_setting_bindings, "tab-width",
+ self, "tab-width", G_BINDING_SYNC_CREATE);
+ egg_binding_group_bind (priv->file_setting_bindings, "right-margin-position",
+ self, "right-margin-position", G_BINDING_SYNC_CREATE);
+ egg_binding_group_bind (priv->file_setting_bindings, "indent-style",
+ self, "indent-style", G_BINDING_SYNC_CREATE);
+ egg_binding_group_bind (priv->file_setting_bindings, "show-right-margin",
+ self, "show-right-margin", G_BINDING_SYNC_CREATE);
priv->buffer_signals = egg_signal_group_new (IDE_TYPE_BUFFER);
diff --git a/src/greeter/gb-greeter-project-row.c b/src/greeter/gb-greeter-project-row.c
index 1301eaf..dfc96a3 100644
--- a/src/greeter/gb-greeter-project-row.c
+++ b/src/greeter/gb-greeter-project-row.c
@@ -21,7 +21,7 @@
#include <glib/gi18n.h>
#include <ide.h>
-#include "egg-binding-set.h"
+#include "egg-binding-group.h"
#include "gb-glib.h"
#include "gb-greeter-project-row.h"
@@ -29,18 +29,18 @@
struct _GbGreeterProjectRow
{
- GtkListBoxRow parent_instance;
-
- IdeProjectInfo *project_info;
- EggBindingSet *bindings;
- gchar *search_text;
-
- GtkLabel *date_label;
- GtkLabel *description_label;
- GtkBox *languages_box;
- GtkLabel *location_label;
- GtkLabel *title_label;
- GtkLabel *checkbox;
+ GtkListBoxRow parent_instance;
+
+ IdeProjectInfo *project_info;
+ EggBindingGroup *bindings;
+ gchar *search_text;
+
+ GtkLabel *date_label;
+ GtkLabel *description_label;
+ GtkBox *languages_box;
+ GtkLabel *location_label;
+ GtkLabel *title_label;
+ GtkLabel *checkbox;
};
G_DEFINE_TYPE (GbGreeterProjectRow, gb_greeter_project_row, GTK_TYPE_LIST_BOX_ROW)
@@ -151,7 +151,7 @@ gb_greeter_project_row_set_project_info (GbGreeterProjectRow *self,
if (g_set_object (&self->project_info, project_info))
{
- egg_binding_set_set_source (self->bindings, project_info);
+ egg_binding_group_set_source (self->bindings, project_info);
if (project_info != NULL)
{
@@ -336,12 +336,12 @@ gb_greeter_project_row_init (GbGreeterProjectRow *self)
{
gtk_widget_init_template (GTK_WIDGET (self));
- self->bindings = egg_binding_set_new ();
+ self->bindings = egg_binding_group_new ();
- egg_binding_set_bind (self->bindings, "name", self->title_label, "label", 0);
- egg_binding_set_bind_full (self->bindings, "last-modified-at", self->date_label, "label", 0,
- humanize_date_time, NULL, NULL, NULL);
- egg_binding_set_bind_full (self->bindings, "directory", self->location_label, "label", 0,
- truncate_location, NULL, NULL, NULL);
- egg_binding_set_bind (self->bindings, "description", self->description_label, "label", 0);
+ egg_binding_group_bind (self->bindings, "name", self->title_label, "label", 0);
+ egg_binding_group_bind_full (self->bindings, "last-modified-at", self->date_label, "label", 0,
+ humanize_date_time, NULL, NULL, NULL);
+ egg_binding_group_bind_full (self->bindings, "directory", self->location_label, "label", 0,
+ truncate_location, NULL, NULL, NULL);
+ egg_binding_group_bind (self->bindings, "description", self->description_label, "label", 0);
}
diff --git a/tests/Makefile.am b/tests/Makefile.am
index fc749fa..8393ac5 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -136,10 +136,10 @@ test_ide_ctags_CFLAGS = $(tests_cflags)
test_ide_ctags_LDADD = $(tests_libs)
-TESTS += test-egg-binding-set
-test_egg_binding_set_SOURCES = test-egg-binding-set.c
-test_egg_binding_set_CFLAGS = $(egg_cflags)
-test_egg_binding_set_LDADD = $(egg_libs)
+TESTS += test-egg-binding-group
+test_egg_binding_group_SOURCES = test-egg-binding-group.c
+test_egg_binding_group_CFLAGS = $(egg_cflags)
+test_egg_binding_group_LDADD = $(egg_libs)
TESTS += test-egg-signal-group
diff --git a/tests/test-egg-binding-set.c b/tests/test-egg-binding-group.c
similarity index 73%
rename from tests/test-egg-binding-set.c
rename to tests/test-egg-binding-group.c
index bccd7b3..ec1b415 100644
--- a/tests/test-egg-binding-set.c
+++ b/tests/test-egg-binding-group.c
@@ -1,7 +1,7 @@
-#define G_LOG_DOMAIN "egg-binding-set"
+#define G_LOG_DOMAIN "egg-binding-group"
-#include "egg-binding-set.h"
+#include "egg-binding-group.h"
/* Copied from glib */
typedef struct _BindingSource
@@ -282,66 +282,66 @@ fahrenheit_to_celsius (GBinding *binding,
}
static void
-test_binding_set_invalid (void)
+test_binding_group_invalid (void)
{
- EggBindingSet *set = egg_binding_set_new ();
+ EggBindingGroup *group = egg_binding_group_new ();
BindingSource *source = g_object_new (binding_source_get_type (), NULL);
BindingTarget *target = g_object_new (binding_target_get_type (), NULL);
/* Invalid Target Property */
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL,
"*find_property*target_property*!=*NULL*");
- egg_binding_set_bind (set, "value",
- target, "does-not-exist",
- G_BINDING_DEFAULT);
+ egg_binding_group_bind (group, "value",
+ target, "does-not-exist",
+ G_BINDING_DEFAULT);
g_test_assert_expected_messages ();
- egg_binding_set_set_source (set, NULL);
+ egg_binding_group_set_source (group, NULL);
/* Invalid Source Property */
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL,
"*find_property*source_property*!=*NULL*");
- egg_binding_set_set_source (set, source);
- egg_binding_set_bind (set, "does-not-exist",
- target, "value",
- G_BINDING_DEFAULT);
+ egg_binding_group_set_source (group, source);
+ egg_binding_group_bind (group, "does-not-exist",
+ target, "value",
+ G_BINDING_DEFAULT);
g_test_assert_expected_messages ();
- egg_binding_set_set_source (set, NULL);
+ egg_binding_group_set_source (group, NULL);
/* Invalid Source */
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL,
"*find_property*->source_property*!=*NULL*");
- egg_binding_set_bind (set, "does-not-exist",
- target, "value",
- G_BINDING_DEFAULT);
- egg_binding_set_set_source (set, source);
+ egg_binding_group_bind (group, "does-not-exist",
+ target, "value",
+ G_BINDING_DEFAULT);
+ egg_binding_group_set_source (group, source);
g_test_assert_expected_messages ();
g_object_unref (target);
g_object_unref (source);
- g_object_unref (set);
+ g_object_unref (group);
}
static void
-test_binding_set_default (void)
+test_binding_group_default (void)
{
gsize i, j;
- EggBindingSet *set = egg_binding_set_new ();
+ EggBindingGroup *group = egg_binding_group_new ();
BindingSource *source = g_object_new (binding_source_get_type (), NULL);
BindingTarget *targets[5];
for (i = 0; i < G_N_ELEMENTS (targets); ++i)
{
targets[i] = g_object_new (binding_target_get_type (), NULL);
- egg_binding_set_bind (set, "foo",
- targets[i], "bar",
- G_BINDING_DEFAULT);
+ egg_binding_group_bind (group, "foo",
+ targets[i], "bar",
+ G_BINDING_DEFAULT);
}
- g_assert_null (egg_binding_set_get_source (set));
- egg_binding_set_set_source (set, source);
- g_assert (egg_binding_set_get_source (set) == (GObject *)source);
+ g_assert_null (egg_binding_group_get_source (group));
+ egg_binding_group_set_source (group, source);
+ g_assert (egg_binding_group_get_source (group) == (GObject *)source);
for (i = 0; i < 2; ++i)
{
@@ -353,13 +353,13 @@ test_binding_set_default (void)
g_assert_cmpint (source->foo, !=, targets[0]->bar);
/* Check that we transition the source correctly */
- egg_binding_set_set_source (set, NULL);
- g_assert_null (egg_binding_set_get_source (set));
- egg_binding_set_set_source (set, source);
- g_assert (egg_binding_set_get_source (set) == (GObject *)source);
+ egg_binding_group_set_source (group, NULL);
+ g_assert_null (egg_binding_group_get_source (group));
+ egg_binding_group_set_source (group, source);
+ g_assert (egg_binding_group_get_source (group) == (GObject *)source);
}
- g_object_unref (set);
+ g_object_unref (group);
g_object_set (source, "foo", 0, NULL);
for (i = 0; i < G_N_ELEMENTS (targets); ++i)
@@ -371,24 +371,24 @@ test_binding_set_default (void)
}
static void
-test_binding_set_bidirectional (void)
+test_binding_group_bidirectional (void)
{
gsize i, j;
- EggBindingSet *set = egg_binding_set_new ();
+ EggBindingGroup *group = egg_binding_group_new ();
BindingSource *source = g_object_new (binding_source_get_type (), NULL);
BindingTarget *targets[5];
for (i = 0; i < G_N_ELEMENTS (targets); ++i)
{
targets[i] = g_object_new (binding_target_get_type (), NULL);
- egg_binding_set_bind (set, "value",
- targets[i], "value",
- G_BINDING_BIDIRECTIONAL);
+ egg_binding_group_bind (group, "value",
+ targets[i], "value",
+ G_BINDING_BIDIRECTIONAL);
}
- g_assert_null (egg_binding_set_get_source (set));
- egg_binding_set_set_source (set, source);
- g_assert (egg_binding_set_get_source (set) == (GObject *)source);
+ g_assert_null (egg_binding_group_get_source (group));
+ egg_binding_group_set_source (group, source);
+ g_assert (egg_binding_group_get_source (group) == (GObject *)source);
for (i = 0; i < 2; ++i)
{
@@ -400,13 +400,13 @@ test_binding_set_bidirectional (void)
g_assert_cmpfloat (source->value, ==, targets[0]->value);
/* Check that we transition the source correctly */
- egg_binding_set_set_source (set, NULL);
- g_assert_null (egg_binding_set_get_source (set));
- egg_binding_set_set_source (set, source);
- g_assert (egg_binding_set_get_source (set) == (GObject *)source);
+ egg_binding_group_set_source (group, NULL);
+ g_assert_null (egg_binding_group_get_source (group));
+ egg_binding_group_set_source (group, source);
+ g_assert (egg_binding_group_get_source (group) == (GObject *)source);
}
- g_object_unref (set);
+ g_object_unref (group);
g_object_set (targets[0], "value", 0.0, NULL);
g_assert_cmpfloat (source->value, !=, targets[0]->value);
@@ -425,21 +425,21 @@ transform_destroy_notify (gpointer data)
}
static void
-test_binding_set_transform (void)
+test_binding_group_transform (void)
{
gboolean transform_destroy_called = FALSE;
- EggBindingSet *set = egg_binding_set_new ();
+ EggBindingGroup *group = egg_binding_group_new ();
BindingSource *source = g_object_new (binding_source_get_type (), NULL);
BindingTarget *target = g_object_new (binding_target_get_type (), NULL);
- egg_binding_set_set_source (set, source);
- egg_binding_set_bind_full (set, "value",
- target, "value",
- G_BINDING_BIDIRECTIONAL,
- celsius_to_fahrenheit,
- fahrenheit_to_celsius,
- &transform_destroy_called,
- transform_destroy_notify);
+ egg_binding_group_set_source (group, source);
+ egg_binding_group_bind_full (group, "value",
+ target, "value",
+ G_BINDING_BIDIRECTIONAL,
+ celsius_to_fahrenheit,
+ fahrenheit_to_celsius,
+ &transform_destroy_called,
+ transform_destroy_notify);
g_object_set (source, "value", 24.0, NULL);
g_assert_cmpfloat (target->value, ==, ((9 * 24.0 / 5) + 32.0));
@@ -450,10 +450,10 @@ test_binding_set_transform (void)
/* The GDestroyNotify should only be called when the
* set is freed, not when the various GBindings are freed
*/
- egg_binding_set_set_source (set, NULL);
+ egg_binding_group_set_source (group, NULL);
g_assert_false (transform_destroy_called);
- g_object_unref (set);
+ g_object_unref (group);
g_assert_true (transform_destroy_called);
g_object_unref (source);
@@ -461,11 +461,11 @@ test_binding_set_transform (void)
}
static void
-test_binding_set_transform_closures (void)
+test_binding_group_transform_closures (void)
{
gboolean transform_destroy_called_1 = FALSE;
gboolean transform_destroy_called_2 = FALSE;
- EggBindingSet *set = egg_binding_set_new ();
+ EggBindingGroup *group = egg_binding_group_new ();
BindingSource *source = g_object_new (binding_source_get_type (), NULL);
BindingTarget *target = g_object_new (binding_target_get_type (), NULL);
GClosure *c2f_closure, *f2c_closure;
@@ -477,12 +477,12 @@ test_binding_set_transform_closures (void)
&transform_destroy_called_2,
(GClosureNotify) transform_destroy_notify);
- egg_binding_set_set_source (set, source);
- egg_binding_set_bind_with_closures (set, "value",
- target, "value",
- G_BINDING_BIDIRECTIONAL,
- c2f_closure,
- f2c_closure);
+ egg_binding_group_set_source (group, source);
+ egg_binding_group_bind_with_closures (group, "value",
+ target, "value",
+ G_BINDING_BIDIRECTIONAL,
+ c2f_closure,
+ f2c_closure);
g_object_set (source, "value", 24.0, NULL);
g_assert_cmpfloat (target->value, ==, ((9 * 24.0 / 5) + 32.0));
@@ -493,11 +493,11 @@ test_binding_set_transform_closures (void)
/* The GClsoureNotify should only be called when the
* set is freed, not when the various GBindings are freed
*/
- egg_binding_set_set_source (set, NULL);
+ egg_binding_group_set_source (group, NULL);
g_assert_false (transform_destroy_called_1);
g_assert_false (transform_destroy_called_2);
- g_object_unref (set);
+ g_object_unref (group);
g_assert_true (transform_destroy_called_1);
g_assert_true (transform_destroy_called_2);
@@ -506,19 +506,19 @@ test_binding_set_transform_closures (void)
}
static void
-test_binding_set_same_object (void)
+test_binding_group_same_object (void)
{
gsize i;
- EggBindingSet *set = egg_binding_set_new ();
+ EggBindingGroup *group = egg_binding_group_new ();
BindingSource *source = g_object_new (binding_source_get_type (),
"foo", 100,
"bar", 50,
NULL);
- egg_binding_set_set_source (set, source);
- egg_binding_set_bind (set, "foo",
- source, "bar",
- G_BINDING_BIDIRECTIONAL);
+ egg_binding_group_set_source (group, source);
+ egg_binding_group_bind (group, "foo",
+ source, "bar",
+ G_BINDING_BIDIRECTIONAL);
for (i = 0; i < 2; ++i)
{
@@ -533,50 +533,50 @@ test_binding_set_same_object (void)
/* Check that it is possible both when initially
* adding the binding and when changing the source
*/
- egg_binding_set_set_source (set, NULL);
- egg_binding_set_set_source (set, source);
+ egg_binding_group_set_source (group, NULL);
+ egg_binding_group_set_source (group, source);
}
g_object_unref (source);
- g_object_unref (set);
+ g_object_unref (group);
}
static void
-test_binding_set_weak_ref_source (void)
+test_binding_group_weak_ref_source (void)
{
- EggBindingSet *set = egg_binding_set_new ();
+ EggBindingGroup *group = egg_binding_group_new ();
BindingSource *source = g_object_new (binding_source_get_type (), NULL);
BindingTarget *target = g_object_new (binding_target_get_type (), NULL);
- egg_binding_set_set_source (set, source);
- egg_binding_set_bind (set, "value",
- target, "value",
- G_BINDING_BIDIRECTIONAL);
+ egg_binding_group_set_source (group, source);
+ egg_binding_group_bind (group, "value",
+ target, "value",
+ G_BINDING_BIDIRECTIONAL);
g_object_add_weak_pointer (G_OBJECT (source), (gpointer)&source);
- g_assert (egg_binding_set_get_source (set) == (GObject *)source);
+ g_assert (egg_binding_group_get_source (group) == (GObject *)source);
g_object_unref (source);
g_assert_null (source);
- g_assert_null (egg_binding_set_get_source (set));
+ g_assert_null (egg_binding_group_get_source (group));
/* Hopefully this would explode if the binding was still alive */
g_object_set (target, "value", 0.0, NULL);
g_object_unref (target);
- g_object_unref (set);
+ g_object_unref (group);
}
static void
-test_binding_set_weak_ref_target (void)
+test_binding_group_weak_ref_target (void)
{
- EggBindingSet *set = egg_binding_set_new ();
+ EggBindingGroup *group = egg_binding_group_new ();
BindingSource *source = g_object_new (binding_source_get_type (), NULL);
BindingTarget *target = g_object_new (binding_target_get_type (), NULL);
- egg_binding_set_set_source (set, source);
- egg_binding_set_bind (set, "value",
- target, "value",
- G_BINDING_BIDIRECTIONAL);
+ egg_binding_group_set_source (group, source);
+ egg_binding_group_bind (group, "value",
+ target, "value",
+ G_BINDING_BIDIRECTIONAL);
g_object_set (source, "value", 47.0, NULL);
g_assert_cmpfloat (target->value, ==, 47.0);
@@ -589,7 +589,7 @@ test_binding_set_weak_ref_target (void)
g_object_set (source, "value", 0.0, NULL);
g_object_unref (source);
- g_object_unref (set);
+ g_object_unref (group);
}
gint
@@ -597,13 +597,13 @@ main (gint argc,
gchar *argv[])
{
g_test_init (&argc, &argv, NULL);
- g_test_add_func ("/Egg/BindingSet/invalid", test_binding_set_invalid);
- g_test_add_func ("/Egg/BindingSet/default", test_binding_set_default);
- g_test_add_func ("/Egg/BindingSet/bidirectional", test_binding_set_bidirectional);
- g_test_add_func ("/Egg/BindingSet/transform", test_binding_set_transform);
- g_test_add_func ("/Egg/BindingSet/transform-closures", test_binding_set_transform_closures);
- g_test_add_func ("/Egg/BindingSet/same-object", test_binding_set_same_object);
- g_test_add_func ("/Egg/BindingSet/weak-ref-source", test_binding_set_weak_ref_source);
- g_test_add_func ("/Egg/BindingSet/weak-ref-target", test_binding_set_weak_ref_target);
+ g_test_add_func ("/Egg/BindingGroup/invalid", test_binding_group_invalid);
+ g_test_add_func ("/Egg/BindingGroup/default", test_binding_group_default);
+ g_test_add_func ("/Egg/BindingGroup/bidirectional", test_binding_group_bidirectional);
+ g_test_add_func ("/Egg/BindingGroup/transform", test_binding_group_transform);
+ g_test_add_func ("/Egg/BindingGroup/transform-closures", test_binding_group_transform_closures);
+ g_test_add_func ("/Egg/BindingGroup/same-object", test_binding_group_same_object);
+ g_test_add_func ("/Egg/BindingGroup/weak-ref-source", test_binding_group_weak_ref_source);
+ g_test_add_func ("/Egg/BindingGroup/weak-ref-target", test_binding_group_weak_ref_target);
return g_test_run ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]