banshee r4661 - in trunk/banshee: . src/Libraries/Hyena src/Libraries/Hyena/Hyena.Query



Author: gburt
Date: Mon Oct  6 21:15:50 2008
New Revision: 4661
URL: http://svn.gnome.org/viewvc/banshee?rev=4661&view=rev

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

	* src/Libraries/Hyena/Hyena.csproj: Ref System.Xml

	* src/Libraries/Hyena/Hyena.Query/FileSizeQueryValue.cs:
	* src/Libraries/Hyena/Hyena.Query/RelativeTimeSpanQueryValue.cs:
	* src/Libraries/Hyena/Hyena.Query/TimeSpanQueryValue.cs:  Persist and read
	the factor to/from XML, so we remember if the user chose '45 days' and
	no longer turn it into 1.5 months the next time they edit a smart
	playlist (BGO #545887).



Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Libraries/Hyena/Hyena.Query/FileSizeQueryValue.cs
   trunk/banshee/src/Libraries/Hyena/Hyena.Query/RelativeTimeSpanQueryValue.cs
   trunk/banshee/src/Libraries/Hyena/Hyena.Query/TimeSpanQueryValue.cs
   trunk/banshee/src/Libraries/Hyena/Hyena.csproj

Modified: trunk/banshee/src/Libraries/Hyena/Hyena.Query/FileSizeQueryValue.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena/Hyena.Query/FileSizeQueryValue.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena/Hyena.Query/FileSizeQueryValue.cs	Mon Oct  6 21:15:50 2008
@@ -95,7 +95,17 @@
         public override void ParseXml (XmlElement node)
         {
             base.ParseUserQuery (node.InnerText);
-            DetermineFactor ();
+            if (node.HasAttribute ("factor")) {
+                this.factor = (FileSizeFactor) Enum.Parse (typeof(FileSizeFactor), node.GetAttribute ("factor"));
+            } else {
+                DetermineFactor ();
+            }
+        }
+
+        public override void AppendXml (XmlElement node)
+        {
+            base.AppendXml (node);
+            node.SetAttribute ("factor", factor.ToString ());
         }
 
         public void SetValue (double value, FileSizeFactor factor)

Modified: trunk/banshee/src/Libraries/Hyena/Hyena.Query/RelativeTimeSpanQueryValue.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena/Hyena.Query/RelativeTimeSpanQueryValue.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena/Hyena.Query/RelativeTimeSpanQueryValue.cs	Mon Oct  6 21:15:50 2008
@@ -73,8 +73,8 @@
 
         public override void AppendXml (XmlElement node)
         {
+            base.AppendXml (node);
             node.SetAttribute ("type", "rel");
-            node.InnerText = Value.ToString ();
         }
 
         public override string ToSql ()

Modified: trunk/banshee/src/Libraries/Hyena/Hyena.Query/TimeSpanQueryValue.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena/Hyena.Query/TimeSpanQueryValue.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena/Hyena.Query/TimeSpanQueryValue.cs	Mon Oct  6 21:15:50 2008
@@ -117,7 +117,6 @@
         {
             this.factor = factor;
             this.offset = (long) (offset * (double)factor);
-            DetermineFactor ();
             IsEmpty = false;
         }
 
@@ -145,11 +144,20 @@
         {
             try {
                 LoadString (node.InnerText);
+                if (node.HasAttribute ("factor")) {
+                    this.factor = (TimeFactor) Enum.Parse (typeof(TimeFactor), node.GetAttribute ("factor"));
+                }
             } catch {
                 IsEmpty = true;
             }
         }
 
+        public override void AppendXml (XmlElement node)
+        {
+            base.AppendXml (node);
+            node.SetAttribute ("factor", factor.ToString ());
+        }
+
         public override string ToSql ()
         {
             return Convert.ToString (offset * 1000, System.Globalization.CultureInfo.InvariantCulture);

Modified: trunk/banshee/src/Libraries/Hyena/Hyena.csproj
==============================================================================
--- trunk/banshee/src/Libraries/Hyena/Hyena.csproj	(original)
+++ trunk/banshee/src/Libraries/Hyena/Hyena.csproj	Mon Oct  6 21:15:50 2008
@@ -24,6 +24,7 @@
     <Reference Include="System.Data" />
     <Reference Include="Mono.Data.Sqlite" />
     <Reference Include="nunit.core, Version=2.2.0.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77" />
+    <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
     <Compile Include="Hyena.Data\ICareAboutView.cs" />



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