banshee r3750 - in trunk/banshee: . src/Clients/Nereid/Nereid src/Core/Banshee.Services/Banshee.Collection.Database src/Core/Banshee.ThickClient/Banshee.Collection.Gui src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView



Author: gburt
Date: Thu Apr 10 11:03:02 2008
New Revision: 3750
URL: http://svn.gnome.org/viewvc/banshee?rev=3750&view=rev

Log:
2008-04-10  Gabriel Burt  <gabriel burt gmail com>

	* src/Clients/Nereid/Nereid/PlayerInterface.cs:
	* src/Core/Banshee.ThickClient/Banshee.Collection.Gui/AlbumListView.cs:
	* src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ArtistListView.cs:
	Call Next () instead of First () when source/artist/album activated, so that
	random works.  Fixes BGO #527218.

	* src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackListModel.cs:
	Lock around Reload, GetRandom, and this[] to avoid refresh race.  Fixes
	BGO #525031.

	* src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs:
	Fix bug with double clicking on an item not activating it every other
	time.


Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Clients/Nereid/Nereid/PlayerInterface.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackListModel.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/AlbumListView.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ArtistListView.cs
   trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs

Modified: trunk/banshee/src/Clients/Nereid/Nereid/PlayerInterface.cs
==============================================================================
--- trunk/banshee/src/Clients/Nereid/Nereid/PlayerInterface.cs	(original)
+++ trunk/banshee/src/Clients/Nereid/Nereid/PlayerInterface.cs	Thu Apr 10 11:03:02 2008
@@ -250,7 +250,7 @@
             source_view.RowActivated += delegate {
                 SetPlaybackControllerSource (ServiceManager.SourceManager.ActiveSource);
                 if (GtkUtilities.NoImportantModifiersAreSet (Gdk.ModifierType.ControlMask)) {
-                    ServiceManager.PlaybackController.First ();
+                    ServiceManager.PlaybackController.Next ();
                 }
             };
             

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackListModel.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackListModel.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackListModel.cs	Thu Apr 10 11:03:02 2008
@@ -208,47 +208,49 @@
 
         public void Reload (ReloadTrigger trigger)
         {
-            bool artist_reloaded = false, album_reloaded = false;
-            GenerateFilterQueryPart ();
-
-            UpdateUnfilteredAggregates ();
-            cache.SaveSelection ();
-
-            if (trigger == ReloadTrigger.AlbumFilter) {
-                ReloadWithFilters ();
-            } else {
-                ReloadWithoutArtistAlbumFilters ();
-
-                if (artist_model != null && album_model != null) {
-                    if (trigger == ReloadTrigger.Query) {
-                        artist_reloaded = true;
-                        artist_model.Reload (false);
-                    }
+            lock (this) {
+                bool artist_reloaded = false, album_reloaded = false;
+                GenerateFilterQueryPart ();
+
+                UpdateUnfilteredAggregates ();
+                cache.SaveSelection ();
+
+                if (trigger == ReloadTrigger.AlbumFilter) {
+                    ReloadWithFilters ();
+                } else {
+                    ReloadWithoutArtistAlbumFilters ();
+
+                    if (artist_model != null && album_model != null) {
+                        if (trigger == ReloadTrigger.Query) {
+                            artist_reloaded = true;
+                            artist_model.Reload (false);
+                        }
 
-                    album_reloaded = true;
-                    album_model.Reload (false);
+                        album_reloaded = true;
+                        album_model.Reload (false);
 
-                    // Unless both artist/album selections are "all" (eg unfiltered), reload
-                    // the track model again with the artist/album filters now in place.
-                    if (!artist_model.Selection.AllSelected || !album_model.Selection.AllSelected) {
-                        ReloadWithFilters ();
+                        // Unless both artist/album selections are "all" (eg unfiltered), reload
+                        // the track model again with the artist/album filters now in place.
+                        if (!artist_model.Selection.AllSelected || !album_model.Selection.AllSelected) {
+                            ReloadWithFilters ();
+                        }
                     }
                 }
-            }
 
-            cache.UpdateAggregates ();
-            cache.RestoreSelection ();
+                cache.UpdateAggregates ();
+                cache.RestoreSelection ();
 
-            filtered_count = cache.Count;
+                filtered_count = cache.Count;
 
-            OnReloaded ();
+                OnReloaded ();
 
-            // Trigger these after the track list, b/c visually it's more important for it to update first
-            if (artist_reloaded)
-                artist_model.RaiseReloaded ();
+                // Trigger these after the track list, b/c visually it's more important for it to update first
+                if (artist_reloaded)
+                    artist_model.RaiseReloaded ();
 
-            if (album_reloaded)
-                album_model.RaiseReloaded ();
+                if (album_reloaded)
+                    album_model.RaiseReloaded ();
+            }
         }
 
         private void ReloadWithoutArtistAlbumFilters ()
@@ -315,25 +317,31 @@
         private static string random_fragment = "AND (LastPlayedStamp < ? OR LastPlayedStamp IS NULL) AND (LastSkippedStamp < ? OR LastSkippedStamp IS NULL) ORDER BY RANDOM()";
         public override TrackInfo GetRandom (DateTime notPlayedSince, bool repeat)
         {
-            if (Count == 0)
-                return null;
-
-            if (random_began_at < notPlayedSince)
-                random_began_at = last_random = notPlayedSince;
-
-            TrackInfo track = cache.GetSingle (random_fragment, random_began_at, random_began_at);
+            lock (this) {
+                if (Count == 0)
+                    return null;
+
+                if (random_began_at < notPlayedSince)
+                    random_began_at = last_random = notPlayedSince;
+
+                TrackInfo track = cache.GetSingle (random_fragment, random_began_at, random_began_at);
+
+                if (track == null && repeat) {
+                    random_began_at = last_random;
+                    track = cache.GetSingle (random_fragment, random_began_at, random_began_at);
+                }
 
-            if (track == null && repeat) {
-                random_began_at = last_random;
-                track = cache.GetSingle (random_fragment, random_began_at, random_began_at);
+                last_random = DateTime.Now;
+                return track;
             }
-
-            last_random = DateTime.Now;
-            return track;
         }
 
         public override TrackInfo this[int index] {
-            get { return cache.GetValue (index); }
+            get {
+                lock (this) {
+                    return cache.GetValue (index);
+                }
+            }
         }
 
         public override int Count {

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/AlbumListView.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/AlbumListView.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/AlbumListView.cs	Thu Apr 10 11:03:02 2008
@@ -53,7 +53,7 @@
             
             RowActivated += delegate {
                 ServiceManager.PlaybackController.Source = (ServiceManager.SourceManager.ActiveSource as Banshee.Sources.ITrackModelSource);
-                ServiceManager.PlaybackController.First ();
+                ServiceManager.PlaybackController.Next ();
             };
         }
 

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ArtistListView.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ArtistListView.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ArtistListView.cs	Thu Apr 10 11:03:02 2008
@@ -49,7 +49,7 @@
             
             RowActivated += delegate {
                 ServiceManager.PlaybackController.Source = (ServiceManager.SourceManager.ActiveSource as Banshee.Sources.ITrackModelSource);
-                ServiceManager.PlaybackController.First ();
+                ServiceManager.PlaybackController.Next ();
             };
         }
 

Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs	Thu Apr 10 11:03:02 2008
@@ -37,7 +37,6 @@
 {
     public partial class ListView<T> : Container
     {
-        private int last_click_row_index = -1;
         private int focused_row_index = -1;
 
         private Adjustment vadjustment;
@@ -267,10 +266,8 @@
                 return true;
             }
 
-            if (evnt.Button == 1 && evnt.Type == Gdk.EventType.TwoButtonPress && 
-                row_index == last_click_row_index) {
+            if (evnt.Button == 1 && evnt.Type == Gdk.EventType.TwoButtonPress) {
                 OnRowActivated ();
-                last_click_row_index = -1;
             } else {
                 if ((evnt.State & Gdk.ModifierType.ControlMask) != 0) {
                     if (evnt.Button == 3) {
@@ -297,10 +294,7 @@
                 FocusRow (row_index);
 
                 if (evnt.Button == 3) {
-                    last_click_row_index = -1;
                     OnPopupMenu ();
-                } else {
-                    last_click_row_index = row_index;
                 }
             }
             



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