banshee r3622 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Collection.Database src/Core/Banshee.ThickClient/Banshee.Gui src/Libraries/Hyena/Hyena.Data.Sqlite
- From: gburt svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r3622 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Collection.Database src/Core/Banshee.ThickClient/Banshee.Gui src/Libraries/Hyena/Hyena.Data.Sqlite
- Date: Mon, 31 Mar 2008 20:55:56 +0100 (BST)
Author: gburt
Date: Mon Mar 31 20:55:56 2008
New Revision: 3622
URL: http://svn.gnome.org/viewvc/banshee?rev=3622&view=rev
Log:
2008-03-31 Gabriel Burt <gabriel burt gmail com>
* src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs:
Before incrementing play/skip count, Refresh the track so we don't
overwrite any changes that have been made since it started playing. Fixes
BGO #525061.
* src/Core/Banshee.ThickClient/Banshee.Gui/PlaybackActions.cs: Remove
debug WriteLine.
* src/Libraries/Hyena/Hyena.Data.Sqlite/SqliteModelProvider.cs: Add
Refresh method that takes an object and reloads its data from the database.
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/PlaybackActions.cs
trunk/banshee/src/Libraries/Hyena/Hyena.Data.Sqlite/SqliteModelProvider.cs
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs Mon Mar 31 20:55:56 2008
@@ -73,14 +73,18 @@
public override void IncrementPlayCount ()
{
- base.IncrementPlayCount ();
- Save ();
+ if (Provider.Refresh (this)) {
+ base.IncrementPlayCount ();
+ Save ();
+ }
}
public override void IncrementSkipCount ()
{
- base.IncrementSkipCount ();
- Save ();
+ if (Provider.Refresh (this)) {
+ base.IncrementSkipCount ();
+ Save ();
+ }
}
public override bool TrackEqual (TrackInfo track)
@@ -139,7 +143,6 @@
get { return track_id; }
}
-
[DatabaseColumn ("PrimarySourceID")]
private int primary_source_id;
public int PrimarySourceId {
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/PlaybackActions.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/PlaybackActions.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/PlaybackActions.cs Mon Mar 31 20:55:56 2008
@@ -220,9 +220,9 @@
int i = track_src.TrackModel.IndexOf (ServiceManager.PlaybackController.CurrentTrack);
if (i != -1) {
// TODO clear the search/filters if there are any, since they might be hiding the currently playing item?
+ // and/or switch to the track's primary source? what if it's been removed from the library all together?
IListView<TrackInfo> track_list = (track_src as Source).Properties.Get<IListView<TrackInfo>> ("Track.IListView");
if (track_list != null) {
- Console.WriteLine ("playing track is index {0}, jumping!", i);
ServiceManager.SourceManager.SetActiveSource (playback_src);
track_src.TrackModel.Selection.Clear (false);
track_src.TrackModel.Selection.Select (i);
Modified: trunk/banshee/src/Libraries/Hyena/Hyena.Data.Sqlite/SqliteModelProvider.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena/Hyena.Data.Sqlite/SqliteModelProvider.cs (original)
+++ trunk/banshee/src/Libraries/Hyena/Hyena.Data.Sqlite/SqliteModelProvider.cs Mon Mar 31 20:55:56 2008
@@ -361,6 +361,25 @@
}
return default(T);
}
+
+ public bool Refresh (T item)
+ {
+ if (key == null || item == null)
+ return false;
+
+ int id = (int) key.GetValue (item);
+ if (id < 1)
+ return false;
+
+ PrepareSelectSingleCommand (id);
+ using (IDataReader reader = connection.Query (SelectSingleCommand)) {
+ if (reader.Read ()) {
+ Load (reader, item);
+ return true;
+ }
+ }
+ return false;
+ }
protected virtual HyenaSqliteCommand CreateCommand {
get {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]