[Swfdec] Branch 'vivi' - 2 commits - libswfdec-gtk/swfdec_source.c vivified/ui

Benjamin Otte company at kemper.freedesktop.org
Wed Aug 22 00:35:09 PDT 2007


 libswfdec-gtk/swfdec_source.c |    4 ++--
 vivified/ui/vivi_movie_list.c |   13 ++++++++++++-
 2 files changed, 14 insertions(+), 3 deletions(-)

New commits:
diff-tree 73e6028c89191b80deaf5858ea468522749bf451 (from 32192c024105f03a19dcf93ca92ca56f43fd5b56)
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Aug 22 09:34:46 2007 +0200

    clear the model when the player gets reset
    
    ALso removes another debugging g_print

diff --git a/vivified/ui/vivi_movie_list.c b/vivified/ui/vivi_movie_list.c
index 497ee27..35aa0dd 100644
--- a/vivified/ui/vivi_movie_list.c
+++ b/vivified/ui/vivi_movie_list.c
@@ -294,7 +294,6 @@ vivi_movie_list_movie_notify (SwfdecMovi
       guint i;
       guint count = g_node_n_children (parent);
       int *positions = g_new (int, count);
-      g_print ("reordering %u => %u (%u total)\n", old, new, count);
       for (i = 0; i < min; i++) {
 	positions[i] = i;
       }
@@ -393,6 +392,16 @@ vivi_movie_list_removed (ViviDebugger *d
 }
 
 static void
+vivi_movie_list_reset (ViviApplication *app, GParamSpec *pspec, ViviMovieList *movies)
+{
+  GNode *walk;
+
+  for (walk = movies->root->children; walk; walk = walk->next) {
+    vivi_movie_list_removed (NULL, walk->data, movies);
+  }
+}
+
+static void
 vivi_movie_list_dispose (GObject *object)
 {
   ViviMovieList *movies = VIVI_MOVIE_LIST (object);
@@ -400,6 +409,7 @@ vivi_movie_list_dispose (GObject *object
   GNode *walk;
 
   debugger = movies->app->debugger;
+  g_signal_handlers_disconnect_by_func (movies->app, vivi_movie_list_reset, movies);
   g_signal_handlers_disconnect_by_func (debugger, vivi_movie_list_removed, movies);
   g_signal_handlers_disconnect_by_func (debugger, vivi_movie_list_added, movies);
   g_object_unref (movies->app);
@@ -442,6 +452,7 @@ vivi_movie_list_new (ViviApplication *ap
   g_object_ref (app);
   movies->app = app;
   debugger = app->debugger;
+  g_signal_connect (app, "notify::player", G_CALLBACK (vivi_movie_list_reset), movies);
   g_signal_connect (debugger, "add", G_CALLBACK (vivi_movie_list_added), movies);
   g_signal_connect (debugger, "remove", G_CALLBACK (vivi_movie_list_removed), movies);
   return GTK_TREE_MODEL (movies);
diff-tree 32192c024105f03a19dcf93ca92ca56f43fd5b56 (from f21416fa0be5658c7e88bc2e57d77eacd369ff85)
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Aug 22 09:33:47 2007 +0200

    only disconnect signals when the objet still exists

diff --git a/libswfdec-gtk/swfdec_source.c b/libswfdec-gtk/swfdec_source.c
index d570710..59f0d85 100644
--- a/libswfdec-gtk/swfdec_source.c
+++ b/libswfdec-gtk/swfdec_source.c
@@ -36,7 +36,7 @@ struct _SwfdecIterateSource {
   GSource		source;
   SwfdecPlayer *	player;		/* player we manage or NULL if player was deleted */
   double		speed;		/* inverse playback speed (so 0.5 means double speed) */
-  gulong		notify;		/* set for iterate notifications */
+  gulong		notify;		/* set for iterate notifications (only valid when player != NULL) */
   GTimeVal		last;		/* last time */
 };
 
@@ -115,7 +115,7 @@ swfdec_iterate_finalize (GSource *source
 {
   SwfdecIterateSource *source = (SwfdecIterateSource *) source_;
 
-  if (source->notify) {
+  if (source->notify && source->player) {
     g_signal_handler_disconnect (source->player, source->notify);
   }
   if (source->player) {


More information about the Swfdec mailing list