From 85e966963e7e48b12666ae46f426fd2d1ed886eb Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Wed, 1 May 2019 18:20:42 -0400 Subject: [PATCH] project: Add a signal to notify when a new timeline is starting to load --- ges/ges-project.c | 19 +++++++++++++++++-- ges/ges-project.h | 4 +++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/ges/ges-project.c b/ges/ges-project.c index 5f5baab70c..b65a1a0993 100644 --- a/ges/ges-project.c +++ b/ges/ges-project.c @@ -80,6 +80,7 @@ typedef struct EmitLoadedInIdle enum { + LOADING_SIGNAL, LOADED_SIGNAL, ERROR_LOADING_ASSET, ASSET_ADDED_SIGNAL, @@ -179,6 +180,7 @@ _load_project (GESProject * project, GESTimeline * timeline, GError ** error) priv = GES_PROJECT (project)->priv; + g_signal_emit (project, _signals[LOADING_SIGNAL], 0, timeline); if (priv->uri == NULL) { EmitLoadedInIdle *data = g_slice_new (EmitLoadedInIdle); @@ -481,10 +483,23 @@ ges_project_class_init (GESProjectClass * klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GESProjectClass, asset_removed), NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, 1, GES_TYPE_ASSET); + /** + * GESProject::loading: + * @project: the #GESProject that is starting to load a timeline + * @timeline: The #GESTimeline that started loading + * + * Since: 1.18 + */ + _signals[LOADING_SIGNAL] = + g_signal_new ("loading", G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GESProjectClass, loading), + NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, + 1, GES_TYPE_TIMELINE); + /** * GESProject::loaded: - * @project: the #GESProject that is done loading a project. - * @timeline: The #GESTimeline that complete loading + * @project: the #GESProject that is done loading a timeline. + * @timeline: The #GESTimeline that completed loading */ _signals[LOADED_SIGNAL] = g_signal_new ("loaded", G_TYPE_FROM_CLASS (klass), diff --git a/ges/ges-project.h b/ges/ges-project.h index 18239844d2..a9648350cd 100644 --- a/ges/ges-project.h +++ b/ges/ges-project.h @@ -71,8 +71,10 @@ struct _GESProjectClass GType extractable_type); gboolean (*loaded) (GESProject * self, GESTimeline * timeline); + gboolean (*loading) (GESProject * self, + GESTimeline * timeline); - gpointer _ges_reserved[GES_PADDING]; + gpointer _ges_reserved[GES_PADDING - 1]; }; GES_API