update height when track object priority offset changes
authorBrandon Lewis <brandon@collabora.co.uk>
Fri, 9 Jul 2010 11:49:23 +0000 (13:49 +0200)
committerEdward Hervey <edward.hervey@collabora.co.uk>
Wed, 1 Sep 2010 14:56:02 +0000 (16:56 +0200)
ges/ges-timeline-object.c

index d5e32b1a37c8bf1a308a9fa63376858be9b331ca..943472fbe3cde09bfbdb713c552725af49caad8e 100644 (file)
@@ -39,6 +39,10 @@ gboolean
 ges_timeline_object_create_track_objects_func (GESTimelineObject
     * object, GESTrack * track);
 
+static void
+track_object_priority_offset_changed_cb (GESTrackObject * child,
+    GParamSpec * arg G_GNUC_UNUSED, GESTimelineObject * obj);
+
 G_DEFINE_TYPE (GESTimelineObject, ges_timeline_object, G_TYPE_OBJECT);
 
 enum
@@ -301,6 +305,9 @@ ges_timeline_object_add_track_object (GESTimelineObject * object, GESTrackObject
 
   GST_DEBUG ("Returning trobj:%p", trobj);
 
+  g_signal_connect (G_OBJECT (trobj), "notify::priority-offset", G_CALLBACK
+      (track_object_priority_offset_changed_cb), object);
+
   return TRUE;
 }
 
@@ -487,3 +494,22 @@ ges_timeline_object_find_track_object (GESTimelineObject * object,
 
   return ret;
 }
+
+static void
+track_object_priority_offset_changed_cb (GESTrackObject * child,
+    GParamSpec * arg G_GNUC_UNUSED, GESTimelineObject * obj)
+{
+  guint new, old;
+
+  /* all track objects have height 1 */
+  new = GES_TRACK_OBJECT_PRIORITY_OFFSET (child) + 1;
+  old = GES_TIMELINE_OBJECT_HEIGHT (obj);
+
+  GST_LOG ("object %p, new=%d, old=%d", obj, new, old);
+
+  if (new > old) {
+    obj->height = new;
+    GST_LOG ("emitting notify signal");
+    g_object_notify ((GObject *) obj, "height");
+  }
+}