[clutter/wip/apocalypses/apocalypse-3: 8/35] content: Turn attached and detached into signals
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter/wip/apocalypses/apocalypse-3: 8/35] content: Turn attached and detached into signals
- Date: Thu, 15 Mar 2012 12:04:40 +0000 (UTC)
commit 5245121a7ec5e821f019d30026561ad74954f373
Author: Emmanuele Bassi <ebassi linux intel com>
Date: Sat Feb 4 12:58:40 2012 +0000
content: Turn attached and detached into signals
The attached and detached virtual functions are now informative, and not
normative - which means it's a good idea to provide them as signals.
clutter/clutter-content.c | 54 +++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 52 insertions(+), 2 deletions(-)
---
diff --git a/clutter/clutter-content.c b/clutter/clutter-content.c
index 2e38516..04942a3 100644
--- a/clutter/clutter-content.c
+++ b/clutter/clutter-content.c
@@ -48,8 +48,18 @@
typedef struct _ClutterContentIface ClutterContentInterface;
+enum
+{
+ ATTACHED,
+ DETACHED,
+
+ LAST_SIGNAL
+};
+
static GQuark quark_content_actors = 0;
+static guint content_signals[LAST_SIGNAL] = { 0, };
+
G_DEFINE_INTERFACE (ClutterContent, clutter_content, G_TYPE_OBJECT)
static gboolean
@@ -100,6 +110,46 @@ clutter_content_default_init (ClutterContentInterface *iface)
iface->attached = clutter_content_real_attached;
iface->detached = clutter_content_real_detached;
iface->invalidate = clutter_content_real_invalidate;
+
+ /**
+ * ClutterContent::attached:
+ * @content: the object that emitted the signal
+ * @actor: a #ClutterActor
+ *
+ * This signal is emitted each time a #ClutterContent implementation is
+ * assigned to a #ClutterActor.
+ *
+ * Since: 1.10
+ */
+ content_signals[ATTACHED] =
+ g_signal_new (I_("attached"),
+ G_TYPE_FROM_INTERFACE (iface),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (ClutterContentIface, attached),
+ NULL, NULL,
+ _clutter_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ CLUTTER_TYPE_ACTOR);
+
+ /**
+ * ClutterContent::detached:
+ * @content: the object that emitted the signal
+ * @actor: a #ClutterActor
+ *
+ * This signal is emitted each time a #ClutterContent implementation is
+ * removed from a #ClutterActor.
+ *
+ * Since: 1.10
+ */
+ content_signals[DETACHED] =
+ g_signal_new (I_("detached"),
+ G_TYPE_FROM_INTERFACE (iface),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (ClutterContentIface, detached),
+ NULL, NULL,
+ _clutter_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ CLUTTER_TYPE_ACTOR);
}
/**
@@ -172,7 +222,7 @@ _clutter_content_attached (ClutterContent *content,
g_hash_table_insert (actors, actor, actor);
- CLUTTER_CONTENT_GET_IFACE (content)->attached (content, actor);
+ g_signal_emit (content, content_signals[ATTACHED], 0, actor);
}
/*< private >
@@ -203,7 +253,7 @@ _clutter_content_detached (ClutterContent *content,
if (g_hash_table_size (actors) == 0)
g_object_set_qdata (obj, quark_content_actors, NULL);
- CLUTTER_CONTENT_GET_IFACE (content)->detached (content, actor);
+ g_signal_emit (content, content_signals[DETACHED], 0, actor);
}
/*< private >
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]