banshee r3360 - in trunk/banshee: . src/Core/Banshee.Services src/Core/Banshee.Services/Banshee.Playlist src/Core/Banshee.Services/Banshee.Query src/Core/Banshee.Services/Banshee.SmartPlaylist src/Core/Banshee.Services/Banshee.Sources src/Core/Banshee.ThickClient src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio src/Libraries/Hyena src/Libraries/Hyena.Gui src/Libraries/Hyena/Hyena.Query
- From: scottp svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r3360 - in trunk/banshee: . src/Core/Banshee.Services src/Core/Banshee.Services/Banshee.Playlist src/Core/Banshee.Services/Banshee.Query src/Core/Banshee.Services/Banshee.SmartPlaylist src/Core/Banshee.Services/Banshee.Sources src/Core/Banshee.ThickClient src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio src/Libraries/Hyena src/Libraries/Hyena.Gui src/Libraries/Hyena/Hyena.Query
- Date: Sat, 1 Mar 2008 05:56:11 +0000 (GMT)
Author: scottp
Date: Sat Mar 1 05:56:11 2008
New Revision: 3360
URL: http://svn.gnome.org/viewvc/banshee?rev=3360&view=rev
Log:
* src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/StationSource.cs:
Implements new HasDepenencies property.
* src/Core/Banshee.Services/Banshee.Sources/ITrackModelSource.cs: Added
HasDependencies property.
* src/Core/Banshee.Services/Banshee.Sources/Source.cs: The public
Children property is now a ReadOnlyCollection<Source> since other
code has no business modifying the collection directly.
* src/Core/Banshee.Services/Banshee.Sources/DatabaseSource.cs: No
longer reload a child source if it has dependencies (the
dependencies will trigger a reload of the source which depends on
them).
* src/Core/Banshee.Services/Banshee.Playlist/AbstractPlaylistSource.cs:
Overrided Equals and GetHashCode to compare DbId.
* src/Core/Banshee.Services/Banshee.Query/SmartPlaylistQueryValue.cs:
Implements new abstract member Resolve(). Used to turn a DbId into
a SmartPlaylistSource.
* src/Core/Banshee.Services/Banshee.Query/PlaylistQueryValue.cs:
Implements new abstract memeber Resolve () (right now it just
returns null b/c we don't use the ObjectValue of a
PlaylistQueryValue. In the future, this may change).
* src/Core/Banshee.Services/Banshee.Query/AbstractPlaylistQueryValue.cs:
Added abstract query value to handle the OperatorSet overload used
by both SmartPlaylistQueryValue and PlaylistQueryValue.
* src/Core/Banshee.Services/Banshee.SmartPlaylist/SmartPlaylistCore.cs:
Made to use generics and addded GetSmartPlaylistFromDbId () method.
* src/Core/Banshee.Services/Banshee.SmartPlaylist/SmartPlaylistSource.cs:
Now keeps track of SmartPlaylistSources on which it depends. Used
for listening to dependencies' Update events.
* src/Libraries/Hyena/Hyena.Query/IntegerQueryValue.cs: SetValue made
virtual.
* src/Libraries/Hyena/Hyena.Query/IntegerKeyedObjectQueryValue.cs: New
abstract class which allows an IntegerObjectValue to map to an
object.
Added:
trunk/banshee/src/Core/Banshee.Services/Banshee.Query/AbstractPlaylistQueryValue.cs
- copied, changed from r3358, /trunk/banshee/src/Core/Banshee.Services/Banshee.Query/PlaylistQueryValue.cs
trunk/banshee/src/Libraries/Hyena/Hyena.Query/IntegerKeyedObjectQueryValue.cs
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Core/Banshee.Services/Banshee.Playlist/AbstractPlaylistSource.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Query/PlaylistQueryValue.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Query/SmartPlaylistQueryValue.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Services.mdp
trunk/banshee/src/Core/Banshee.Services/Banshee.SmartPlaylist/SmartPlaylistCore.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.SmartPlaylist/SmartPlaylistSource.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/DatabaseSource.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/ITrackModelSource.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/Source.cs
trunk/banshee/src/Core/Banshee.Services/Makefile.am
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.ThickClient.mdp
trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/StationSource.cs
trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui.mdp
trunk/banshee/src/Libraries/Hyena/Hyena.Query/IntegerQueryValue.cs
trunk/banshee/src/Libraries/Hyena/Hyena.mdp
trunk/banshee/src/Libraries/Hyena/Makefile.am
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Playlist/AbstractPlaylistSource.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Playlist/AbstractPlaylistSource.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Playlist/AbstractPlaylistSource.cs Sat Mar 1 05:56:11 2008
@@ -111,5 +111,17 @@
protected abstract void Create ();
protected abstract void Update ();
+
+ public override bool Equals (object o)
+ {
+ AbstractPlaylistSource source = o as AbstractPlaylistSource;
+ return source != null && source.DbId == DbId;
+ }
+
+ public override int GetHashCode ()
+ {
+ return DbId.GetHashCode ();
+ }
+
}
}
Copied: trunk/banshee/src/Core/Banshee.Services/Banshee.Query/AbstractPlaylistQueryValue.cs (from r3358, /trunk/banshee/src/Core/Banshee.Services/Banshee.Query/PlaylistQueryValue.cs)
==============================================================================
--- /trunk/banshee/src/Core/Banshee.Services/Banshee.Query/PlaylistQueryValue.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Query/AbstractPlaylistQueryValue.cs Sat Mar 1 05:56:11 2008
@@ -29,9 +29,11 @@
using System;
using Hyena.Query;
+using Banshee.Playlist;
+
namespace Banshee.Query
{
- public class PlaylistQueryValue : IntegerQueryValue
+ public abstract class AbstractPlaylistQueryValue<T> : IntegerKeyedObjectQueryValue<T> where T : AbstractPlaylistSource
{
private static AliasedObjectSet<Operator> playlist_ops = new AliasedObjectSet<Operator> (Equal, NotEqual);
public override AliasedObjectSet<Operator> OperatorSet {
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Query/PlaylistQueryValue.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Query/PlaylistQueryValue.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Query/PlaylistQueryValue.cs Sat Mar 1 05:56:11 2008
@@ -2,9 +2,9 @@
// PlaylistQueryValue.cs
//
// Authors:
-// Gabriel Burt <gburt novell com>
+// Scott Peterson <lunchtimemama gmail com>
//
-// Copyright (C) 2008 Novell, Inc.
+// Copyright (C) 2008 Scott Peterson
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
@@ -29,13 +29,15 @@
using System;
using Hyena.Query;
+using Banshee.Playlist;
+
namespace Banshee.Query
{
- public class PlaylistQueryValue : IntegerQueryValue
+ public class PlaylistQueryValue : AbstractPlaylistQueryValue<PlaylistSource>
{
- private static AliasedObjectSet<Operator> playlist_ops = new AliasedObjectSet<Operator> (Equal, NotEqual);
- public override AliasedObjectSet<Operator> OperatorSet {
- get { return playlist_ops; }
+ protected sealed override PlaylistSource Resolve ()
+ {
+ return null;
}
}
}
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Query/SmartPlaylistQueryValue.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Query/SmartPlaylistQueryValue.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Query/SmartPlaylistQueryValue.cs Sat Mar 1 05:56:11 2008
@@ -29,9 +29,16 @@
using System;
using Hyena.Query;
+using Banshee.ServiceStack;
+using Banshee.SmartPlaylist;
+
namespace Banshee.Query
{
- public class SmartPlaylistQueryValue : PlaylistQueryValue
+ public class SmartPlaylistQueryValue : AbstractPlaylistQueryValue<SmartPlaylistSource>
{
+ protected sealed override SmartPlaylistSource Resolve ()
+ {
+ return ServiceManager.Get<SmartPlaylistCore>().GetSmartPlaylistFromDbId ((int)IntValue);
+ }
}
}
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Services.mdp
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Services.mdp (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Services.mdp Sat Mar 1 05:56:11 2008
@@ -117,7 +117,7 @@
<File name="Banshee.Base/ThreadAssist.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Query/BansheeQuery.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Query/NaturalIntegerQueryValue.cs" subtype="Code" buildaction="Compile" />
- <File name="Banshee.Query/PlaylistQueryValue.cs" subtype="Code" buildaction="Compile" />
+ <File name="Banshee.Query/AbstractPlaylistQueryValue.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Query/RatingQueryValue.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Query/SmartPlaylistQueryValue.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Query/YearQueryValue.cs" subtype="Code" buildaction="Compile" />
@@ -125,6 +125,7 @@
<File name="Banshee.PlayerMigration/AmarokPlayerImportSource.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Library/ThreadPoolImportSource.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.ServiceStack/IInitializeService.cs" subtype="Code" buildaction="Compile" />
+ <File name="Banshee.Query/PlaylistQueryValue.cs" subtype="Code" buildaction="Compile" />
</Contents>
<References>
<ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
@@ -139,6 +140,7 @@
<ProjectReference type="Gac" localcopy="True" refto="glib-sharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<ProjectReference type="Gac" localcopy="True" refto="TagLib, Version=0.0.0.0, Culture=neutral" />
</References>
+ <Deployment.LinuxDeployData generateScript="False" />
<MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True" RelativeMakefileName="Makefile.am">
<BuildFilesVar Sync="True" Name="SOURCES" />
<DeployFilesVar />
@@ -148,5 +150,4 @@
<AsmRefVar />
<ProjectRefVar />
</MonoDevelop.Autotools.MakefileInfo>
- <Deployment.LinuxDeployData generateScript="False" />
</Project>
\ No newline at end of file
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.SmartPlaylist/SmartPlaylistCore.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.SmartPlaylist/SmartPlaylistCore.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.SmartPlaylist/SmartPlaylistCore.cs Sat Mar 1 05:56:11 2008
@@ -1,6 +1,5 @@
using System;
using System.Data;
-using System.Collections;
using System.Collections.Generic;
using Mono.Unix;
@@ -29,7 +28,7 @@
private readonly double RATE_LIMIT_CPU_MAX = 0.10;
private static int RATE_LIMIT_REFRESH = 5;
- private ArrayList playlists = new ArrayList();
+ private List<SmartPlaylistSource> playlists = new List<SmartPlaylistSource> ();
private DateTime last_check = DateTime.MinValue;
private uint event_counter = 0;
@@ -76,12 +75,6 @@
//Console.WriteLine ("source added: {0}", args.Source.Name);
if (args.Source is PlaylistSource || args.Source is SmartPlaylistSource) {
- foreach (SmartPlaylistSource pl in playlists) {
- if (pl.PlaylistDependent) {
- pl.ListenToPlaylists();
- }
- }
-
if (args.Source is PlaylistSource)
return;
}
@@ -278,6 +271,17 @@
public void SortPlaylists () {
playlists.Sort(new DependencyComparer());
}
+
+ public SmartPlaylistSource GetSmartPlaylistFromDbId (int dbId)
+ {
+ // TODO use a dictionary
+ foreach (SmartPlaylistSource sp in playlists) {
+ if (sp.DbId == dbId) {
+ return sp;
+ }
+ }
+ return null;
+ }
}
// Class used for timing different operations. Commented out for normal operation.
@@ -330,15 +334,12 @@
}
}
- public class DependencyComparer : IComparer {
- public int Compare(object ao, object bo)
+ public class DependencyComparer : IComparer<SmartPlaylistSource> {
+ public int Compare(SmartPlaylistSource a, SmartPlaylistSource b)
{
- SmartPlaylistSource a = ao as SmartPlaylistSource;
- SmartPlaylistSource b = bo as SmartPlaylistSource;
-
- if (b.DependsOn(a)) {
+ if (b.DependsOn (a)) {
return -1;
- } else if (a.DependsOn(b)) {
+ } else if (a.DependsOn (b)) {
return 1;
} else {
return 0;
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.SmartPlaylist/SmartPlaylistSource.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.SmartPlaylist/SmartPlaylistSource.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.SmartPlaylist/SmartPlaylistSource.cs Sat Mar 1 05:56:11 2008
@@ -57,6 +57,9 @@
private QueryOrder query_order;
private QueryLimit limit;
private IntegerQueryValue limit_value;
+
+ private List<SmartPlaylistSource> dependencies = new List<SmartPlaylistSource>();
+
#region Properties
@@ -139,10 +142,9 @@
return (Limit != null && LimitValue != null && !LimitValue.IsEmpty && QueryOrder != null);
}
}
-
- // FIXME scan ConditionTree for playlist fields
- public bool PlaylistDependent {
- get { return false; }
+
+ public override bool HasDependencies {
+ get { return dependencies.Count > 0; }
}
// FIXME scan ConditionTree for date fields
@@ -167,6 +169,7 @@
LimitValue = limit_value;
InstallProperties ();
+ UpdateDependencies ();
}
// For existing smart playlists that we're loading from the database
@@ -184,6 +187,7 @@
DbId = dbid;
InstallProperties ();
+ UpdateDependencies ();
//Globals.Library.TrackRemoved += OnLibraryTrackRemoved;
@@ -212,32 +216,46 @@
public bool DependsOn (SmartPlaylistSource source)
{
- return DependsOn (source, ConditionTree);
+ dependencies.Contains (source);
+ return false;
}
- private bool DependsOn (SmartPlaylistSource source, QueryNode node)
+#endregion
+
+#region Private Methods
+
+ private void UpdateDependencies (QueryNode node)
{
- if (node == null) {
- return false;
- }
-
if (node is QueryListNode) {
foreach (QueryNode child in (node as QueryListNode).Children) {
- if (DependsOn (source, child)) {
- return true;
- }
+ UpdateDependencies (child);
}
} else {
QueryTermNode term = node as QueryTermNode;
- if (term.Field == BansheeQuery.SmartPlaylistField) {
- if ((term.Value as IntegerQueryValue).IntValue == source.DbId)
- return true;
+ if (term != null && term.Field == BansheeQuery.SmartPlaylistField) {
+ SmartPlaylistSource s = (term.Value as SmartPlaylistQueryValue).ObjectValue;
+ s.Updated += OnDependencyUpdated;
+ dependencies.Add (s);
}
}
-
- return false;
}
-
+
+ private void UpdateDependencies ()
+ {
+ foreach (SmartPlaylistSource s in dependencies) {
+ s.Updated -= OnDependencyUpdated;
+ }
+
+ dependencies.Clear ();
+
+ UpdateDependencies (ConditionTree);
+ }
+
+ private void OnDependencyUpdated (object sender, EventArgs args)
+ {
+ RateLimitedReload ();
+ }
+
#endregion
#region AbstractPlaylist overrides
@@ -253,6 +271,7 @@
IsLimited ? LimitValue.ToSql () : null,
IsLimited ? Limit.Name : null
));
+ UpdateDependencies ();
}
protected override void Update ()
@@ -271,6 +290,7 @@
IsLimited ? Limit.Name : null,
DbId
));
+ UpdateDependencies ();
}
#endregion
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 Sat Mar 1 05:56:11 2008
@@ -165,11 +165,16 @@
protected virtual void ReloadChildren ()
{
foreach (Source child in Children) {
- if (child is ITrackModelSource) {
- (child as ITrackModelSource).Reload ();
+ ITrackModelSource c = child as ITrackModelSource;
+ if (c != null && !c.HasDependencies) {
+ c.Reload ();
}
}
}
+
+ public virtual bool HasDependancies {
+ get { return false; }
+ }
public virtual void RemoveTrack (int index)
{
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/ITrackModelSource.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/ITrackModelSource.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/ITrackModelSource.cs Sat Mar 1 05:56:11 2008
@@ -42,6 +42,7 @@
ArtistListModel ArtistModel { get; }
void Reload ();
+ bool HasDependencies { get; }
void RemoveSelectedTracks ();
void DeleteSelectedTracks ();
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/Source.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/Source.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/Source.cs Sat Mar 1 05:56:11 2008
@@ -31,6 +31,7 @@
using System.Text;
using System.Collections;
using System.Collections.Generic;
+using System.Collections.ObjectModel;
using Mono.Unix;
@@ -44,9 +45,10 @@
{
public abstract class Source : ISource
{
- private Source parent;
+ private Source parent;
private PropertyStore properties = new PropertyStore ();
private List<Source> child_sources = new List<Source> ();
+ private ReadOnlyCollection<Source> read_only_children;
public event EventHandler Updated;
public event EventHandler UserNotifyUpdated;
@@ -67,6 +69,7 @@
}
properties.PropertyChanged += OnPropertyChanged;
+ read_only_children = new ReadOnlyCollection<Source> (child_sources);
}
protected void OnSetupComplete ()
@@ -249,8 +252,8 @@
#region Public Properties
- public ICollection<Source> Children {
- get { return child_sources; }
+ public ReadOnlyCollection<Source> Children {
+ get { return read_only_children; }
}
string [] ISource.Children {
Modified: trunk/banshee/src/Core/Banshee.Services/Makefile.am
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Makefile.am (original)
+++ trunk/banshee/src/Core/Banshee.Services/Makefile.am Sat Mar 1 05:56:11 2008
@@ -81,6 +81,7 @@
Banshee.Playlists.Formats/PlaylistFormatDescription.cs \
Banshee.Playlists.Formats/PlaylistParser.cs \
Banshee.Playlists.Formats/PlsPlaylistFormat.cs \
+ Banshee.Query/AbstractPlaylistQueryValue.cs \
Banshee.Query/BansheeQuery.cs \
Banshee.Query/NaturalIntegerQueryValue.cs \
Banshee.Query/PlaylistQueryValue.cs \
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.ThickClient.mdp
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.ThickClient.mdp (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.ThickClient.mdp Sat Mar 1 05:56:11 2008
@@ -115,6 +115,7 @@
<ProjectReference type="Gac" localcopy="True" refto="glib-sharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<ProjectReference type="Gac" localcopy="True" refto="pango-sharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
</References>
+ <Deployment.LinuxDeployData generateScript="False" />
<MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True" RelativeMakefileName="Makefile.am">
<BuildFilesVar Sync="True" Name="SOURCES" />
<DeployFilesVar />
@@ -124,5 +125,4 @@
<AsmRefVar />
<ProjectRefVar />
</MonoDevelop.Autotools.MakefileInfo>
- <Deployment.LinuxDeployData generateScript="False" />
</Project>
\ No newline at end of file
Modified: trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/StationSource.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/StationSource.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/StationSource.cs Sat Mar 1 05:56:11 2008
@@ -317,6 +317,10 @@
return (left < 0) ? 0 : left;
}
}
+
+ public bool HasDependencies {
+ get { return false; }
+ }
private bool refreshing = false;
public void Refresh ()
Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui.mdp
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui.mdp (original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui.mdp Sat Mar 1 05:56:11 2008
@@ -49,7 +49,6 @@
<File name="Hyena.Query.Gui/QueryTermsBox.cs" subtype="Code" buildaction="Compile" />
<File name="Hyena.Widgets/MessageBar.cs" subtype="Code" buildaction="Compile" />
<File name="Hyena.Widgets/AnimatedImage.cs" subtype="Code" buildaction="Compile" />
- <File name="Hyena.Gui.Theming" subtype="Directory" buildaction="Compile" />
<File name="Hyena.Gui.Theming/Theme.cs" subtype="Code" buildaction="Compile" />
<File name="Hyena.Gui.Theming/GtkColors.cs" subtype="Code" buildaction="Compile" />
<File name="Hyena.Gui.Theming/ThemeContext.cs" subtype="Code" buildaction="Compile" />
@@ -63,6 +62,7 @@
<ProjectReference type="Project" localcopy="False" refto="Hyena" />
<ProjectReference type="Gac" localcopy="True" refto="pango-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
</References>
+ <Deployment.LinuxDeployData generateScript="False" />
<MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True" RelativeMakefileName="Makefile.am">
<BuildFilesVar Sync="True" Name="SOURCES" />
<DeployFilesVar />
@@ -72,5 +72,4 @@
<AsmRefVar />
<ProjectRefVar />
</MonoDevelop.Autotools.MakefileInfo>
- <Deployment.LinuxDeployData generateScript="False" />
</Project>
\ No newline at end of file
Added: trunk/banshee/src/Libraries/Hyena/Hyena.Query/IntegerKeyedObjectQueryValue.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Libraries/Hyena/Hyena.Query/IntegerKeyedObjectQueryValue.cs Sat Mar 1 05:56:11 2008
@@ -0,0 +1,54 @@
+//
+// IntegerKeyedObjectQueryValue.cs
+//
+// Authors:
+// Scott Peterson <lunchtimemama gmail com>
+//
+// Copyright (C) 2008 Scott Peterson
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Hyena.Query
+{
+ public abstract class IntegerKeyedObjectQueryValue<T> : IntegerQueryValue where T : class
+ {
+ private T object_value;
+
+ public override void SetValue (long value)
+ {
+ object_value = null;
+ base.SetValue (value);
+ }
+
+ public T ObjectValue {
+ get {
+ if (object_value == null) {
+ object_value = Resolve ();
+ }
+ return object_value;
+ }
+ }
+
+ protected abstract T Resolve ();
+ }
+}
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 Sat Mar 1 05:56:11 2008
@@ -64,7 +64,7 @@
SetValue ((long) value);
}
- public void SetValue (long value)
+ public virtual void SetValue (long value)
{
this.value = value;
IsEmpty = false;
Modified: trunk/banshee/src/Libraries/Hyena/Hyena.mdp
==============================================================================
--- trunk/banshee/src/Libraries/Hyena/Hyena.mdp (original)
+++ trunk/banshee/src/Libraries/Hyena/Hyena.mdp Sat Mar 1 05:56:11 2008
@@ -80,12 +80,14 @@
<File name="Hyena.Data.Sqlite/SqliteUtils.cs" subtype="Code" buildaction="Compile" />
<File name="Hyena/Log.cs" subtype="Code" buildaction="Compile" />
<File name="Hyena/CryptoUtil.cs" subtype="Code" buildaction="Compile" />
+ <File name="Hyena.Query/IntegerKeyedObjectQueryValue.cs" subtype="Code" buildaction="Compile" />
</Contents>
<References>
<ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<ProjectReference type="Gac" localcopy="True" refto="System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<ProjectReference type="Gac" localcopy="True" refto="Mono.Data.Sqlite, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
</References>
+ <Deployment.LinuxDeployData generateScript="False" />
<MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True" RelativeMakefileName="Makefile.am">
<BuildFilesVar Sync="True" Name="SOURCES" />
<DeployFilesVar />
@@ -95,5 +97,4 @@
<AsmRefVar />
<ProjectRefVar />
</MonoDevelop.Autotools.MakefileInfo>
- <Deployment.LinuxDeployData generateScript="False" />
</Project>
\ No newline at end of file
Modified: trunk/banshee/src/Libraries/Hyena/Makefile.am
==============================================================================
--- trunk/banshee/src/Libraries/Hyena/Makefile.am (original)
+++ trunk/banshee/src/Libraries/Hyena/Makefile.am Sat Mar 1 05:56:11 2008
@@ -36,6 +36,7 @@
Hyena.Query/AliasedObjectSet.cs \
Hyena.Query/DateQueryValue.cs \
Hyena.Query/FileSizeQueryValue.cs \
+ Hyena.Query/IntegerKeyedObjectQueryValue.cs \
Hyena.Query/IntegerQueryValue.cs \
Hyena.Query/QueryField.cs \
Hyena.Query/QueryFieldSet.cs \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]