banshee r3294 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Collection.Database src/Core/Banshee.Services/Banshee.Database src/Core/Banshee.Services/Banshee.Library src/Core/Banshee.Services/Banshee.Sources src/Core/Banshee.ThickClient/Banshee.Gui src/Core/Banshee.ThickClient/Resources src/Libraries/Hyena/Hyena
- From: gburt svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r3294 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Collection.Database src/Core/Banshee.Services/Banshee.Database src/Core/Banshee.Services/Banshee.Library src/Core/Banshee.Services/Banshee.Sources src/Core/Banshee.ThickClient/Banshee.Gui src/Core/Banshee.ThickClient/Resources src/Libraries/Hyena/Hyena
- Date: Thu, 21 Feb 2008 19:16:39 +0000 (GMT)
Author: gburt
Date: Thu Feb 21 19:16:39 2008
New Revision: 3294
URL: http://svn.gnome.org/viewvc/banshee?rev=3294&view=rev
Log:
2008-02-21 Gabriel Burt <gabriel burt gmail com>
* src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs:
Add DateUpdated property and update it in Save method.
* src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs:
Rename DiscNumber to Disc to avoid automatic column creation. Fix issue
with DateUpdatedStamp not being created, and use DateAdded as its default
value for migrated tracks.
* src/Core/Banshee.Services/Banshee.Library/LibraryImportManager.cs: Use
the Source property on DatabaseTrackInfo instead of SourceId. Remove
reload call to Library since it saving the tracks automatically triggers
it now.
* src/Core/Banshee.Services/Banshee.Sources/DatabaseSource.cs: Increase
minimum time between reloads.
* src/Core/Banshee.Services/Banshee.Sources/ErrorSource.cs: Implement
IUnmapableSource.
* src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs: Add
TracksUpdated event.
* src/Core/Banshee.ThickClient/Banshee.Gui/TrackActions.cs: Try to popdown
the menu before rating.
* src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml: Add
custom context menu for ErrorSource.
* src/Libraries/Hyena/Hyena/Log.cs: Make log type string all the same
length so they line up better.
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Library/LibraryImportManager.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/DatabaseSource.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/ErrorSource.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/TrackActions.cs
trunk/banshee/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml
trunk/banshee/src/Libraries/Hyena/Hyena/Log.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 Thu Feb 21 19:16:39 2008
@@ -36,6 +36,7 @@
using Banshee.Base;
using Banshee.Configuration.Schema;
using Banshee.Database;
+using Banshee.Sources;
using Banshee.IO;
using Banshee.ServiceStack;
@@ -70,7 +71,9 @@
public override void Save ()
{
+ DateUpdated = DateTime.Now;
Provider.Save (this);
+ Source.OnTracksUpdated ();
}
[DatabaseColumn ("TrackID", Constraints = DatabaseColumnConstraints.PrimaryKey)]
@@ -83,7 +86,11 @@
private int source_id;
public int SourceId {
get { return source_id; }
- set { source_id = value; }
+ }
+
+ public PrimarySource Source {
+ get { return PrimarySource.GetById (source_id); }
+ set { source_id = value.SourceId; }
}
[DatabaseColumn ("ArtistID", Index = "CoreTracksArtistIndex")]
@@ -263,6 +270,13 @@
set { base.DateAdded = value; }
}
+ private DateTime date_updated;
+ [DatabaseColumn ("DateUpdatedStamp")]
+ public DateTime DateUpdated {
+ get { return date_updated; }
+ set { date_updated = value; }
+ }
+
private static HyenaSqliteCommand check_command = new HyenaSqliteCommand (
"SELECT COUNT(*) FROM CoreTracks WHERE Uri = ? OR Uri = ?"
);
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs Thu Feb 21 19:16:39 2008
@@ -273,7 +273,7 @@
Title TEXT,
TrackNumber INTEGER,
TrackCount INTEGER,
- DiscNumber INTEGER,
+ Disc INTEGER,
Duration INTEGER,
Year INTEGER,
Genre TEXT,
@@ -282,7 +282,7 @@
PlayCount INTEGER,
SkipCount INTEGER,
LastPlayedStamp INTEGER,
- DateAddedStamp INTEGER
+ DateAddedStamp INTEGER,
DateUpdatedStamp INTEGER
)
");
@@ -430,6 +430,7 @@
NumberOfPlays,
0,
LastPlayedStamp,
+ DateAddedStamp,
DateAddedStamp
FROM Tracks
");
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Library/LibraryImportManager.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Library/LibraryImportManager.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Library/LibraryImportManager.cs Thu Feb 21 19:16:39 2008
@@ -82,18 +82,12 @@
path.Substring (index + 1).ToLower ()) >= 0;
}
- private int library_source_id;
-
public LibraryImportManager ()
{
}
protected override void OnImportRequested (string path)
{
- if (library_source_id == 0) {
- library_source_id = ServiceManager.SourceManager.Library.SourceId;
- }
-
if (!IsWhiteListedFile (path)) {
IncrementProcessedCount (null);
return;
@@ -142,9 +136,8 @@
artist.Save ();
- track.SourceId = library_source_id;
+ track.Source = ServiceManager.SourceManager.Library;
track.Save ();
- ServiceManager.SourceManager.Library.Reload (200);
});
return track;
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/DatabaseSource.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/DatabaseSource.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/DatabaseSource.cs Thu Feb 21 19:16:39 2008
@@ -139,7 +139,7 @@
public void Reload ()
{
- reload_limiter.Execute (50.0);
+ reload_limiter.Execute (100.0);
}
protected virtual void RateLimitedReload ()
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/ErrorSource.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/ErrorSource.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/ErrorSource.cs Thu Feb 21 19:16:39 2008
@@ -36,7 +36,7 @@
namespace Banshee.Sources
{
- public class ErrorSource : Source, IObjectListModel
+ public class ErrorSource : Source, IObjectListModel, IUnmapableSource
{
private List<Message> messages = new List<Message> ();
private Selection selection = new Selection ();
@@ -47,6 +47,15 @@
public ErrorSource (string name) : base (name, name, 0)
{
Properties.SetStringList ("Icon.Name", "dialog-error", "gtk-dialog-error");
+ Properties.SetString ("UnmapSourceActionLabel", Catalog.GetString ("Close Error Report"));
+ Properties.SetString ("GtkActionPath", "/ErrorSourceContextMenu");
+ }
+
+ public bool Unmap ()
+ {
+ Clear ();
+ Parent.RemoveChildSource (this);
+ return true;
}
private void OnReloaded ()
@@ -116,6 +125,18 @@
public override bool CanSearch {
get { return false; }
}
+
+ public override bool CanRename {
+ get { return false; }
+ }
+
+ public virtual bool CanUnmap {
+ get { return true; }
+ }
+
+ public bool ConfirmBeforeUnmap {
+ get { return false; }
+ }
public object this[int index] {
get {
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs Thu Feb 21 19:16:39 2008
@@ -46,6 +46,7 @@
{
protected ErrorSource error_source = new ErrorSource (Catalog.GetString ("Import Errors"));
protected bool error_source_visible = false;
+ protected RateLimiter tracks_updated_limiter;
protected HyenaSqliteCommand remove_range_command = new HyenaSqliteCommand (@"
DELETE FROM CoreTracks WHERE TrackID IN
@@ -70,6 +71,18 @@
get { return source_id; }
}
+ public ErrorSource ErrorSource {
+ get { return error_source; }
+ }
+
+ public event EventHandler TracksUpdated;
+
+ private static Dictionary<int, PrimarySource> primary_sources = new Dictionary<int, PrimarySource> ();
+ public static PrimarySource GetById (int id)
+ {
+ return (primary_sources.ContainsKey (id)) ? primary_sources[id] : null;
+ }
+
protected PrimarySource (string generic_name, string name, string id, int order) : base (generic_name, name, id, order)
{
source_id = ServiceManager.DbConnection.Query<int> ("SELECT SourceID FROM CorePrimarySources WHERE StringID = ?", id);
@@ -80,10 +93,35 @@
track_model.Condition = String.Format ("CoreTracks.SourceID = {0}", source_id);;
error_source.Updated += OnErrorSourceUpdated;
OnErrorSourceUpdated (null, null);
+
+ tracks_updated_limiter = new RateLimiter (50.0, RateLimitedOnTracksUpdated);
+
+ primary_sources[source_id] = this;
}
- public ErrorSource ErrorSource {
- get { return error_source; }
+ public void OnTracksUpdated ()
+ {
+ tracks_updated_limiter.Execute ();
+ }
+
+ protected virtual void RateLimitedOnTracksUpdated ()
+ {
+ Reload ();
+
+ EventHandler handler = TracksUpdated;
+ if (handler != null) {
+ handler (this, EventArgs.Empty);
+ }
+ }
+
+ protected override void RateLimitedReload ()
+ {
+ base.RateLimitedReload ();
+ foreach (Source child in Children) {
+ if (child is ITrackModelSource) {
+ (child as ITrackModelSource).Reload ();
+ }
+ }
}
protected void OnErrorSourceUpdated (object o, EventArgs args)
@@ -102,7 +140,6 @@
remove_track_command.ApplyValues (track.DbId);
ServiceManager.DbConnection.Execute (remove_track_command);
Reload ();
- ReloadChildren ();
}
/*public override void RemoveTracks (IEnumerable<TrackInfo> tracks)
@@ -129,15 +166,8 @@
// Reload the library, all playlists, etc
Reload ();
- ReloadChildren ();
}*/
- public override void RemoveSelectedTracks (TrackListDatabaseModel model)
- {
- base.RemoveSelectedTracks (model);
- ReloadChildren ();
- }
-
protected override void RemoveTrackRange (TrackListDatabaseModel model, RangeCollection.Range range)
{
remove_range_command.ApplyValues (
@@ -147,20 +177,5 @@
);
ServiceManager.DbConnection.Execute (remove_range_command);
}
-
- public override void DeleteSelectedTracks (TrackListDatabaseModel model)
- {
- base.DeleteSelectedTracks (model);
- ReloadChildren ();
- }
-
- private void ReloadChildren ()
- {
- foreach (Source child in Children) {
- if (child is ITrackModelSource) {
- (child as ITrackModelSource).Reload ();
- }
- }
- }
}
}
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/TrackActions.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/TrackActions.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/TrackActions.cs Thu Feb 21 19:16:39 2008
@@ -372,10 +372,20 @@
private void OnRateTracks (object o, EventArgs args)
{
+ foreach (Widget proxy in (o as Gtk.Action).Proxies) {
+ Menu menu = proxy.Parent as Menu;
+ if (menu != null && menu.Visible) {
+ menu.Popdown ();
+ menu.Hide ();
+ }
+ }
+
int rating = rating_proxy.LastRating;
foreach (TrackInfo track in TrackSelector.GetSelectedTracks ()) {
- track.Rating = rating;
- track.Save ();
+ if (track != null) {
+ track.Rating = rating;
+ track.Save ();
+ }
}
}
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml Thu Feb 21 19:16:39 2008
@@ -104,6 +104,10 @@
</menu>
</popup>
+ <popup name="ErrorSourceContextMenu" action="ErrorSourceContextMenuAction">
+ <menuitem name="UnmapSource" action="UnmapSourceAction"/>
+ </popup>
+
<popup name="SourceContextMenu" action="SourceContextMenuAction">
<menuitem name="ImportSource" action="ImportSourceAction"/>
<separator/>
Modified: trunk/banshee/src/Libraries/Hyena/Hyena/Log.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena/Hyena/Log.cs (original)
+++ trunk/banshee/src/Libraries/Hyena/Hyena/Log.cs Thu Feb 21 19:16:39 2008
@@ -114,7 +114,7 @@
case LogEntryType.Debug: Console.ForegroundColor = ConsoleColor.Blue; break;
}
- Console.Write ("[{0} {1:00}:{2:00}:{3:00}.{4:000}]", type, DateTime.Now.Hour,
+ Console.Write ("[{0} {1:00}:{2:00}:{3:00}.{4:000}]", TypeString (type), DateTime.Now.Hour,
DateTime.Now.Minute, DateTime.Now.Second, DateTime.Now.Millisecond);
Console.ResetColor ();
@@ -130,6 +130,17 @@
OnNotify (new LogEntry (type, message, details));
}
}
+
+ private static string TypeString (LogEntryType type)
+ {
+ switch (type) {
+ case LogEntryType.Debug: return "Debug";
+ case LogEntryType.Warning: return "Warn ";
+ case LogEntryType.Error: return "Error";
+ case LogEntryType.Information: return "Info ";
+ }
+ return null;
+ }
private static void OnNotify (LogEntry entry)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]