banshee r4460 - in trunk/banshee: . src/Extensions/Banshee.Podcasting src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Data src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui



Author: gburt
Date: Thu Sep  4 01:16:17 2008
New Revision: 4460
URL: http://svn.gnome.org/viewvc/banshee?rev=4460&view=rev

Log:
2008-09-03  Gabriel Burt  <gabriel burt gmail com>

	* src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/PodcastSourceContents.cs:
	* src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/DownloadStatusFilterView.cs:
	* src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/ColumnCellDownloadStatus.cs:
	* src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Data/PodcastSource.cs:
	* src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Data/DownloadStatusFilterModel.cs:
	* src/Extensions/Banshee.Podcasting/Makefile.am:
	* src/Extensions/Banshee.Podcasting/Banshee.Podcasting.csproj: Add another
	filter for episode downloaded status.



Added:
   trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Data/DownloadStatusFilterModel.cs
   trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/ColumnCellDownloadStatus.cs
   trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/DownloadStatusFilterView.cs
Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Data/PodcastSource.cs
   trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/PodcastSourceContents.cs
   trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.csproj
   trunk/banshee/src/Extensions/Banshee.Podcasting/Makefile.am

Added: trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Data/DownloadStatusFilterModel.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Data/DownloadStatusFilterModel.cs	Thu Sep  4 01:16:17 2008
@@ -0,0 +1,95 @@
+//
+// DownloadStatusFilterModel.cs
+//
+// Authors:
+//   Gabriel Burt <gburt novell com>
+//
+// Copyright (C) 2008 Novell, Inc.
+//
+// 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;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+
+using Hyena.Data;
+
+using Banshee.Database;
+using Banshee.Collection;
+using Banshee.Collection.Database;
+using Banshee.Podcasting.Data;
+
+using Migo.Syndication;
+
+namespace Banshee.Podcasting.Gui
+{
+    public enum DownloadedStatusFilter
+    {
+        Both,
+        Downloaded,
+        NotDownloaded
+    }
+
+    public class DownloadStatusFilterModel : FilterListModel<DownloadedStatusFilter>
+    {
+        public DownloadStatusFilterModel (DatabaseTrackListModel trackModel) : base (trackModel)
+        {
+            // By default, select All items
+            Selection.Clear (false);
+            Selection.QuietSelect (0);
+        }
+        
+        public override void Reload (bool notify)
+        {
+            if (notify)
+                OnReloaded ();
+        }
+        
+        public override void Clear ()
+        {
+        }
+        
+        public override DownloadedStatusFilter this [int index] {
+            get {
+                switch (index) {
+                    case 1:    return DownloadedStatusFilter.Downloaded;
+                    case 2:    return DownloadedStatusFilter.NotDownloaded;
+                    case 0:
+                    default:   return DownloadedStatusFilter.Both;
+                }
+            }
+        }
+        
+        public override int Count {
+            get { return 3; }
+        }
+
+        public override string GetSqlFilter ()
+        {
+            if (Selection.AllSelected)
+                return null;
+            else if (Selection.Contains (1))
+                return String.Format ("PodcastEnclosures.DownloadStatus = {0}", (int)FeedDownloadStatus.Downloaded);
+            else
+                return String.Format ("PodcastEnclosures.DownloadStatus != {0}", (int)FeedDownloadStatus.Downloaded);
+        }
+    }
+}

Modified: trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Data/PodcastSource.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Data/PodcastSource.cs	(original)
+++ trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Data/PodcastSource.cs	Thu Sep  4 01:16:17 2008
@@ -57,6 +57,7 @@
     public class PodcastSource : Banshee.Library.LibrarySource
     {
         private PodcastUnheardFilterModel unheard_model;
+        private DownloadStatusFilterModel download_model;
         private PodcastFeedModel feed_model;
 
         private string baseDirectory;
@@ -157,11 +158,14 @@
             feed_model = new PodcastFeedModel (this, DatabaseTrackModel, ServiceManager.DbConnection, "PodcastFeeds");
             
             unheard_model = new PodcastUnheardFilterModel (DatabaseTrackModel);
+            download_model = new DownloadStatusFilterModel (DatabaseTrackModel);
             
             AvailableFilters.Add (unheard_model);
+            AvailableFilters.Add (download_model);
             AvailableFilters.Add (feed_model);
             
             DefaultFilters.Add (unheard_model);
+            DefaultFilters.Add (download_model);
             DefaultFilters.Add (feed_model);
             
             AfterInitialized ();

Added: trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/ColumnCellDownloadStatus.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/ColumnCellDownloadStatus.cs	Thu Sep  4 01:16:17 2008
@@ -0,0 +1,65 @@
+//
+// ColumnCellDownloadStatus.cs
+//
+// Authors:
+//   Gabriel Burt <gburt novell com>
+//
+// Copyright (C) 2008 Novell, Inc.
+//
+// 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;
+using Gtk;
+using Cairo;
+
+using Mono.Unix;
+
+using Hyena.Gui;
+using Hyena.Gui.Theming;
+using Hyena.Data.Gui;
+
+using Migo.Syndication;
+
+using Banshee.Gui;
+using Banshee.ServiceStack;
+using Banshee.Collection.Gui;
+
+namespace Banshee.Podcasting.Gui
+{
+    public class ColumnCellDownloadStatus : ColumnCellText
+    {
+        public ColumnCellDownloadStatus () : base (null, true)
+        {
+        }
+    
+        protected override string Text {
+            get {
+                DownloadedStatusFilter val = (DownloadedStatusFilter) BoundObject;
+                switch (val) {
+                    case DownloadedStatusFilter.Downloaded:       return Catalog.GetString ("Downloaded");
+                    case DownloadedStatusFilter.Both:             return Catalog.GetString ("All Items");
+                    case DownloadedStatusFilter.NotDownloaded:    return Catalog.GetString ("Not Downloaded");
+                }
+                return String.Empty;
+            }
+        }
+    }
+}

Added: trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/DownloadStatusFilterView.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/DownloadStatusFilterView.cs	Thu Sep  4 01:16:17 2008
@@ -0,0 +1,59 @@
+//
+// DownloadStatusFilterView.cs
+//
+// Authors:
+//   Gabriel Burt <gburt novell com>
+//
+// Copyright (C) 2008 Novell, Inc.
+//
+// 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;
+using System.Collections.ObjectModel;
+
+using Mono.Unix;
+
+using Gtk;
+
+using Hyena.Data;
+using Hyena.Data.Gui;
+using Hyena.Collections;
+
+using Banshee.Gui;
+using Banshee.ServiceStack;
+using Banshee.Collection.Gui;
+
+using Banshee.Podcasting.Data;
+
+using Migo.Syndication;
+
+namespace Banshee.Podcasting.Gui
+{
+    public class DownloadStatusFilterView : TrackFilterListView<DownloadedStatusFilter>
+    {
+        public DownloadStatusFilterView () : base ()
+        {
+            ColumnCellDownloadStatus renderer = new ColumnCellDownloadStatus ();
+            column_controller.Add (new Column ("Download Status Filter", renderer, 1.0));
+            ColumnController = column_controller;
+        }
+    }
+}
\ No newline at end of file

Modified: trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/PodcastSourceContents.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/PodcastSourceContents.cs	(original)
+++ trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/PodcastSourceContents.cs	Thu Sep  4 01:16:17 2008
@@ -56,6 +56,7 @@
         private PodcastItemView track_view;
         private PodcastFeedView feed_view;
         private PodcastUnheardFilterView unheard_view;
+        private DownloadStatusFilterView download_view;
         
         public PodcastSourceContents () : base ("podcast")
         {
@@ -65,6 +66,7 @@
         {
             SetupMainView (track_view = new PodcastItemView ());
             SetupFilterView (unheard_view = new PodcastUnheardFilterView ());
+            SetupFilterView (download_view = new DownloadStatusFilterView ());
             SetupFilterView (feed_view = new PodcastFeedView ());
         }
         
@@ -73,6 +75,7 @@
             if (feed_view.Model != null) {
                 feed_view.Selection.Clear ();
                 unheard_view.Selection.Clear ();
+                download_view.Selection.Clear ();
             }
         }
 
@@ -105,6 +108,8 @@
                     SetModel (feed_view, (model as IListModel<Feed>));
                 else if (model is PodcastUnheardFilterModel)
                     SetModel (unheard_view, (model as IListModel<OldNewFilter>));
+                else if (model is DownloadStatusFilterModel)
+                    SetModel (download_view, (model as IListModel<DownloadedStatusFilter>));
                 else
                     Hyena.Log.DebugFormat ("PodcastContents got non-feed filter model: {0}", model);
             }
@@ -120,6 +125,7 @@
             source = null;
             track_view.SetModel (null);
             unheard_view.SetModel (null);
+            download_view.SetModel (null);
             feed_view.SetModel (null);
             track_view.HeaderVisible = false;
             //Console.WriteLine ("PSC.reset_source 2");

Modified: trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.csproj
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.csproj	(original)
+++ trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.csproj	Thu Sep  4 01:16:17 2008
@@ -8,6 +8,7 @@
     <OutputType>Library</OutputType>
     <UseParentDirectoryAsNamespace>true</UseParentDirectoryAsNamespace>
     <AssemblyName>Banshee.Podcasting</AssemblyName>
+    <SchemaVersion>2.0</SchemaVersion>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
@@ -88,11 +89,14 @@
     <Compile Include="Banshee.Podcasting.Data\PodcastTrackListModel.cs" />
     <Compile Include="Banshee.Podcasting\PodcastQuery.cs" />
     <Compile Include="Banshee.Podcasting.Gui\ColumnCellPodcastStatusIndicator.cs" />
+    <Compile Include="Banshee.Podcasting.Data\DownloadStatusFilterModel.cs" />
+    <Compile Include="Banshee.Podcasting.Gui\DownloadStatusFilterView.cs" />
+    <Compile Include="Banshee.Podcasting.Gui\ColumnCellDownloadStatus.cs" />
   </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <ProjectExtensions>
     <MonoDevelop>
-      <Properties xmlns="">
+      <Properties>
         <GtkDesignInfo />
         <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="true" RelativeMakefileName="./Makefile.am">
           <BuildFilesVar Sync="true" Name="SOURCES" />

Modified: trunk/banshee/src/Extensions/Banshee.Podcasting/Makefile.am
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Podcasting/Makefile.am	(original)
+++ trunk/banshee/src/Extensions/Banshee.Podcasting/Makefile.am	Thu Sep  4 01:16:17 2008
@@ -4,17 +4,20 @@
 INSTALL_DIR = $(EXTENSIONS_INSTALL_DIR)
 
 SOURCES =  \
+	Banshee.Podcasting.Data/DownloadStatusFilterModel.cs \
 	Banshee.Podcasting.Data/PodcastFeedModel.cs \
 	Banshee.Podcasting.Data/PodcastSource.cs \
 	Banshee.Podcasting.Data/PodcastTrackInfo.cs \
 	Banshee.Podcasting.Data/PodcastTrackListModel.cs \
 	Banshee.Podcasting.Data/PodcastUnheardFilterModel.cs \
+	Banshee.Podcasting.Gui/ColumnCellDownloadStatus.cs \
 	Banshee.Podcasting.Gui/ColumnCellPodcast.cs \
 	Banshee.Podcasting.Gui/ColumnCellPodcastStatusIndicator.cs \
 	Banshee.Podcasting.Gui/ColumnCellPublished.cs \
 	Banshee.Podcasting.Gui/ColumnCellUnheard.cs \
 	Banshee.Podcasting.Gui/DownloadManager/DownloadManagerInterface.cs \
 	Banshee.Podcasting.Gui/DownloadManager/DownloadUserJob.cs \
+	Banshee.Podcasting.Gui/DownloadStatusFilterView.cs \
 	Banshee.Podcasting.Gui/Models/FilterableListModel.cs \
 	Banshee.Podcasting.Gui/Models/ListModel.cs \
 	Banshee.Podcasting.Gui/PodcastActions.cs \



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