Re: [Muine] New release soon?



On Fri, Jan 20, 2006 at 11:28:17AM -0800, Peter Johanson wrote:
> On Fri, Jan 20, 2006 at 08:17:33PM +0100, Oliver Lemke wrote:
> > 
> > Just inserting a player.Position=0 before firing the SongChangedEvent
> > works... sort of. ;-) When the property player.Position is set to zero,
> > a TickEvent is fired before the SongChangedEvent. Actually not what we
> > want, right? :-(
> 
> Yeah, I had a sneaking suspicion this would happen if we tried to do
> that simple change. Thus my warning that it might require some trickery.
> (:

Ok, let's give the attached form of trickery some testing. We switch
back the order of the 'fire the event, set the song', but now setting
the song doesn't actually fire the TickEvent right then, it does it in
the idle callback which is actually changing the song. End result,
afaict, and the problem is fixed. No duplicate SongChanged events, and
our Position == 0 for both the SongChanged, and all subsequent tick
events after that.

This make that pesky, 'asking for sanity during events' muinescrobbler
plugin happy now? (/me crosses fingers)

-pete

PS - this message brought to you by the "Holy crap, why did I start
looking at fixing this bug at 2AM in the morning" Foundation. The usual
disclaimers apply.

-- 
Peter Johanson
<latexer gentoo org>
Index: src/Player.cs
===================================================================
RCS file: /cvs/gnome/muine/src/Player.cs,v
retrieving revision 1.36
diff -a -u -r1.36 Player.cs
--- src/Player.cs	14 Jun 2005 08:47:27 -0000	1.36
+++ src/Player.cs	21 Jan 2006 10:26:41 -0000
@@ -117,9 +117,6 @@
 					GLib.Source.Remove (set_file_idle_id);
 
 				set_file_idle_id = GLib.Idle.Add (new GLib.IdleHandler (SetFileIdleFunc));
-
-				if (TickEvent != null)
-					TickEvent (0);
 			}
 
 			get { return song; }
@@ -240,6 +237,8 @@
 			if (playing)
 				player_play (Raw);
 
+			if (TickEvent != null)
+				TickEvent (0);
 			return false;
 		}
 
Index: src/PlaylistWindow.cs
===================================================================
RCS file: /cvs/gnome/muine/src/PlaylistWindow.cs,v
retrieving revision 1.239
diff -a -u -r1.239 PlaylistWindow.cs
--- src/PlaylistWindow.cs	19 Jan 2006 10:00:56 -0000	1.239
+++ src/PlaylistWindow.cs	21 Jan 2006 10:26:42 -0000
@@ -1153,13 +1153,11 @@
 
 				this.Title = String.Format (string_title_main, song.Title);
 
-                                // Do this before actually loading the new song, so that the signals are
-                                // emitted in the right order: SongChangedEvent first, and then TickEvent.
-			        if (fire_signal && SongChangedEvent != null)
-				        SongChangedEvent (song);
-
 				if (player.Song != song || restart)
 					player.Song = song;
+
+			        if (fire_signal && SongChangedEvent != null)
+				        SongChangedEvent (song);
 
 			} else {
 				cover_image.Song = null;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]