[Banshee-List] One small patch



Hello,

First I will like to ask Aaron if the Genre patch was like he want it, and send a new small patch, working on my
normalized version i saw that there is a function in PlaylistModel.cs call SyncPlayingIter, it is call when update view
is call and will iterate over the model until it finds the iterator for the song is being played at the moment, i think
this is not the best way to do it, specially because the View will iterate over the whole model to render anyway.

So i made the function private, and modify the rendering function TrackCellInd ; it is i think and small a sure step,
and will avoid unneeded iterations over the tracks. After this step i will see if the function can also be replaced for
internal use.

>From what i can see banshee continuous to work correctly after this change. The main goal of this change is avoid the
more spread use of that this function, which i think is dangerously inefficient. 

regards,

Oscar.
? burn-sharp/.deps
? burn-sharp/.libs
? burn-sharp/glue.lo
? burn-sharp/libnautilusburnglue.la
? libbanshee/.deps
? libbanshee/.libs
? libbanshee/gst-cd-rip-0.8.lo
? libbanshee/gst-misc-0.8.lo
? libbanshee/gst-playback-0.8.lo
? libbanshee/gst-transcode-0.8.lo
? libbanshee/hal-context.lo
? libbanshee/inotify-glue.lo
? libbanshee/libbanshee.la
? libbanshee/xing/.deps
? po/.intltool-merge-cache
Index: src/PlaylistModel.cs
===================================================================
RCS file: /cvs/gnome/banshee/src/PlaylistModel.cs,v
retrieving revision 1.33
diff -u -r1.33 PlaylistModel.cs
--- src/PlaylistModel.cs	8 Feb 2006 07:39:25 -0000	1.33
+++ src/PlaylistModel.cs	21 Feb 2006 08:53:09 -0000
@@ -74,7 +74,7 @@
             };
         }
     
-        public void SyncPlayingIter()
+        private void SyncPlayingIter()
         {
             if(PlayerEngineCore.ActivePlayer.Track == null) {
                 playingIter = TreeIter.Zero;
Index: src/PlaylistView.cs
===================================================================
RCS file: /cvs/gnome/banshee/src/PlaylistView.cs,v
retrieving revision 1.39
diff -u -r1.39 PlaylistView.cs
--- src/PlaylistView.cs	8 Feb 2006 07:39:25 -0000	1.39
+++ src/PlaylistView.cs	21 Feb 2006 08:53:10 -0000
@@ -338,15 +338,15 @@
         protected void TrackCellInd(TreeViewColumn tree_column,
             CellRenderer cell, TreeModel tree_model, TreeIter iter)
         {
-            CellRendererPixbuf renderer = (CellRendererPixbuf)cell;
-            TrackInfo ti = model.IterTrackInfo(iter);
-            if(ti == null) {
-                return;
+            TrackInfo ti = IterTrackInfo(iter);
+            if((ti != null) && (PlayerEngineCore.ActivePlayer.Track != null)) {
+                CellRendererPixbuf renderer = (CellRendererPixbuf) cell;
+                if(PlayerEngineCore.ActivePlayer.Track.Equals(ti)) {
+                    renderer.Pixbuf = nowPlayingPixbuf;
+                } else {
+                    renderer.Pixbuf = ti.CanPlay ? null : songDrmedPixbuf;
+                }
             }
-            
-            renderer.Pixbuf = iter.Equals(model.PlayingIter)
-                ? nowPlayingPixbuf
-                : (ti.CanPlay ? null : songDrmedPixbuf);
         }
         
         protected void RipCellInd(TreeViewColumn tree_column, CellRenderer cell, 
@@ -469,7 +469,6 @@
         
         public void UpdateView()
         {
-            model.SyncPlayingIter();
             QueueDraw();
             ScrollToPlaying();
         }


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