banshee r3605 - in trunk/banshee: . src/Clients/Nereid/Nereid src/Core/Banshee.Services/Banshee.Sources src/Core/Banshee.ThickClient src/Core/Banshee.ThickClient/Banshee.Gui src/Core/Banshee.ThickClient/Banshee.Sources.Gui src/Core/Banshee.ThickClient/Resources src/Libraries/Hyena.Gui src/Libraries/Hyena.Gui/Hyena.Data.Gui src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView
- From: gburt svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r3605 - in trunk/banshee: . src/Clients/Nereid/Nereid src/Core/Banshee.Services/Banshee.Sources src/Core/Banshee.ThickClient src/Core/Banshee.ThickClient/Banshee.Gui src/Core/Banshee.ThickClient/Banshee.Sources.Gui src/Core/Banshee.ThickClient/Resources src/Libraries/Hyena.Gui src/Libraries/Hyena.Gui/Hyena.Data.Gui src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView
- Date: Mon, 31 Mar 2008 00:53:15 +0100 (BST)
Author: gburt
Date: Mon Mar 31 00:53:15 2008
New Revision: 3605
URL: http://svn.gnome.org/viewvc/banshee?rev=3605&view=rev
Log:
2008-03-30 Gabriel Burt <gabriel burt gmail com>
This commit adds Jump to Playing support, and hides the search box for
sources that can't be search.
* Makefile.am: Add make test target.
* src/Clients/Nereid/Nereid/ViewContainer.cs: Keep the visibility of the
search entry tied to whether its sensitive (eg hide if !source.CanSearch).
* src/Clients/Nereid/Nereid/PlayerInterface.cs: When changing the active
source is changed, if the view used implements the new
ITrackModelSourceContents interface, set some properties on the source
itself linking ith with the Track/Artist/Album views.
* src/Core/Banshee.Services/Banshee.Sources/SourceManager.cs: Be even more
defensive when setting the active source.
* src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml:
* src/Core/Banshee.ThickClient/Banshee.Gui/PlaybackActions.cs: Add Jump to
Playing Song/Video action.
* src/Core/Banshee.ThickClient/Makefile.am:
* src/Core/Banshee.ThickClient/Banshee.Sources.Gui/ITrackModelSourceContents.cs:
New interface for source contents that have track, artist, and album
IListView<T>s.
* src/Core/Banshee.ThickClient/Banshee.Sources.Gui/CompositeTrackSourceContents.cs:
Implement ITrackModelSourceContents.
* src/Libraries/Hyena.Gui/Makefile.am:
* src/Libraries/Hyena.Gui/Hyena.Data.Gui/IListView.cs: New interface that
ListView implements. Will allow us to implement alternative views for
track/artist/albums but still have some sharing functionality (like jump
to playing track).
* src/Libraries/Hyena.Gui/Hyena.Data.Gui/Column.cs: Fix newlines.
* src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView.cs: Implement
IListView.
* src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs:
Change ScrollToRow to ScrollTo, and add CenterOn method (both implementing
IListView).
* src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Model.cs: Use
CenterOn method instead of implementing it here too.
Added:
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/ITrackModelSourceContents.cs
trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/IListView.cs
Modified:
trunk/banshee/ChangeLog
trunk/banshee/Makefile.am
trunk/banshee/src/Clients/Nereid/Nereid/PlayerInterface.cs
trunk/banshee/src/Clients/Nereid/Nereid/ViewContainer.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/SourceManager.cs
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/PlaybackActions.cs
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/CompositeTrackSourceContents.cs
trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am
trunk/banshee/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml
trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Column.cs
trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView.cs
trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs
trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Model.cs
trunk/banshee/src/Libraries/Hyena.Gui/Makefile.am
Modified: trunk/banshee/Makefile.am
==============================================================================
--- trunk/banshee/Makefile.am (original)
+++ trunk/banshee/Makefile.am Mon Mar 31 00:53:15 2008
@@ -64,6 +64,11 @@
$(MONO) --debug $(BANSHEE_DEV_MONO_OPTIONS) Nereid.exe --debug --uninstalled $(BANSHEE_DEV_OPTIONS); \
popd;
+test:
+ @pushd tests; \
+ make run-test \
+ popd;
+
clean-local:
rm -rf $(top_builddir)/bin
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 Mon Mar 31 00:53:15 2008
@@ -324,7 +324,15 @@
} else {
view_container.Hide ();
}
-
+
+ // Associate the view with the model
+ if (view_container.Visible && view_container.Content is ITrackModelSourceContents) {
+ ITrackModelSourceContents track_content = view_container.Content as ITrackModelSourceContents;
+ source.Properties.Set<IListView<TrackInfo>> ("Track.IListView", track_content.TrackView);
+ source.Properties.Set<IListView<ArtistInfo>> ("Artist.IListView", track_content.ArtistView);
+ source.Properties.Set<IListView<AlbumInfo>> ("Album.IListView", track_content.AlbumView);
+ }
+
view_container.Header.Visible = source.Properties.Contains ("Nereid.SourceContents.HeaderVisible") ?
source.Properties.Get<bool> ("Nereid.SourceContents.HeaderVisible") : true;
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 Mon Mar 31 00:53:15 2008
@@ -159,6 +159,8 @@
set {
search_entry.Sensitive = value;
search_label.Sensitive = value;
+ search_entry.Visible = value;
+ search_label.Visible = value;
}
}
}
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/SourceManager.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/SourceManager.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/SourceManager.cs Mon Mar 31 00:53:15 2008
@@ -249,7 +249,7 @@
public void SetActiveSource(Source source, bool notify)
{
- if(active_source == source) {
+ if(source == null || active_source == source) {
return;
}
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/PlaybackActions.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/PlaybackActions.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/PlaybackActions.cs Mon Mar 31 00:53:15 2008
@@ -30,8 +30,11 @@
using Mono.Unix;
using Gtk;
+using Hyena.Data.Gui;
+
using Banshee.Base;
using Banshee.Collection;
+using Banshee.Sources;
using Banshee.Configuration;
using Banshee.ServiceStack;
using Banshee.MediaEngine;
@@ -70,6 +73,10 @@
new ActionEntry ("SeekToAction", null,
Catalog.GetString ("Seek _to..."), "T",
Catalog.GetString ("Seek to a specific location in current item"), OnSeekToAction),
+
+ new ActionEntry ("JumpToPlayingTrackAction", null,
+ Catalog.GetString("_Jump to Playing Song"), "<control>J",
+ Catalog.GetString ("Jump to the currently playing item"), OnJumpToPlayingTrack),
new ActionEntry ("RestartSongAction", null,
Catalog.GetString ("_Restart Song"), "R",
@@ -133,6 +140,9 @@
action_service["Playback.RestartSongAction"].Label = (track.MediaAttributes & TrackMediaAttributes.VideoStream) == 0
? Catalog.GetString ("_Restart Song")
: Catalog.GetString ("_Restart Video");
+ action_service["Playback.JumpToPlayingTrackAction"].Label = (track.MediaAttributes & TrackMediaAttributes.VideoStream) == 0
+ ? Catalog.GetString ("_Jump to Playing Song")
+ : Catalog.GetString ("_Jump to Playing Video");
break;
case PlayerEngineEvent.EndOfStream:
ToggleAction stop_action = (ToggleAction)action_service["Playback.StopWhenFinishedAction"];
@@ -200,6 +210,27 @@
{
ServiceManager.PlaybackController.StopWhenFinished = ((ToggleAction)o).Active;
}
+
+ private void OnJumpToPlayingTrack (object o, EventArgs args)
+ {
+ Source playback_src = ServiceManager.PlaybackController.Source as Source;
+
+ if (playback_src != null && playback_src is ITrackModelSource) {
+ ITrackModelSource track_src = (playback_src as ITrackModelSource);
+ int i = track_src.TrackModel.IndexOf (ServiceManager.PlaybackController.CurrentTrack);
+ if (i != -1) {
+ // TODO clear the search/filters if there are any, since they might be hiding the currently playing item?
+ IListView<TrackInfo> track_list = (track_src as Source).Properties.Get<IListView<TrackInfo>> ("Track.IListView");
+ if (track_list != null) {
+ Console.WriteLine ("playing track is index {0}, jumping!", i);
+ ServiceManager.SourceManager.SetActiveSource (playback_src);
+ track_src.TrackModel.Selection.Clear (false);
+ track_src.TrackModel.Selection.Select (i);
+ track_list.CenterOn (i);
+ }
+ }
+ }
+ }
private void OnShuffleAction (object o, EventArgs args)
{
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/CompositeTrackSourceContents.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/CompositeTrackSourceContents.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/CompositeTrackSourceContents.cs Mon Mar 31 00:53:15 2008
@@ -46,7 +46,7 @@
namespace Banshee.Sources.Gui
{
- public class CompositeTrackSourceContents : VBox, ISourceContents
+ public class CompositeTrackSourceContents : VBox, ITrackModelSourceContents
{
private ArtistListView artist_view;
private AlbumListView album_view;
@@ -321,6 +321,18 @@
}
}
+ IListView<TrackInfo> ITrackModelSourceContents.TrackView {
+ get { return track_view; }
+ }
+
+ IListView<ArtistInfo> ITrackModelSourceContents.ArtistView {
+ get { return artist_view; }
+ }
+
+ IListView<AlbumInfo> ITrackModelSourceContents.AlbumView {
+ get { return album_view; }
+ }
+
public TrackListView TrackView {
get { return track_view; }
}
@@ -367,7 +379,7 @@
}
SetModels (track_source.TrackModel, track_source.ArtistModel, track_source.AlbumModel);
- TrackView.HeaderVisible = true;
+ track_view.HeaderVisible = true;
return true;
}
@@ -375,7 +387,7 @@
{
track_source = null;
SetModels (null, null, null);
- TrackView.HeaderVisible = false;
+ track_view.HeaderVisible = false;
}
public ISource Source {
Added: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/ITrackModelSourceContents.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/ITrackModelSourceContents.cs Mon Mar 31 00:53:15 2008
@@ -0,0 +1,44 @@
+//
+// ITrackModelSourceContents.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 Hyena.Data.Gui;
+
+using Banshee.Collection;
+using Banshee.Sources;
+
+namespace Banshee.Sources.Gui
+{
+ public interface ITrackModelSourceContents : ISourceContents
+ {
+ IListView<TrackInfo> TrackView { get; }
+ IListView<ArtistInfo> ArtistView { get; }
+ IListView<AlbumInfo> AlbumView { get; }
+ }
+}
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 Mon Mar 31 00:53:15 2008
@@ -78,6 +78,7 @@
Banshee.Sources.Gui/CellEditEntry.cs \
Banshee.Sources.Gui/CompositeTrackSourceContents.cs \
Banshee.Sources.Gui/ISourceContents.cs \
+ Banshee.Sources.Gui/ITrackModelSourceContents.cs \
Banshee.Sources.Gui/ObjectListSourceContents.cs \
Banshee.Sources.Gui/SourceIconResolver.cs \
Banshee.Sources.Gui/SourceRowRenderer.cs \
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml Mon Mar 31 00:53:15 2008
@@ -71,6 +71,7 @@
<menuitem name="SeekForward" action="SeekForwardAction"/>
-->
<menuitem name="SeekTo" action="SeekToAction"/>
+ <menuitem name="JumpToPlayingTrack" action="JumpToPlayingTrackAction"/>
<menuitem name="RestartSong" action="RestartSongAction"/>
<separator/>
<placeholder name="PlaybackMenuAdditions"/>
@@ -142,7 +143,7 @@
<menuitem name="SearchForSameAlbum" action="SearchForSameAlbumAction"/>
</menu>
<separator/>
- <!--<menuitem name="JumpToPlayingTrack" action="JumpToPlayingTrackAction"/>-->
+ <menuitem name="JumpToPlayingTrack" action="JumpToPlayingTrackAction"/>
<separator/>
<menuitem name="TrackProperties" action="TrackPropertiesAction"/>
</popup>
Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Column.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Column.cs (original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Column.cs Mon Mar 31 00:53:15 2008
@@ -42,8 +42,8 @@
private List<ColumnCell> cells = new List<ColumnCell> ();
private int minWidth = 0;
- private int maxWidth = Int32.MaxValue;
- private double minRelativeWidth = 0;
+ private int maxWidth = Int32.MaxValue;
+ private double minRelativeWidth = 0;
private double relativeWidth = 0;
public Column (ColumnDescription description) :
@@ -114,28 +114,28 @@
set { header_cell = value; }
}
- public int MinWidth
- {
- get { return minWidth; }
- set { minWidth = value; }
- }
-
- internal double MinRelativeWidth
- {
- get { return minRelativeWidth; }
- set { minRelativeWidth = value; }
+ public int MinWidth
+ {
+ get { return minWidth; }
+ set { minWidth = value; }
+ }
+
+ internal double MinRelativeWidth
+ {
+ get { return minRelativeWidth; }
+ set { minRelativeWidth = value; }
}
public int MaxWidth {
get { return maxWidth; }
set { maxWidth = value; }
- }
-
- public double RelativeWidth
- {
- get { return relativeWidth; }
- set { relativeWidth = value; }
- }
+ }
+
+ public double RelativeWidth
+ {
+ get { return relativeWidth; }
+ set { relativeWidth = value; }
+ }
public string Id {
get { return StringUtil.CamelCaseToUnderCase (GetCell (0).Property); }
Added: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/IListView.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/IListView.cs Mon Mar 31 00:53:15 2008
@@ -0,0 +1,40 @@
+//
+// IListView.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.
+//
+
+namespace Hyena.Data.Gui
+{
+ public interface IListView<T>
+ {
+ void SetModel (IListModel<T> model);
+ IListModel<T> Model { get; }
+
+ void ScrollTo (int index);
+ void CenterOn (int index);
+ ColumnController ColumnController { get; set; }
+ }
+}
Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView.cs (original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView.cs Mon Mar 31 00:53:15 2008
@@ -28,7 +28,7 @@
namespace Hyena.Data.Gui
{
- public partial class ListView<T> : Gtk.Container
+ public partial class ListView<T> : Gtk.Container, IListView<T>
{
public ListView ()
{
Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs (original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs Mon Mar 31 00:53:15 2008
@@ -503,14 +503,19 @@
InvalidateList (false);
}
- public void ScrollTo (double val)
+ protected void ScrollTo (double val)
{
vadjustment.Value = Math.Max (0.0, Math.Min (val, vadjustment.Upper - vadjustment.PageSize));
}
- public void ScrollToRow (int row_index)
+ public void ScrollTo (int index)
{
- ScrollTo (GetYAtRow (row_index));
+ ScrollTo (GetYAtRow (index));
+ }
+
+ public void CenterOn (int index)
+ {
+ ScrollTo (index - RowsInView/2 + 1);
}
protected override void OnSetScrollAdjustments (Adjustment hadj, Adjustment vadj)
Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Model.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Model.cs (original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Model.cs Mon Mar 31 00:53:15 2008
@@ -87,7 +87,7 @@
}
if (!selection_in_view) {
- ScrollToRow (Selection.Ranges[0].Start + 1 - RowsInView/2);
+ CenterOn (Selection.Ranges[0].Start);
}
} else {
ScrollTo (vadjustment.Value);
Modified: trunk/banshee/src/Libraries/Hyena.Gui/Makefile.am
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Makefile.am (original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Makefile.am Mon Mar 31 00:53:15 2008
@@ -9,6 +9,7 @@
Hyena.Data.Gui/ColumnController.cs \
Hyena.Data.Gui/ColumnHeaderCellText.cs \
Hyena.Data.Gui/IHeaderCell.cs \
+ Hyena.Data.Gui/IListView.cs \
Hyena.Data.Gui/ListView/ListView.cs \
Hyena.Data.Gui/ListView/ListView_DragAndDrop.cs \
Hyena.Data.Gui/ListView/ListView_Header.cs \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]