banshee r4234 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Collection src/Core/Banshee.Services/Banshee.Collection.Database src/Core/Banshee.Services/Banshee.Query src/Core/Banshee.ThickClient/Banshee.Gui src/Libraries/Hyena/Hyena.Query



Author: gburt
Date: Mon Jul 21 00:05:30 2008
New Revision: 4234
URL: http://svn.gnome.org/viewvc/banshee?rev=4234&view=rev

Log:
2008-07-20  Gabriel Burt  <gabriel burt gmail com>

	* src/Core/Banshee.ThickClient/Banshee.Gui/TrackActions.cs: Add curlies.

	* src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseArtistListModel.cs:
	Fix whitespace.

	* src/Core/Banshee.Services/Banshee.Collection/IFilterListModel.cs:
	* src/Core/Banshee.Services/Banshee.Collection/FilterListModel.cs: Add
	FilterName and FilterLabel properties that will be used in making the
	filters configurable.

	* src/Core/Banshee.Services/Banshee.Query/BansheeQuery.cs: Add TODO
	comment, and get rid of static ctor where we set the labels for the
	QueryValue operators (they are set in Hyena now).

	* src/Libraries/Hyena/Hyena.Query/IntegerQueryValue.cs:
	* src/Libraries/Hyena/Hyena.Query/QueryOperator.cs:
	* src/Libraries/Hyena/Hyena.Query/StringQueryValue.cs:
	* src/Libraries/Hyena/Hyena.Query/NullQueryValue.cs:
	* src/Libraries/Hyena/Hyena.Query/RelativeTimeSpanQueryValue.cs:
	* src/Libraries/Hyena/Hyena.Query/DateQueryValue.cs: Set the translated
	labels for the operators in their ctors.



Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseArtistListModel.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.Collection/FilterListModel.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.Collection/IFilterListModel.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.Query/BansheeQuery.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/TrackActions.cs
   trunk/banshee/src/Libraries/Hyena/Hyena.Query/DateQueryValue.cs
   trunk/banshee/src/Libraries/Hyena/Hyena.Query/IntegerQueryValue.cs
   trunk/banshee/src/Libraries/Hyena/Hyena.Query/NullQueryValue.cs
   trunk/banshee/src/Libraries/Hyena/Hyena.Query/QueryOperator.cs
   trunk/banshee/src/Libraries/Hyena/Hyena.Query/RelativeTimeSpanQueryValue.cs
   trunk/banshee/src/Libraries/Hyena/Hyena.Query/StringQueryValue.cs

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseArtistListModel.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseArtistListModel.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseArtistListModel.cs	Mon Jul 21 00:05:30 2008
@@ -41,7 +41,7 @@
 {
     public class DatabaseArtistListModel : DatabaseFilterListModel<DatabaseArtistInfo, ArtistInfo>
     {
-        public DatabaseArtistListModel ( Banshee.Sources.DatabaseSource source, DatabaseTrackListModel trackModel, BansheeDbConnection connection, string uuid) 
+        public DatabaseArtistListModel (Banshee.Sources.DatabaseSource source, DatabaseTrackListModel trackModel, BansheeDbConnection connection, string uuid) 
             : base (source, trackModel, connection, DatabaseArtistInfo.Provider, new ArtistInfo (null), uuid)
         {
             ReloadFragmentFormat = @"

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Collection/FilterListModel.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Collection/FilterListModel.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Collection/FilterListModel.cs	Mon Jul 21 00:05:30 2008
@@ -68,21 +68,6 @@
         
         public abstract void Reload (bool notify);
         
-        /*protected virtual void GenerateReloadFragment ()
-        {
-            ReloadFragment = String.Format (
-                ReloadFragmentFormat,
-                browsing_model.CachesJoinTableEntries ? browsing_model.JoinFragment : null,
-                browsing_model.CacheId,
-                browsing_model.CachesJoinTableEntries
-                    ? String.Format (
-                        "{0}.{1} AND CoreTracks.TrackID = {0}.{2}",
-                        browsing_model.JoinTable, browsing_model.JoinPrimaryKey, browsing_model.JoinColumn
-                    ) : "CoreTracks.TrackID",
-                GetFilterFragment ()
-            );
-        }*/
-        
         private void HandleSelectionChanged (object sender, EventArgs args)
         {
             browsing_model.Reload (this);
@@ -91,9 +76,19 @@
 #region IFilterModel Implementation
 
         public abstract string GetSqlFilter ();
+        
+        private string filter_name;
+        public string FilterName {
+            get { return filter_name; }
+            protected set { filter_name = value; }
+        }
+        
+        private string filter_label;
+        public string FilterLabel {
+            get { return filter_label; }
+            protected set { filter_label = value; }
+        }
 
 #endregion
-        
-        //public abstract void RaiseReloaded ();
     }
 }

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Collection/IFilterListModel.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Collection/IFilterListModel.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Collection/IFilterListModel.cs	Mon Jul 21 00:05:30 2008
@@ -36,5 +36,7 @@
         string GetSqlFilter ();
         void RaiseReloaded ();
         void Reload (bool notify);
+        string FilterName { get; }
+        string FilterLabel { get; }
     }
 }
\ No newline at end of file

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Query/BansheeQuery.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Query/BansheeQuery.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Query/BansheeQuery.cs	Mon Jul 21 00:05:30 2008
@@ -235,6 +235,7 @@
         {
             string ascDesc = asc ? "ASC" : "DESC";
             string sort_query = null;
+            // TODO use the QueryFields here instead of matching on a string key
             switch(key) {
                 case "Track":
                     sort_query = String.Format (@"
@@ -325,34 +326,5 @@
         {
             return String.Format ("{0}-{1}", name, asc ? "ASC" : "DESC");
         }
-
-        static BansheeQuery () {
-            // Set translated names for operators
-            IntegerQueryValue.Equal.Label            = Catalog.GetString ("is");
-            IntegerQueryValue.NotEqual.Label         = Catalog.GetString ("is not");
-            IntegerQueryValue.LessThanEqual.Label    = Catalog.GetString ("at most");
-            IntegerQueryValue.GreaterThanEqual.Label = Catalog.GetString ("at least");
-            IntegerQueryValue.LessThan.Label         = Catalog.GetString ("less than");
-            IntegerQueryValue.GreaterThan.Label      = Catalog.GetString ("more than");
-
-            //DateQueryValue.Equal.Label               = Catalog.GetString ("is");
-            //DateQueryValue.NotEqual.Label            = Catalog.GetString ("is not");
-            //DateQueryValue.LessThanEqual.Label       = Catalog.GetString ("at most");
-            //DateQueryValue.GreaterThanEqual.Label    = Catalog.GetString ("at least");
-            DateQueryValue.LessThan.Label            = Catalog.GetString ("before");
-            DateQueryValue.GreaterThan.Label         = Catalog.GetString ("after");
-
-            RelativeTimeSpanQueryValue.GreaterThan.Label         = Catalog.GetString ("more than");
-            RelativeTimeSpanQueryValue.LessThan.Label            = Catalog.GetString ("less than");
-            RelativeTimeSpanQueryValue.GreaterThanEqual.Label    = Catalog.GetString ("at least");
-            RelativeTimeSpanQueryValue.LessThanEqual.Label       = Catalog.GetString ("at most");
-
-            StringQueryValue.Equal.Label             = Catalog.GetString ("is");
-            StringQueryValue.NotEqual.Label          = Catalog.GetString ("is not");
-            StringQueryValue.Contains.Label          = Catalog.GetString ("contains");
-            StringQueryValue.DoesNotContain.Label    = Catalog.GetString ("doesn't contain");
-            StringQueryValue.StartsWith.Label        = Catalog.GetString ("starts with");
-            StringQueryValue.EndsWith.Label          = Catalog.GetString ("ends with");
-        }
     }
 }

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	Mon Jul 21 00:05:30 2008
@@ -206,8 +206,9 @@
 
             if (selection != null) {
                 bool has_selection = selection.Count > 0;
-                foreach (string action in require_selection_actions)
+                foreach (string action in require_selection_actions) {
                     this[action].Sensitive = has_selection;
+                }
 
                 bool has_single_selection = selection.Count == 1;
 

Modified: trunk/banshee/src/Libraries/Hyena/Hyena.Query/DateQueryValue.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena/Hyena.Query/DateQueryValue.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena/Hyena.Query/DateQueryValue.cs	Mon Jul 21 00:05:30 2008
@@ -44,8 +44,8 @@
         //public static readonly Operator NotEqual           = new Operator ("notEqual", "!= {0}", true, "!=", "!:");
         //public static readonly Operator LessThanEqual      = new Operator ("lessThanEquals", "<= {0}", "<=");
         //public static readonly Operator GreaterThanEqual   = new Operator ("greaterThanEquals", ">= {0}", ">=");
-        public static readonly Operator LessThan           = new Operator ("lessThan", "< {0}", "<"); // Before
-        public static readonly Operator GreaterThan        = new Operator ("greaterThan", "> {0}", ">"); // After
+        public static readonly Operator LessThan           = new Operator ("lessThan", Catalog.GetString ("before"), "< {0}", "<");
+        public static readonly Operator GreaterThan        = new Operator ("greaterThan", Catalog.GetString ("after"), "> {0}", ">");
 
         protected DateTime value = DateTime.Now;
 

Modified: trunk/banshee/src/Libraries/Hyena/Hyena.Query/IntegerQueryValue.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena/Hyena.Query/IntegerQueryValue.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena/Hyena.Query/IntegerQueryValue.cs	Mon Jul 21 00:05:30 2008
@@ -30,18 +30,20 @@
 using System.Xml;
 using System.Text;
 
+using Mono.Unix;
+
 using Hyena;
 
 namespace Hyena.Query
 {
     public class IntegerQueryValue : QueryValue
     {
-        public static readonly Operator Equal              = new Operator ("equals", "= {0}", "=", "==", ":");
-        public static readonly Operator NotEqual           = new Operator ("notEqual", "!= {0}", true, "!=", "!:");
-        public static readonly Operator LessThanEqual      = new Operator ("lessThanEquals", "<= {0}", "<=");
-        public static readonly Operator GreaterThanEqual   = new Operator ("greaterThanEquals", ">= {0}", ">=");
-        public static readonly Operator LessThan           = new Operator ("lessThan", "< {0}", "<");
-        public static readonly Operator GreaterThan        = new Operator ("greaterThan", "> {0}", ">");
+        public static readonly Operator Equal              = new Operator ("equals", Catalog.GetString ("is"), "= {0}", "=", "==", ":");
+        public static readonly Operator NotEqual           = new Operator ("notEqual", Catalog.GetString ("is not"), "!= {0}", true, "!=", "!:");
+        public static readonly Operator LessThanEqual      = new Operator ("lessThanEquals", Catalog.GetString ("at most"), "<= {0}", "<=");
+        public static readonly Operator GreaterThanEqual   = new Operator ("greaterThanEquals", Catalog.GetString ("at least"), ">= {0}", ">=");
+        public static readonly Operator LessThan           = new Operator ("lessThan", Catalog.GetString ("less than"), "< {0}", "<");
+        public static readonly Operator GreaterThan        = new Operator ("greaterThan", Catalog.GetString ("more than"), "> {0}", ">");
 
         protected long value;
 

Modified: trunk/banshee/src/Libraries/Hyena/Hyena.Query/NullQueryValue.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena/Hyena.Query/NullQueryValue.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena/Hyena.Query/NullQueryValue.cs	Mon Jul 21 00:05:30 2008
@@ -30,13 +30,15 @@
 using System.Xml;
 using System.Text;
 
+using Mono.Unix;
+
 using Hyena;
 
 namespace Hyena.Query
 {
     public class NullQueryValue : QueryValue
     {
-        public static readonly Operator IsNullOrEmpty  = new Operator ("empty", "IN (NULL, '', 0)", true, "!");
+        public static readonly Operator IsNullOrEmpty  = new Operator ("empty", Catalog.GetString ("empty"), "IN (NULL, '', 0)", true, "!");
         
         public static readonly NullQueryValue Instance = new NullQueryValue ();
 

Modified: trunk/banshee/src/Libraries/Hyena/Hyena.Query/QueryOperator.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena/Hyena.Query/QueryOperator.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena/Hyena.Query/QueryOperator.cs	Mon Jul 21 00:05:30 2008
@@ -67,13 +67,14 @@
             get { return is_not; }
         }
         
-        internal Operator (string name, string sql_format, params string [] userOps) : this (name, sql_format, false, userOps)
+        internal Operator (string name, string label, string sql_format, params string [] userOps) : this (name, label, sql_format, false, userOps)
         {
         }
 
-        internal Operator (string name, string sql_format, bool is_not, params string [] userOps)
+        internal Operator (string name, string label, string sql_format, bool is_not, params string [] userOps)
         {
             this.name = name;
+            this.label = label;
             this.sql_format = sql_format;
             this.aliases = userOps;
             this.is_not = is_not;

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 Jul 21 00:05:30 2008
@@ -41,10 +41,10 @@
     public class RelativeTimeSpanQueryValue : TimeSpanQueryValue
     {
         // The SQL operators in these Operators are reversed from normal on purpose
-        public static new readonly Operator GreaterThan        = new Operator ("greaterThan", "< {0}", ">");
-        public static new readonly Operator LessThan           = new Operator ("lessThan", "> {0}", "<");
-        public static new readonly Operator GreaterThanEqual   = new Operator ("greaterThanEquals", "<= {0}", ">=");
-        public static new readonly Operator LessThanEqual      = new Operator ("lessThanEquals", ">= {0}", "<=");
+        public static new readonly Operator GreaterThan        = new Operator ("greaterThan", Catalog.GetString ("more than"), "< {0}", ">");
+        public static new readonly Operator LessThan           = new Operator ("lessThan", Catalog.GetString ("less than"), "> {0}", "<");
+        public static new readonly Operator GreaterThanEqual   = new Operator ("greaterThanEquals", Catalog.GetString ("at least"), "<= {0}", ">=");
+        public static new readonly Operator LessThanEqual      = new Operator ("lessThanEquals", Catalog.GetString ("at most"), ">= {0}", "<=");
 
         protected static new AliasedObjectSet<Operator> operators = new AliasedObjectSet<Operator> (GreaterThan, LessThan, GreaterThanEqual, LessThanEqual);
         public override AliasedObjectSet<Operator> OperatorSet {

Modified: trunk/banshee/src/Libraries/Hyena/Hyena.Query/StringQueryValue.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena/Hyena.Query/StringQueryValue.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena/Hyena.Query/StringQueryValue.cs	Mon Jul 21 00:05:30 2008
@@ -30,18 +30,20 @@
 using System.Xml;
 using System.Text;
 
+using Mono.Unix;
+
 using Hyena;
 
 namespace Hyena.Query
 {
     public class StringQueryValue : QueryValue
     {
-        public static readonly Operator Contains       = new Operator ("contains", "LIKE '%{0}%'", ":");
-        public static readonly Operator DoesNotContain = new Operator ("doesNotContain", "NOT LIKE '%{0}%'", true, "!:");
-        public static readonly Operator Equal          = new Operator ("equals", "= '{0}'", "==");
-        public static readonly Operator NotEqual       = new Operator ("notEqual", "!= '{0}'", true, "!=");
-        public static readonly Operator StartsWith     = new Operator ("startsWith", "LIKE '{0}%'", "=");
-        public static readonly Operator EndsWith       = new Operator ("endsWith", "LIKE '%{0}'", ":=");
+        public static readonly Operator Contains       = new Operator ("contains", Catalog.GetString ("contains"), "LIKE '%{0}%'", ":");
+        public static readonly Operator DoesNotContain = new Operator ("doesNotContain", Catalog.GetString ("doesn't contain"), "NOT LIKE '%{0}%'", true, "!:");
+        public static readonly Operator Equal          = new Operator ("equals", Catalog.GetString ("is"), "= '{0}'", "==");
+        public static readonly Operator NotEqual       = new Operator ("notEqual", Catalog.GetString ("is not"), "!= '{0}'", true, "!=");
+        public static readonly Operator StartsWith     = new Operator ("startsWith", Catalog.GetString ("starts with"), "LIKE '{0}%'", "=");
+        public static readonly Operator EndsWith       = new Operator ("endsWith", Catalog.GetString ("ends with"), "LIKE '%{0}'", ":=");
 
         protected string value;
 



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