From b10743ef9aff11f868f4c5940bb12b923ffd1723 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Fri, 7 Aug 2009 16:39:09 +0200 Subject: [PATCH] TimelineLayer: Implement _remove_object() --- ges/ges-timeline-layer.c | 26 ++++++++++++++++++++++++++ ges/ges-timeline-layer.h | 1 + 2 files changed, 27 insertions(+) diff --git a/ges/ges-timeline-layer.c b/ges/ges-timeline-layer.c index 7f4ee82..8cdf517 100644 --- a/ges/ges-timeline-layer.c +++ b/ges/ges-timeline-layer.c @@ -156,3 +156,29 @@ ges_timeline_layer_add_object (GESTimelineLayer * layer, return TRUE; } + +gboolean +ges_timeline_layer_remove_object (GESTimelineLayer * layer, + GESTimelineObject * object) +{ + GST_DEBUG ("layer:%p, object:%p", layer, object); + + if (G_UNLIKELY (object->layer != layer)) { + GST_WARNING ("TimelineObject doesn't belong to this layer"); + return FALSE; + } + + /* emit 'object-removed' */ + g_signal_emit (layer, ges_timeline_layer_signals[OBJECT_REMOVED], 0, object); + + /* inform the object it's no longer in a layer */ + ges_timeline_object_set_layer (object, NULL); + + /* Remove it from our list of controlled objects */ + layer->objects_start = g_slist_remove (layer->objects_start, object); + + /* Remove our reference to the object */ + g_object_unref (object); + + return TRUE; +} diff --git a/ges/ges-timeline-layer.h b/ges/ges-timeline-layer.h index bbd8cdd..808e593 100644 --- a/ges/ges-timeline-layer.h +++ b/ges/ges-timeline-layer.h @@ -63,6 +63,7 @@ GESTimelineLayer* ges_timeline_layer_new (void); void ges_timeline_layer_set_timeline (GESTimelineLayer * layer, GESTimeline * timeline); gboolean ges_timeline_layer_add_object (GESTimelineLayer * layer, GESTimelineObject * object); +gboolean ges_timeline_layer_remove_object (GESTimelineLayer * layer, GESTimelineObject * object); G_END_DECLS -- 2.7.4