static void
_loading_done (GESFormatter * self)
{
  GList *assets, *tmp;
  GESBaseXmlFormatterPrivate *priv = GES_BASE_XML_FORMATTER (self)->priv;

  _add_all_groups (self);

  if (priv->parsecontext)
    g_markup_parse_context_free (priv->parsecontext);
  priv->parsecontext = NULL;

  ges_timeline_set_auto_transition (self->timeline,
      priv->timeline_auto_transition);

  /* Go over all assets and make sure that all proxies we were 'trying' to set are finally
   * properly set */
  assets = ges_project_list_assets (self->project, GES_TYPE_EXTRACTABLE);
  for (tmp = assets; tmp; tmp = tmp->next) {
    ges_asset_set_proxy (NULL, tmp->data);
  }

  g_hash_table_foreach (priv->layers, (GHFunc) _set_auto_transition, NULL);
  ges_project_set_loaded (self->project, self);
}
static void
_loading_done (GESFormatter * self)
{
  GESBaseXmlFormatterPrivate *priv = GES_BASE_XML_FORMATTER (self)->priv;

  _add_all_groups (self);

  if (priv->parsecontext)
    g_markup_parse_context_free (priv->parsecontext);
  priv->parsecontext = NULL;

  ges_timeline_set_auto_transition (self->timeline,
      priv->timeline_auto_transition);

  g_hash_table_foreach (priv->layers, (GHFunc) _set_auto_transition, NULL);
  ges_project_set_loaded (self->project, self);
}
static gboolean
_can_load_uri (GESFormatter * dummy_formatter, const gchar * uri,
    GError ** error)
{
  GMarkupParseContext *ctx;
  GESBaseXmlFormatter *self = GES_BASE_XML_FORMATTER (dummy_formatter);

  /* we create a temporary object so we can use it as a context */
  _GET_PRIV (self)->check_only = TRUE;


  ctx = create_parser_context (self, uri, error);
  if (!ctx)
    return FALSE;

  g_markup_parse_context_free (ctx);
  return TRUE;
}
static gboolean
_load_from_uri (GESFormatter * self, GESTimeline * timeline, const gchar * uri,
    GError ** error)
{
  GESBaseXmlFormatterPrivate *priv = _GET_PRIV (self);

  ges_timeline_set_auto_transition (timeline, FALSE);

  priv->parsecontext =
      create_parser_context (GES_BASE_XML_FORMATTER (self), uri, error);

  if (!priv->parsecontext)
    return FALSE;

  if (g_hash_table_size (priv->assetid_pendingclips) == 0 &&
      priv->pending_assets == NULL)
    g_idle_add ((GSourceFunc) _loading_done_cb, g_object_ref (self));

  return TRUE;
}
static void
_add_all_groups (GESFormatter * self)
{
  GList *tmp;
  GESTimelineElement *child;
  GESBaseXmlFormatterPrivate *priv = GES_BASE_XML_FORMATTER (self)->priv;

  for (tmp = priv->groups; tmp; tmp = tmp->next) {
    GList *lchild;
    PendingGroup *pgroup = tmp->data;

    for (lchild = ((PendingGroup *) tmp->data)->pending_children; lchild;
        lchild = lchild->next) {
      child = g_hash_table_lookup (priv->containers, lchild->data);

      GST_DEBUG_OBJECT (tmp->data, "Adding %s child %" GST_PTR_FORMAT " %s",
          (const gchar *) lchild->data, child,
          GES_TIMELINE_ELEMENT_NAME (child));
      ges_timeline_element_set_timeline (GES_TIMELINE_ELEMENT (pgroup->group), self->timeline);
      ges_container_add (GES_CONTAINER (pgroup->group), child);
    }
  }
}