[banshee] CompositeTrackSourceContents: Add option to hide the artist filter
- From: Bertrand Lorentz <blorentz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] CompositeTrackSourceContents: Add option to hide the artist filter
- Date: Sun, 22 Jan 2012 16:00:28 +0000 (UTC)
commit 7ea4e92becba07e27b97ce56de9a0ca8a879221c
Author: Bertrand Lorentz <bertrand lorentz gmail com>
Date: Sun Jan 22 16:34:49 2012 +0100
CompositeTrackSourceContents: Add option to hide the artist filter
Thanks to the work done for configurable browser filters, we can now
make the artist filter optional. Hide the list of artist names and
just enjoy your album covers !
The artist filter is still displayed by default, so this doesn't change
the default UI.
.../CompositeTrackSourceContents.cs | 48 +++++++++++++++++++-
1 files changed, 46 insertions(+), 2 deletions(-)
---
diff --git a/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/CompositeTrackSourceContents.cs b/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/CompositeTrackSourceContents.cs
index f21535d..658b377 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/CompositeTrackSourceContents.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/CompositeTrackSourceContents.cs
@@ -68,6 +68,8 @@ namespace Banshee.Sources.Gui
<menu name=""ViewMenu"" action=""ViewMenuAction"">
<placeholder name=""BrowserViews"">
<menu name=""BrowserContentMenu"" action=""BrowserContentMenuAction"">
+ <menuitem name=""ShowArtistFilter"" action=""ShowArtistFilterAction"" />
+ <separator />
<menuitem name=""ShowTrackArtistFilter"" action=""ShowTrackArtistFilterAction"" />
<menuitem name=""ShowAlbumArtistFilter"" action=""ShowAlbumArtistFilterAction"" />
<separator />
@@ -95,6 +97,11 @@ namespace Banshee.Sources.Gui
Catalog.GetString ("Configure the filters available in the browser"), null)
});
+ configure_browser_actions.Add (new ToggleActionEntry [] {
+ new ToggleActionEntry ("ShowArtistFilterAction", null,
+ Catalog.GetString ("Show Artist Filter"), null,
+ Catalog.GetString ("Show a list of artists to filter by"), null, ArtistFilterVisible.Get ())});
+
configure_browser_actions.Add (new RadioActionEntry [] {
new RadioActionEntry ("ShowTrackArtistFilterAction", null,
Catalog.GetString ("Show all Artists"), null,
@@ -119,11 +126,35 @@ namespace Banshee.Sources.Gui
action_service.UIManager.AddUiFromString (menu_xml);
}
- (action_service.FindAction("BrowserConfiguration.ShowTrackArtistFilterAction") as RadioAction).Changed += OnArtistFilterChanged;
- (action_service.FindAction("BrowserConfiguration.ShowAlbumArtistFilterAction") as RadioAction).Changed += OnArtistFilterChanged;
+ action_service.FindAction("BrowserConfiguration.ShowArtistFilterAction").Activated += OnArtistFilterVisibilityChanged;
action_service.FindAction("BrowserConfiguration.ShowGenreFilterAction").Activated += OnGenreFilterChanged;;
action_service.FindAction("BrowserConfiguration.ShowYearFilterAction").Activated += OnYearFilterChanged;;
+
+ var artist_filter_action = action_service.FindAction("BrowserConfiguration.ShowTrackArtistFilterAction") as RadioAction;
+ var albumartist_filter_action = action_service.FindAction("BrowserConfiguration.ShowAlbumArtistFilterAction") as RadioAction;
+ artist_filter_action.Changed += OnArtistFilterChanged;
+ artist_filter_action.Sensitive = ArtistFilterVisible.Get ();
+ albumartist_filter_action.Changed += OnArtistFilterChanged;
+ albumartist_filter_action.Sensitive = ArtistFilterVisible.Get ();
+ }
+ }
+
+ private void OnArtistFilterVisibilityChanged (object o, EventArgs args)
+ {
+ ToggleAction action = (ToggleAction)o;
+
+ ClearFilterSelections ();
+
+ ArtistFilterVisible.Set (action.Active);
+
+ if (artist_view !=null && artist_view.Parent !=null) {
+ artist_view.Parent.Visible = ArtistFilterVisible.Get ();
+ } else if (albumartist_view != null && albumartist_view.Parent != null) {
+ albumartist_view.Parent.Visible = ArtistFilterVisible.Get ();
}
+
+ action_service.FindAction("BrowserConfiguration.ShowTrackArtistFilterAction").Sensitive = ArtistFilterVisible.Get ();
+ action_service.FindAction("BrowserConfiguration.ShowAlbumArtistFilterAction").Sensitive = ArtistFilterVisible.Get ();
}
private void OnGenreFilterChanged (object o, EventArgs args)
@@ -202,9 +233,15 @@ namespace Banshee.Sources.Gui
if (ArtistFilterType.Get ().Equals ("artist")) {
SetupFilterView (artist_view = new ArtistListView ());
+ artist_view.Parent.Shown += delegate {
+ artist_view.Parent.Visible = ArtistFilterVisible.Get ();
+ };
albumartist_view = new ArtistListView ();
} else {
SetupFilterView (albumartist_view = new ArtistListView ());
+ albumartist_view.Parent.Shown += delegate {
+ albumartist_view.Parent.Visible = ArtistFilterVisible.Get ();
+ };
artist_view = new ArtistListView ();
}
@@ -322,6 +359,13 @@ namespace Banshee.Sources.Gui
#endregion
+ public static readonly SchemaEntry<bool> ArtistFilterVisible = new SchemaEntry<bool> (
+ "browser", "show_artist_filter",
+ true,
+ "Artist Filter Visibility",
+ "Whether or not to show the Artist filter"
+ );
+
public static readonly SchemaEntry<string> ArtistFilterType = new SchemaEntry<string> (
"browser", "artist_filter_type",
"artist",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]