banshee r4421 - in branches/banshee/abock: . src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor



Author: abock
Date: Sat Aug 23 00:43:10 2008
New Revision: 4421
URL: http://svn.gnome.org/viewvc/banshee?rev=4421&view=rev

Log:
2008-08-22  Aaron Bockover  <abock gnome org>

    * src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/GenreEntry.cs:
    Use QueryEnumerable

    * src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/StatisticsPage.cs:
    Some cleanup



Modified:
   branches/banshee/abock/ChangeLog
   branches/banshee/abock/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/GenreEntry.cs
   branches/banshee/abock/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/StatisticsPage.cs

Modified: branches/banshee/abock/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/GenreEntry.cs
==============================================================================
--- branches/banshee/abock/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/GenreEntry.cs	(original)
+++ branches/banshee/abock/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/GenreEntry.cs	Sat Aug 23 00:43:10 2008
@@ -27,8 +27,6 @@
 //
 
 using System;
-using System.Data;
-
 using Gtk;
 
 using Banshee.ServiceStack;
@@ -46,11 +44,8 @@
             Model = genre_model;
             TextColumn = 0;
         
-            IDataReader reader = ServiceManager.DbConnection.Query (
-                "SELECT DISTINCT Genre FROM CoreTracks ORDER BY Genre");
-                
-            while (reader != null && reader.Read ()) {
-                string genre = reader[0] as string;
+            foreach (string genre in ServiceManager.DbConnection.QueryEnumerable<string> (
+                "SELECT DISTINCT Genre FROM CoreTracks ORDER BY Genre")) {
                 if (!String.IsNullOrEmpty (genre)) {
                     genre_model.AppendValues (genre);
                 }

Modified: branches/banshee/abock/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/StatisticsPage.cs
==============================================================================
--- branches/banshee/abock/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/StatisticsPage.cs	(original)
+++ branches/banshee/abock/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/StatisticsPage.cs	Sat Aug 23 00:43:10 2008
@@ -109,10 +109,13 @@
             if (file != null) {
                 System.Text.StringBuilder builder = new System.Text.StringBuilder ();
                 Banshee.Sources.DurationStatusFormatters.ConfusingPreciseFormatter (builder, file.Properties.Duration);
-                AddItem (Catalog.GetString ("Duration:"), String.Format ("{0} ({1}ms)", builder, file.Properties.Duration.TotalMilliseconds));
+                AddItem (Catalog.GetString ("Duration:"), String.Format ("{0} ({1}ms)", 
+                    builder, file.Properties.Duration.TotalMilliseconds));
                 
-                AddItem (Catalog.GetString ("Audio Bitrate:"), String.Format ("{0} KB/sec", file.Properties.AudioBitrate));
-                AddItem (Catalog.GetString ("Audio Sample Rate:"), String.Format ("{0} Hz", file.Properties.AudioSampleRate)); 
+                AddItem (Catalog.GetString ("Audio Bitrate:"), String.Format ("{0} KB/sec", 
+                    file.Properties.AudioBitrate));
+                AddItem (Catalog.GetString ("Audio Sample Rate:"), String.Format ("{0} Hz", 
+                    file.Properties.AudioSampleRate)); 
                 AddItem (Catalog.GetString ("Audio Channels:"), file.Properties.AudioChannels);
                 
                 if ((file.Properties.MediaTypes & TagLib.MediaTypes.Video) != 0) {
@@ -121,16 +124,20 @@
                 }
                 
                 foreach (TagLib.ICodec codec in file.Properties.Codecs) {
-                    AddItem (String.Format (Catalog.GetString ("{0} Codec:"), codec.MediaTypes.ToString ()), codec.Description);
+                    AddItem (String.Format (Catalog.GetString ("{0} Codec:"), 
+                        codec.MediaTypes.ToString ()), codec.Description);
                 }
                 
                 AddItem ("Container Formats:", file.TagTypes.ToString ());
                 AddSeparator ();
             }
             
-            AddItem (Catalog.GetString ("Imported On:"), track.DateAdded > DateTime.MinValue ? track.DateAdded.ToString () : Catalog.GetString ("Unknown"));
-            AddItem (Catalog.GetString ("Last Played:"), track.LastPlayed > DateTime.MinValue ? track.LastPlayed.ToString () : Catalog.GetString ("Unknown"));
-            AddItem (Catalog.GetString ("Last Skipped:"), track.LastSkipped > DateTime.MinValue ? track.LastSkipped.ToString () : Catalog.GetString ("Unknown"));
+            AddItem (Catalog.GetString ("Imported On:"), track.DateAdded > DateTime.MinValue 
+                ? track.DateAdded.ToString () : Catalog.GetString ("Unknown"));
+            AddItem (Catalog.GetString ("Last Played:"), track.LastPlayed > DateTime.MinValue 
+                ? track.LastPlayed.ToString () : Catalog.GetString ("Unknown"));
+            AddItem (Catalog.GetString ("Last Skipped:"), track.LastSkipped > DateTime.MinValue 
+                ? track.LastSkipped.ToString () : Catalog.GetString ("Unknown"));
             AddItem (Catalog.GetString ("Play Count:"), track.PlayCount);
             AddItem (Catalog.GetString ("Skip Count:"), track.SkipCount);
         }



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