diff options
-rw-r--r-- | ges/ges-formatter.c | 25 | ||||
-rw-r--r-- | ges/ges-formatter.h | 6 | ||||
-rw-r--r-- | ges/ges-pitivi-formatter.c | 14 |
3 files changed, 24 insertions, 21 deletions
diff --git a/ges/ges-formatter.c b/ges/ges-formatter.c index c0c7f9b1..6199e618 100644 --- a/ges/ges-formatter.c +++ b/ges/ges-formatter.c @@ -39,8 +39,8 @@ * Support for saving or loading new formats can be added by creating a subclass of * #GESFormatter and implement the various vmethods of #GESFormatterClass. * - * Note that subclasses should call project_loaded wen they are done loading - * a project. + * Note that subclasses should call ges_formatter_project_loaded when they are done + * loading a project. **/ #include <gst/gst.h> @@ -76,9 +76,6 @@ static gboolean default_can_save_uri (const gchar * uri); static void discovery_error_cb (GESTimeline * timeline, GESTimelineFileSource * tfs, GError * error, GESFormatter * formatter); -static gboolean project_loaded (GESFormatter * formatter, - GESTimeline * timeline); - enum { SOURCE_MOVED_SIGNAL, @@ -123,7 +120,6 @@ ges_formatter_class_init (GESFormatterClass * klass) klass->load_from_uri = load_from_uri; klass->save_to_uri = save_to_uri; klass->update_source_uri = NULL; - klass->project_loaded = project_loaded; } static void @@ -594,11 +590,22 @@ discovery_error_cb (GESTimeline * timeline, } } -static gboolean -project_loaded (GESFormatter * formatter, GESTimeline * timeline) +/*< protected >*/ +/** + * ges_formatter_emit_loaded: + * @formatter: The #GESFormatter from which to emit the "project-loaded" signal + * + * Emits the "loaded" signal. This method should be called by sublasses when + * the project is fully loaded. + * + * Returns: %TRUE if the signale could be emitted %FALSE otherwize + */ +gboolean +ges_formatter_emit_loaded (GESFormatter * formatter) { GST_INFO_OBJECT (formatter, "Emit project loaded"); - g_signal_emit (formatter, ges_formatter_signals[LOADED_SIGNAL], 0, timeline); + g_signal_emit (formatter, ges_formatter_signals[LOADED_SIGNAL], 0, + formatter->timeline); return TRUE; } diff --git a/ges/ges-formatter.h b/ges/ges-formatter.h index bc2b7232..80d18546 100644 --- a/ges/ges-formatter.h +++ b/ges/ges-formatter.h @@ -140,7 +140,6 @@ typedef gboolean (*GESFormatterLoadedMethod) (GESFormatter *formatter, * @save_to_uri: class method to serialize data to a URI * @update_source_uri: virtual method to specify that a source has moved, and thus its URI * must be set to its new location (specified by the user) - * @project_loaded: Must be called by subclasses when done loading a project * * GES Formatter class. Override the vmethods to implement the formatter functionnality. */ @@ -153,7 +152,6 @@ struct _GESFormatterClass { GESFormatterLoadFromURIMethod load_from_uri; GESFormatterSaveToURIMethod save_to_uri; GESFormatterSourceMovedMethod update_source_uri; - GESFormatterLoadedMethod project_loaded; /*< private >*/ /* FIXME : formatter name */ @@ -188,6 +186,10 @@ gboolean ges_formatter_update_source_uri (GESFormatter * formatter, GESTimelineFileSource * source, gchar * new_uri); +/*< protected >*/ +gboolean +ges_formatter_emit_loaded (GESFormatter * formatter); + /* Non-standard methods. WILL BE DEPRECATED */ gboolean ges_formatter_load (GESFormatter * formatter, GESTimeline * timeline); diff --git a/ges/ges-pitivi-formatter.c b/ges/ges-pitivi-formatter.c index 2abc06a9..b4d4059c 100644 --- a/ges/ges-pitivi-formatter.c +++ b/ges/ges-pitivi-formatter.c @@ -807,12 +807,8 @@ track_object_added_cb (GESTimelineObject * object, g_hash_table_steal (props_table, "current-formatter"); priv->sources_to_load = g_list_remove (priv->sources_to_load, object); - if (!priv->sources_to_load) { - GESFormatterClass *klass = GES_FORMATTER_GET_CLASS (formatter); - - klass->project_loaded (GES_FORMATTER (formatter), - GES_FORMATTER (formatter)->timeline); - } + if (!priv->sources_to_load) + ges_formatter_emit_loaded (GES_FORMATTER (formatter)); } if (lockedstr && !g_strcmp0 (lockedstr, "(bool)False")) @@ -909,7 +905,7 @@ make_source (GESFormatter * self, GList * reflist, GHashTable * source_table) if (!(layer = g_hash_table_lookup (priv->layers_table, &prio))) { layer = ges_timeline_layer_new (); g_object_set (layer, "auto-transition", TRUE, "priority", prio, NULL); - ges_timeline_add_layer (priv->timeline, layer); + ges_timeline_add_layer (self->timeline, layer); g_hash_table_insert (priv->layers_table, g_memdup (&prio, sizeof (guint64)), layer); } @@ -1106,9 +1102,7 @@ load_pitivi_file_from_uri (GESFormatter * self, * 'project-loaded' signal. */ if (!g_hash_table_size (priv->timeline_objects_table)) { - GESFormatterClass *klass = GES_FORMATTER_GET_CLASS (self); - - klass->project_loaded (self, self->timeline); + ges_formatter_emit_loaded (self); } else { if (!make_timeline_objects (self)) { GST_ERROR ("Couldn't deserialise the project properly"); |