TimelineLayer: Implement _remove_object()
authorEdward Hervey <edward.hervey@collabora.co.uk>
Fri, 7 Aug 2009 14:39:09 +0000 (16:39 +0200)
committerEdward Hervey <edward.hervey@collabora.co.uk>
Fri, 7 Aug 2009 14:39:09 +0000 (16:39 +0200)
ges/ges-timeline-layer.c
ges/ges-timeline-layer.h

index 7f4ee82765d5d0030631d7d51b8461919dfefe16..8cdf5172a99aa5781d24a67b833eb7ba2c49dcce 100644 (file)
@@ -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;
+}
index bbd8cdd66be1e4d514a285175bf98ce248dd0f70..808e5935bb8b371a7ddfd2318f1093def3007de7 100644 (file)
@@ -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