[banshee/podcast-ng] * Added 'GetItem' to 'Banshee.Paas.Data.ListModel<T>'. * Added 'IImplementsCustomSearch' allowing Mi



commit 00017dfad91ee31eed672c46b68a08fe380e60eb
Author: Mike Urbanski <michael c urbanski gmail com>
Date:   Mon Mar 29 20:44:58 2010 -0500

    * Added 'GetItem' to 'Banshee.Paas.Data.ListModel<T>'.
    * Added 'IImplementsCustomSearch' allowing Miro Guide sources to override default search entry.
    * Updates to reflect the fact that 'ThreadAssist' has been moved from 'Banshee.Base' to 'Hyena'.

 src/Clients/Nereid/Nereid/PlayerInterface.cs       |    9 +++++
 src/Clients/Nereid/Nereid/ViewContainer.cs         |   33 ++++++++++++++++++
 .../Banshee.Sources.Gui/IImplementsCustomSearch.cs |   35 ++++++++++++++++++++
 .../Banshee.ThickClient/Banshee.ThickClient.csproj |    1 +
 src/Core/Banshee.ThickClient/Makefile.am           |    1 +
 .../Banshee.Paas/Banshee.Paas.Data/ListModel.cs    |    6 +++
 .../DownloadManagerInterface.cs                    |    1 +
 .../Banshee.Paas/Banshee.Paas/PaasSource.cs        |    1 +
 8 files changed, 87 insertions(+), 0 deletions(-)
---
diff --git a/src/Clients/Nereid/Nereid/PlayerInterface.cs b/src/Clients/Nereid/Nereid/PlayerInterface.cs
index 1c4d007..f5cf259 100644
--- a/src/Clients/Nereid/Nereid/PlayerInterface.cs
+++ b/src/Clients/Nereid/Nereid/PlayerInterface.cs
@@ -397,6 +397,15 @@ namespace Nereid
                 }
 
                 view_container.Title = source.Name;
+
+                if (source is IImplementsCustomSearch) {
+                    view_container.SetSearchEntry ((source as IImplementsCustomSearch).SearchEntry);
+                } else {
+                    view_container.RestoreDefaultSearchEntry ();
+                }
+
+                view_container.SearchSensitive = source.CanSearch || source is IImplementsCustomSearch;
+
                 view_container.SearchEntry.Ready = false;
                 view_container.SearchEntry.CancelSearch ();
 
diff --git a/src/Clients/Nereid/Nereid/ViewContainer.cs b/src/Clients/Nereid/Nereid/ViewContainer.cs
index 9344852..f27a331 100644
--- a/src/Clients/Nereid/Nereid/ViewContainer.cs
+++ b/src/Clients/Nereid/Nereid/ViewContainer.cs
@@ -164,6 +164,7 @@ namespace Nereid
             search_entry.FilterChanged += OnSearchEntryFilterChanged;
             search_entry.ActivateFilter ((int)TrackFilterType.None);
 
+            RestoreDefaultSearchEntry ();
             OnSearchEntryFilterChanged (search_entry, EventArgs.Empty);
         }
 
@@ -186,6 +187,38 @@ namespace Nereid
             }
         }
 
+                private void ClearSearchEntryBox ()
+        {
+            if (search_entry_box.Child != null) {
+                search_entry_box.Remove (search_entry_box.Child);
+            }
+        }
+
+        private void ClearSearchEntryBox ()
+        {
+            if (search_entry_box.Child != null) {
+                search_entry_box.Remove (search_entry_box.Child);
+            }
+        }
+
+        public void RestoreDefaultSearchEntry ()
+        {
+            SetSearchEntry (DefaultSearchEntry);
+        }
+
+        public void SetSearchEntry (SearchEntry searchEntry)
+        {
+            if (searchEntry != null && current_search_entry != searchEntry) {
+                ClearSearchEntryBox ();
+
+                current_search_entry = searchEntry;
+                search_entry_box.Add (current_search_entry);
+
+                current_search_entry.Show ();
+                search_entry_box.Show ();
+            }
+        }
+
         public void SetHeaderWidget (Widget widget)
         {
             if (widget != null) {
diff --git a/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/IImplementsCustomSearch.cs b/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/IImplementsCustomSearch.cs
new file mode 100644
index 0000000..06ebb86
--- /dev/null
+++ b/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/IImplementsCustomSearch.cs
@@ -0,0 +1,35 @@
+//
+// IImplementsCustomSearch.cs
+//
+// Authors:
+//   Mike Urbanski <michael c urbanski gmail com>
+//
+// Copyright (C) 2009 Michael C. Urbanski
+//
+// 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 Banshee.Widgets;
+
+namespace Banshee.Sources.Gui
+{
+    public interface IImplementsCustomSearch : ISource
+    {
+        SearchEntry SearchEntry { get; }
+    }
+}
\ No newline at end of file
diff --git a/src/Core/Banshee.ThickClient/Banshee.ThickClient.csproj b/src/Core/Banshee.ThickClient/Banshee.ThickClient.csproj
index 4c58e01..325d877 100644
--- a/src/Core/Banshee.ThickClient/Banshee.ThickClient.csproj
+++ b/src/Core/Banshee.ThickClient/Banshee.ThickClient.csproj
@@ -273,6 +273,7 @@
     <Compile Include="Banshee.Collection.Gui\SearchableListView.cs" />
     <Compile Include="Banshee.Gui.Widgets\CoverArtDisplay.cs" />
     <Compile Include="Banshee.CairoGlyphs\BansheeLineLogo.cs" />
+    <Compile Include="Banshee.Sources.Gui\IImplementsCustomSearch.cs" />
   </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <ProjectExtensions>
diff --git a/src/Core/Banshee.ThickClient/Makefile.am b/src/Core/Banshee.ThickClient/Makefile.am
index d8ac95b..de69824 100644
--- a/src/Core/Banshee.ThickClient/Makefile.am
+++ b/src/Core/Banshee.ThickClient/Makefile.am
@@ -148,6 +148,7 @@ SOURCES =  \
 	Banshee.Sources.Gui/CellEditEntry.cs \
 	Banshee.Sources.Gui/CompositeTrackSourceContents.cs \
 	Banshee.Sources.Gui/FilteredListSourceContents.cs \
+	Banshee.Sources.Gui/IImplementsCustomSearch.cs \
 	Banshee.Sources.Gui/ISourceContents.cs \
 	Banshee.Sources.Gui/ITrackModelSourceContents.cs \
 	Banshee.Sources.Gui/LazyLoadSourceContents.cs \
diff --git a/src/Extensions/Banshee.Paas/Banshee.Paas/Banshee.Paas.Data/ListModel.cs b/src/Extensions/Banshee.Paas/Banshee.Paas/Banshee.Paas.Data/ListModel.cs
index bc25f01..35783eb 100644
--- a/src/Extensions/Banshee.Paas/Banshee.Paas/Banshee.Paas.Data/ListModel.cs
+++ b/src/Extensions/Banshee.Paas/Banshee.Paas/Banshee.Paas.Data/ListModel.cs
@@ -33,6 +33,7 @@ using Migo2.Collections;
 using Hyena.Data;
 using Hyena.Collections;
 
+using Hyena;
 using Banshee.Base;
 using Banshee.Paas.Utils;
 
@@ -167,6 +168,11 @@ namespace Banshee.Paas.Data
             OnReloaded ();
         }
 
+        public object GetItem(int index)
+        {
+            return GetIndex(index);
+        }
+
         private T GetIndex (int index)
         {
             if (index >= 0 && index < items.Count) {
diff --git a/src/Extensions/Banshee.Paas/Banshee.Paas/Banshee.Paas.DownloadManager.Gui/DownloadManagerInterface.cs b/src/Extensions/Banshee.Paas/Banshee.Paas/Banshee.Paas.DownloadManager.Gui/DownloadManagerInterface.cs
index 170bb48..996ad7b 100644
--- a/src/Extensions/Banshee.Paas/Banshee.Paas/Banshee.Paas.DownloadManager.Gui/DownloadManagerInterface.cs
+++ b/src/Extensions/Banshee.Paas/Banshee.Paas/Banshee.Paas.DownloadManager.Gui/DownloadManagerInterface.cs
@@ -32,6 +32,7 @@ using Gtk;
 using Migo2.Async;
 using Migo2.DownloadService;
 
+using Hyena;
 using Banshee.Base;
 using Banshee.ServiceStack;
 
diff --git a/src/Extensions/Banshee.Paas/Banshee.Paas/Banshee.Paas/PaasSource.cs b/src/Extensions/Banshee.Paas/Banshee.Paas/Banshee.Paas/PaasSource.cs
index 387cef3..f17970b 100644
--- a/src/Extensions/Banshee.Paas/Banshee.Paas/Banshee.Paas/PaasSource.cs
+++ b/src/Extensions/Banshee.Paas/Banshee.Paas/Banshee.Paas/PaasSource.cs
@@ -31,6 +31,7 @@ using System.Collections.Generic;
 
 using Mono.Unix;
 
+using Hyena;
 using Hyena.Collections;
 
 using Banshee.Base;



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