goocanvas r23 - in trunk: . demo src
- From: damon svn gnome org
- To: svn-commits-list gnome org
- Subject: goocanvas r23 - in trunk: . demo src
- Date: Fri, 31 Oct 2008 22:04:35 +0000 (UTC)
Author: damon
Date: Fri Oct 31 22:04:35 2008
New Revision: 23
URL: http://svn.gnome.org/viewvc/goocanvas?rev=23&view=rev
Log:
2008-10-31 Damon Chaplin <damon gnome org>
* src/goocanvasitemmodel.h (struct _GooCanvasItemModelIface):
* src/goocanvasitem.h (struct _GooCanvasItemIface): added
animation_finished() signals.
* src/goocanvasitemmodel.c:
* src/goocanvasitem.c: implemented "animation-finished" signals.
* demo/mv-demo-animation.c:
* demo/demo-animation.c: added test for above.
Modified:
trunk/ChangeLog
trunk/demo/demo-animation.c
trunk/demo/mv-demo-animation.c
trunk/src/goocanvasitem.c
trunk/src/goocanvasitem.h
trunk/src/goocanvasitemmodel.c
trunk/src/goocanvasitemmodel.h
Modified: trunk/demo/demo-animation.c
==============================================================================
--- trunk/demo/demo-animation.c (original)
+++ trunk/demo/demo-animation.c Fri Oct 31 22:04:35 2008
@@ -51,6 +51,15 @@
static void
+on_animation_finished (GooCanvasItem *item,
+ gboolean stopped,
+ gpointer data)
+{
+ g_print ("Animation finished stopped: %i\n", stopped);
+}
+
+
+static void
setup_canvas (GtkWidget *canvas)
{
GooCanvasItem *root;
@@ -62,6 +71,8 @@
"fill-color", "blue",
NULL);
goo_canvas_item_translate (ellipse1, 100, 100);
+ g_signal_connect (ellipse1, "animation_finished",
+ G_CALLBACK (on_animation_finished), NULL);
rect1 = goo_canvas_rect_new (root, -10, -10, 20, 20,
"fill-color", "blue",
Modified: trunk/demo/mv-demo-animation.c
==============================================================================
--- trunk/demo/mv-demo-animation.c (original)
+++ trunk/demo/mv-demo-animation.c Fri Oct 31 22:04:35 2008
@@ -51,6 +51,15 @@
}
+static void
+on_animation_finished (GooCanvasItemModel *model,
+ gboolean stopped,
+ gpointer data)
+{
+ g_print ("Animation finished stopped: %i\n", stopped);
+}
+
+
static GooCanvasItemModel*
create_canvas_model (void)
{
@@ -64,6 +73,8 @@
"fill-color", "blue",
NULL);
goo_canvas_item_model_translate (ellipse1, 100, 100);
+ g_signal_connect (ellipse1, "animation_finished",
+ G_CALLBACK (on_animation_finished), NULL);
rect1 = goo_canvas_rect_model_new (root, -10, -10, 20, 20,
"fill-color", "blue",
Modified: trunk/src/goocanvasitem.c
==============================================================================
--- trunk/src/goocanvasitem.c (original)
+++ trunk/src/goocanvasitem.c Fri Oct 31 22:04:35 2008
@@ -47,6 +47,7 @@
/* Miscellaneous signals. */
GRAB_BROKEN_EVENT,
CHILD_NOTIFY,
+ ANIMATION_FINISHED,
LAST_SIGNAL
};
@@ -373,6 +374,23 @@
G_TYPE_NONE, 1,
G_TYPE_PARAM);
+ /**
+ * GooCanvasItem::animation-finished
+ * @item: the item that received the signal.
+ * @stopped: if the animation was explicitly stopped.
+ *
+ * Emitted when the item animation has finished.
+ */
+ canvas_item_signals[ANIMATION_FINISHED] =
+ g_signal_new ("animation-finished",
+ iface_type,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GooCanvasItemIface, animation_finished),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__BOOLEAN,
+ G_TYPE_NONE, 1,
+ G_TYPE_BOOLEAN);
+
g_object_interface_install_property (g_iface,
g_param_spec_object ("parent",
@@ -1211,9 +1229,15 @@
/* This will result in a call to goo_canvas_item_free_animation()
above. We've set the timeout_id to 0 so it isn't removed twice. */
if (model)
- g_object_set_data (G_OBJECT (model), animation_key, NULL);
+ {
+ g_signal_emit_by_name (model, "animation-finished", FALSE);
+ g_object_set_data (G_OBJECT (model), animation_key, NULL);
+ }
else
- g_object_set_data (G_OBJECT (item), animation_key, NULL);
+ {
+ g_signal_emit_by_name (item, "animation-finished", FALSE);
+ g_object_set_data (G_OBJECT (item), animation_key, NULL);
+ }
break;
case GOO_CANVAS_ANIMATE_RESTART:
@@ -1392,6 +1416,8 @@
void
goo_canvas_item_stop_animation (GooCanvasItem *item)
{
+ g_signal_emit_by_name (item, "animation-finished", TRUE);
+
/* This will result in a call to goo_canvas_item_free_animation() above. */
g_object_set_data (G_OBJECT (item), animation_key, NULL);
}
Modified: trunk/src/goocanvasitem.h
==============================================================================
--- trunk/src/goocanvasitem.h (original)
+++ trunk/src/goocanvasitem.h Fri Oct 31 22:04:35 2008
@@ -127,6 +127,7 @@
* @key_release_event: signal emitted when a key is released.
* @grab_broken_event: signal emitted when a grab that the item has is lost.
* @child_notify: signal emitted when a child property is changed.
+ * @animation_finished: signal emitted when the item's animation has finished.
*
* #GooCanvasItemIFace holds the virtual methods that make up the
* #GooCanvasItem interface.
@@ -288,6 +289,9 @@
void (* set_is_static) (GooCanvasItem *item,
gboolean is_static);
+ void (* animation_finished) (GooCanvasItem *item,
+ gboolean stopped);
+
/*< private >*/
/* Padding for future expansion */
@@ -296,7 +300,6 @@
void (*_goo_canvas_reserved3) (void);
void (*_goo_canvas_reserved4) (void);
void (*_goo_canvas_reserved5) (void);
- void (*_goo_canvas_reserved6) (void);
};
Modified: trunk/src/goocanvasitemmodel.c
==============================================================================
--- trunk/src/goocanvasitemmodel.c (original)
+++ trunk/src/goocanvasitemmodel.c Fri Oct 31 22:04:35 2008
@@ -37,6 +37,7 @@
CHANGED,
CHILD_NOTIFY,
+ ANIMATION_FINISHED,
LAST_SIGNAL
};
@@ -195,6 +196,23 @@
G_TYPE_NONE, 1,
G_TYPE_PARAM);
+ /**
+ * GooCanvasItemModel::animation-finished
+ * @item: the item model that received the signal.
+ * @stopped: if the animation was explicitly stopped.
+ *
+ * Emitted when the item model animation has finished.
+ */
+ item_model_signals[ANIMATION_FINISHED] =
+ g_signal_new ("animation-finished",
+ iface_type,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GooCanvasItemModelIface, animation_finished),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__BOOLEAN,
+ G_TYPE_NONE, 1,
+ G_TYPE_BOOLEAN);
+
g_object_interface_install_property (g_iface,
g_param_spec_object ("parent",
@@ -899,6 +917,8 @@
void
goo_canvas_item_model_stop_animation (GooCanvasItemModel *model)
{
+ g_signal_emit_by_name (model, "animation-finished", TRUE);
+
/* This will result in a call to goo_canvas_item_free_animation() above. */
g_object_set_data (G_OBJECT (model), animation_key, NULL);
}
Modified: trunk/src/goocanvasitemmodel.h
==============================================================================
--- trunk/src/goocanvasitemmodel.h (original)
+++ trunk/src/goocanvasitemmodel.h Fri Oct 31 22:04:35 2008
@@ -54,6 +54,7 @@
* @child_removed: signal emitted when a child is removed.
* @changed: signal emitted when the model has changed.
* @child_notify: signal emitted when a child property has changed.
+ * @animation_finished: signal emitted when the model's animation has finished.
*
* #GooCanvasItemModelIFace holds the virtual methods that make up the
* #GooCanvasItemModel interface.
@@ -134,6 +135,9 @@
void (* child_notify) (GooCanvasItemModel *model,
GParamSpec *pspec);
+ void (* animation_finished) (GooCanvasItemModel *model,
+ gboolean stopped);
+
/*< private >*/
/* Padding for future expansion */
@@ -144,7 +148,6 @@
void (*_goo_canvas_reserved5) (void);
void (*_goo_canvas_reserved6) (void);
void (*_goo_canvas_reserved7) (void);
- void (*_goo_canvas_reserved8) (void);
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]