banshee r3273 - in trunk/banshee: . src/Clients/Nereid/Nereid src/Core/Banshee.ThickClient src/Core/Banshee.ThickClient/Banshee.Collection.Gui src/Core/Banshee.ThickClient/Banshee.Sources.Gui
- From: gburt svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r3273 - in trunk/banshee: . src/Clients/Nereid/Nereid src/Core/Banshee.ThickClient src/Core/Banshee.ThickClient/Banshee.Collection.Gui src/Core/Banshee.ThickClient/Banshee.Sources.Gui
- Date: Tue, 19 Feb 2008 21:14:32 +0000 (GMT)
Author: gburt
Date: Tue Feb 19 21:14:32 2008
New Revision: 3273
URL: http://svn.gnome.org/viewvc/banshee?rev=3273&view=rev
Log:
2008-02-19 Gabriel Burt <gabriel burt gmail com>
* src/Core/Banshee.ThickClient/Banshee.Sources.Gui/ISourceContents.cs: New
interface.
* src/Clients/Nereid/Nereid/PlayerInterface.cs: When the ActiveSource is
changed, call ISourceContents.ResetSource on the current SourceContents.
Check the new source for a NereidSourceContents property and use it if it
exists (allowing Sources to define custom views). And finally call
ISourceContents.SetSource on the new SourceContents.
* src/Core/Banshee.ThickClient/Banshee.Collection.Gui/CompositeTrackListView.cs:
* src/Core/Banshee.ThickClient/Banshee.Sources.Gui/CompositeTrackSourceContents.cs:
Move to Banshee.Sources.Gui and implement ISourceContents.
* src/Core/Banshee.ThickClient/Banshee.Sources.Gui/ObjectListSourceContents.cs:
New class that wraps a ObjectListView in a ScrolledWindow and implements
ISourceContents.
* src/Clients/Nereid/Nereid/ViewContainer.cs: Defined Contents as a
ISourceContents not a Widget.
* src/Core/Banshee.ThickClient/Makefile.am: Updated.
Added:
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/CompositeTrackSourceContents.cs (contents, props changed)
- copied, changed from r3271, /trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/CompositeTrackListView.cs
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/ISourceContents.cs
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/ObjectListSourceContents.cs
Removed:
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/CompositeTrackListView.cs
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Clients/Nereid/Nereid/PlayerInterface.cs
trunk/banshee/src/Clients/Nereid/Nereid/ViewContainer.cs
trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am
Modified: trunk/banshee/src/Clients/Nereid/Nereid/PlayerInterface.cs
==============================================================================
--- trunk/banshee/src/Clients/Nereid/Nereid/PlayerInterface.cs (original)
+++ trunk/banshee/src/Clients/Nereid/Nereid/PlayerInterface.cs Tue Feb 19 21:14:32 2008
@@ -62,9 +62,8 @@
// Major Interaction Components
private SourceView source_view;
- private CompositeTrackListView composite_view;
- private ScrolledWindow object_view_scroll;
- private ObjectListView object_view;
+ private CompositeTrackSourceContents composite_view;
+ private ObjectListSourceContents object_view;
private Label status_label;
public PlayerInterface () : base ("Banshee Music Player")
@@ -152,7 +151,7 @@
view_container = new ViewContainer ();
source_view = new SourceView ();
- composite_view = new CompositeTrackListView ();
+ composite_view = new CompositeTrackSourceContents ();
Hyena.Widgets.ScrolledWindow source_scroll = new Hyena.Widgets.ScrolledWindow ();
source_scroll.AddWithFrame (source_view);
@@ -269,7 +268,6 @@
}
view_container.Title = source.Name;
-
view_container.SearchEntry.Ready = false;
view_container.SearchEntry.CancelSearch ();
@@ -278,36 +276,28 @@
view_container.SearchEntry.ActivateFilter ((int)source.FilterType);
}
- // Clear any models previously connected to the views
- if (!(source is ITrackModelSource)) {
- composite_view.SetModels (null, null, null);
- composite_view.TrackView.HeaderVisible = false;
- } else if (!(source is Hyena.Data.IObjectListModel)) {
- if (object_view != null) {
- object_view.SetModel(null);
- }
+ if (view_container.Content != null) {
+ view_container.Content.ResetSource ();
}
-
+
// Connect the source models to the views if possible
- if (source is ITrackModelSource) {
+ if (source.Properties.Contains ("NereidSourceContents")) {
+ view_container.Content = source.Properties.Get<ISourceContents> ("NereidView");
+ view_container.Content.SetSource (source);
+ } else if (source is ITrackModelSource) {
if (composite_view.TrackModel != null) {
composite_view.TrackModel.Reloaded -= HandleTrackModelReloaded;
}
- ITrackModelSource track_source = (ITrackModelSource)source;
- composite_view.SetModels (track_source.TrackModel, track_source.ArtistModel, track_source.AlbumModel);
+ composite_view.SetSource (source);
composite_view.TrackModel.Reloaded += HandleTrackModelReloaded;
- composite_view.TrackView.HeaderVisible = true;
view_container.Content = composite_view;
} else if (source is Hyena.Data.IObjectListModel) {
if (object_view == null) {
- object_view_scroll = new ScrolledWindow ();
- object_view = new Hyena.Data.Gui.ObjectListView ();
- object_view_scroll.Add (object_view);
- object_view.Show ();
+ object_view = new ObjectListSourceContents ();
}
- object_view.SetModel((Hyena.Data.IObjectListModel)source);
- view_container.Content = object_view_scroll;
+ view_container.Content = object_view;
+ view_container.Content.SetSource (source);
}
UpdateStatusBar ();
Modified: trunk/banshee/src/Clients/Nereid/Nereid/ViewContainer.cs
==============================================================================
--- trunk/banshee/src/Clients/Nereid/Nereid/ViewContainer.cs (original)
+++ trunk/banshee/src/Clients/Nereid/Nereid/ViewContainer.cs Tue Feb 19 21:14:32 2008
@@ -32,10 +32,12 @@
using Banshee.Widgets;
using Banshee.Gui.Widgets;
+using Banshee.Sources.Gui;
using Banshee.Collection;
namespace Nereid
{
+
public class ViewContainer : VBox
{
private SearchEntry search_entry;
@@ -43,7 +45,7 @@
private Label title_label;
private Label search_label;
- private Widget content;
+ private ISourceContents content;
public ViewContainer ()
{
@@ -110,22 +112,22 @@
get { return search_entry; }
}
- public Widget Content {
+ public ISourceContents Content {
get { return content; }
set {
if (content == value)
return;
if (content != null) {
- content.Hide ();
- Remove (content);
+ content.Widget.Hide ();
+ Remove (content.Widget);
}
content = value;
if (content != null) {
- PackStart (content, true, true, 0);
- content.Show ();
+ PackStart (content.Widget, true, true, 0);
+ content.Widget.Show ();
}
}
}
Copied: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/CompositeTrackSourceContents.cs (from r3271, /trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/CompositeTrackListView.cs)
==============================================================================
--- /trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/CompositeTrackListView.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/CompositeTrackSourceContents.cs Tue Feb 19 21:14:32 2008
@@ -1,5 +1,5 @@
//
-// CompositeTrackListView.cs
+// CompositeTrackSourceContents.cs
//
// Author:
// Aaron Bockover <abockover novell com>
@@ -38,15 +38,15 @@
using Hyena.Data.Gui;
using Banshee.Sources;
-
-using Banshee.Gui;
using Banshee.ServiceStack;
using Banshee.Collection;
using Banshee.Configuration;
+using Banshee.Gui;
+using Banshee.Collection.Gui;
-namespace Banshee.Collection.Gui
+namespace Banshee.Sources.Gui
{
- public class CompositeTrackListView : VBox
+ public class CompositeTrackSourceContents : VBox, ISourceContents
{
private ArtistListView artist_view;
private AlbumListView album_view;
@@ -84,7 +84,7 @@
</ui>
";
- public CompositeTrackListView ()
+ public CompositeTrackSourceContents ()
{
string position = BrowserPosition.Get ();
if (position == "top") {
@@ -380,6 +380,40 @@
return ((ITrackModelSource)ServiceManager.SourceManager.ActiveSource).ShowBrowser;
}
}
+
+#region Implement ISourceContents
+
+ private Source source;
+
+ public bool SetSource (Source source)
+ {
+ ITrackModelSource track_source = source as ITrackModelSource;
+ if (track_source == null) {
+ return false;
+ }
+
+ this.source = source;
+ SetModels (track_source.TrackModel, track_source.ArtistModel, track_source.AlbumModel);
+ TrackView.HeaderVisible = true;
+ return true;
+ }
+
+ public void ResetSource ()
+ {
+ source = null;
+ SetModels (null, null, null);
+ TrackView.HeaderVisible = false;
+ }
+
+ public Source Source {
+ get { return source; }
+ }
+
+ public Widget Widget {
+ get { return this; }
+ }
+
+#endregion
public static readonly SchemaEntry<bool> BrowserVisible = new SchemaEntry<bool> (
"browser", "visible",
Added: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/ISourceContents.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/ISourceContents.cs Tue Feb 19 21:14:32 2008
@@ -0,0 +1,44 @@
+//
+// ISourceContents.cs
+//
+// Author:
+// Gabriel Burt <gburt novell com>
+//
+// Copyright (C) 2007 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 Banshee.Sources;
+
+namespace Banshee.Sources.Gui
+{
+ public interface ISourceContents
+ {
+ bool SetSource (Source source);
+ void ResetSource ();
+ Source Source { get; }
+ Widget Widget { get; }
+ }
+}
Added: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/ObjectListSourceContents.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/ObjectListSourceContents.cs Tue Feb 19 21:14:32 2008
@@ -0,0 +1,81 @@
+//
+// ObjectListSourceContents.cs
+//
+// Author:
+// 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.Reflection;
+using System.Collections.Generic;
+
+using Gtk;
+using Mono.Unix;
+
+using Hyena.Data;
+using Hyena.Data.Gui;
+
+using Banshee.Sources;
+using Banshee.ServiceStack;
+using Banshee.Collection;
+using Banshee.Configuration;
+using Banshee.Gui;
+using Banshee.Collection.Gui;
+
+namespace Banshee.Sources.Gui
+{
+ public class ObjectListSourceContents : ScrolledWindow, ISourceContents
+ {
+ private ObjectListView object_view;
+ private Source source;
+
+ public ObjectListSourceContents () : base ()
+ {
+ object_view = new ObjectListView ();
+ Add (object_view);
+ object_view.Show ();
+ }
+
+ public void ResetSource ()
+ {
+ source = null;
+ object_view.SetModel (null);
+ }
+
+ public bool SetSource (Source source)
+ {
+ object_view.SetModel((Hyena.Data.IObjectListModel)source);
+ this.source = source;
+ return true;
+ }
+
+ public Source Source {
+ get { return source; }
+ }
+
+ public Widget Widget {
+ get { return this; }
+ }
+ }
+}
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am Tue Feb 19 21:14:32 2008
@@ -18,7 +18,6 @@
Banshee.Collection.Gui/ColumnCellDuration.cs \
Banshee.Collection.Gui/ColumnCellPlaybackIndicator.cs \
Banshee.Collection.Gui/ColumnCellTrackNumber.cs \
- Banshee.Collection.Gui/CompositeTrackListView.cs \
Banshee.Collection.Gui/PersistentColumnController.cs \
Banshee.Collection.Gui/TrackListView.cs \
Banshee.Equalizer.Gui/EqualizerBandScale.cs \
@@ -71,6 +70,9 @@
Banshee.Query.Gui/SmartPlaylistQueryValueEntry.cs \
Banshee.SmartPlaylist.Gui/Editor.cs \
Banshee.Sources.Gui/CellEditEntry.cs \
+ Banshee.Sources.Gui/CompositeTrackSourceContents.cs \
+ Banshee.Sources.Gui/ObjectListSourceContents.cs \
+ Banshee.Sources.Gui/ISourceContents.cs \
Banshee.Sources.Gui/SourceIconResolver.cs \
Banshee.Sources.Gui/SourceRowRenderer.cs \
Banshee.Sources.Gui/SourceView.cs \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]