timeline-element: Add a set_parent vmethod
authorThibault Saunier <thibault.saunier@collabora.com>
Sun, 1 Sep 2013 16:18:53 +0000 (12:18 -0400)
committerThibault Saunier <thibault.saunier@collabora.com>
Wed, 4 Sep 2013 00:57:31 +0000 (20:57 -0400)
API:
        GESTimelineElment->set_parent vmethod

ges/ges-timeline-element.c
ges/ges-timeline-element.h

index 67108d1..b4fe32a 100644 (file)
@@ -225,6 +225,7 @@ ges_timeline_element_class_init (GESTimelineElementClass * klass)
 
   object_class->finalize = ges_timeline_element_finalize;
 
+  klass->set_parent = NULL;
   klass->set_start = NULL;
   klass->set_inpoint = NULL;
   klass->set_duration = NULL;
@@ -267,6 +268,11 @@ ges_timeline_element_set_parent (GESTimelineElement * self,
   if (self->parent != NULL && parent != NULL)
     goto had_parent;
 
+  if (GES_TIMELINE_ELEMENT_GET_CLASS (self)->set_parent) {
+    if (!GES_TIMELINE_ELEMENT_GET_CLASS (self)->set_parent (self, parent))
+      return FALSE;
+  }
+
   self->parent = parent;
 
   g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_PARENT]);
index f495a8c..c8cfda8 100644 (file)
@@ -138,6 +138,7 @@ struct _GESTimelineElement
 
 /**
  * GESTimelineElementClass:
+ * @set_parent: method to set the parent of a #GESTimelineElement.
  * @set_start: method to set the start of a #GESTimelineElement
  * @set_duration: method to set the duration of a #GESTimelineElement
  * @set_inpoint: method to set the inpoint of a #GESTimelineElement
@@ -152,13 +153,18 @@ struct _GESTimelineElement
  *
  * The GESTimelineElement base class. Subclasses should override at least
  * @set_start @set_inpoint @set_duration @ripple @ripple_end @roll_start
- * @roll_end and @trim
+ * @roll_end and @trim.
+ *
+ * Vmethods in subclasses should apply all the operation they need to but
+ * the real method implementation is in charge of setting the proper field,
+ * and emit the notify signal.
  */
 struct _GESTimelineElementClass
 {
   GInitiallyUnownedClass parent_class;
 
   /*< public > */
+  gboolean (*set_parent)       (GESTimelineElement * self, GESTimelineElement *parent);
   gboolean (*set_start)        (GESTimelineElement * self, GstClockTime start);
   gboolean (*set_inpoint)      (GESTimelineElement * self, GstClockTime inpoint);
   gboolean (*set_duration)     (GESTimelineElement * self, GstClockTime duration);