[banshee] Audiobook: Add a button to go back to the list of audiobooks



commit fca7d797b08b25eb25b89ee1338c9c187097086a
Author: Bertrand Lorentz <bertrand lorentz gmail com>
Date:   Wed Dec 21 19:49:45 2011 +0100

    Audiobook: Add a button to go back to the list of audiobooks
    
    Previously, the button to go back to the list of audiobooks (aka
    GridView) was in the TitleWidget. That widget is not displayed anymore
    in the UI, so we can remove the code using it.
    
    Add a "Go to Audiobooks" button in the SourceActions placeholder, to
    replace that lost UI and allow users to go back to the GridView. Fixes
    bgo#656439.

 .../Banshee.Audiobook/Banshee.Audiobook/Actions.cs |    3 ++-
 .../Banshee.Audiobook/AudiobookLibrarySource.cs    |   19 +------------------
 .../Banshee.Audiobook/Resources/ActiveSourceUI.xml |    1 +
 3 files changed, 4 insertions(+), 19 deletions(-)
---
diff --git a/src/Extensions/Banshee.Audiobook/Banshee.Audiobook/Actions.cs b/src/Extensions/Banshee.Audiobook/Banshee.Audiobook/Actions.cs
index 57641e9..ae9d4e5 100644
--- a/src/Extensions/Banshee.Audiobook/Banshee.Audiobook/Actions.cs
+++ b/src/Extensions/Banshee.Audiobook/Banshee.Audiobook/Actions.cs
@@ -54,7 +54,7 @@ namespace Banshee.Audiobook
                 new ActionEntry ("AudiobookBookPopup", null, null, null, null, (o, a) => ShowContextMenu ("/AudiobookBookPopup")),
                 new ActionEntry ("AudiobookOpen", null, Catalog.GetString ("Open Book"), null, null, OnOpen),
                 new ActionEntry ("AudiobookMerge", null, Catalog.GetString ("Merge Discs..."), null, null, OnMerge),
-                new ActionEntry ("AudiobookSwitchToGrid", null, "", "Escape", null, (o, a) => library.SwitchToGridView ()),
+                new ActionEntry ("AudiobookSwitchToGrid", null, Catalog.GetString ("Go to Audiobooks"), "Escape", null, (o, a) => library.SwitchToGridView ()),
                 new ActionEntry ("AudiobookEdit", Stock.Edit,
                     Catalog.GetString ("_Edit Track Information"), "E", null, OnEdit),
                 new ActionEntry ("AudiobookResumeSelected", Stock.MediaPlay,
@@ -96,6 +96,7 @@ namespace Banshee.Audiobook
             }
             UpdateAction ("AudiobookResume", library.CurrentViewBook != null, can_resume);
             UpdateAction ("AudiobookResumeSelected", can_resume, true);
+            UpdateAction ("AudiobookSwitchToGrid", library.CurrentViewBook != null, true);
         }
 
         private void OnResume (object to, EventArgs a)
diff --git a/src/Extensions/Banshee.Audiobook/Banshee.Audiobook/AudiobookLibrarySource.cs b/src/Extensions/Banshee.Audiobook/Banshee.Audiobook/AudiobookLibrarySource.cs
index 5fa73b0..9335fc0 100644
--- a/src/Extensions/Banshee.Audiobook/Banshee.Audiobook/AudiobookLibrarySource.cs
+++ b/src/Extensions/Banshee.Audiobook/Banshee.Audiobook/AudiobookLibrarySource.cs
@@ -60,9 +60,6 @@ namespace Banshee.Audiobook
 
         public BookPlaylist PlaybackSource { get; private set; }
 
-        Gtk.HBox title_switcher;
-        Gtk.Label book_label;
-
         public Actions Actions { get; private set; }
 
         public AudiobookLibrarySource () : base (Catalog.GetString ("Audiobooks"), "AudiobookLibrary", 49)
@@ -107,17 +104,6 @@ namespace Banshee.Audiobook
             Properties.Set<bool> ("ActiveSourceUIResourcePropagate", true);
             Properties.Set<System.Action> ("ActivationAction", delegate { SwitchToGridView (); });
 
-            title_switcher = new Gtk.HBox () { Spacing = 0 };
-            var title_label = new Gtk.Label () { Markup = String.Format ("<b>{0}</b>", GLib.Markup.EscapeText (this.Name)) };
-            var b = new Gtk.Button (title_label) { Relief = Gtk.ReliefStyle.None };
-            b.Clicked += delegate { SwitchToGridView (); };
-            title_switcher.PackStart (b);
-
-            title_switcher.ShowAll ();
-            book_label = new Gtk.Label () { Visible = false };
-            title_switcher.PackStart (book_label);
-            Properties.Set<Gtk.Widget> ("Nereid.SourceContents.TitleWidget", title_switcher);
-
             TracksAdded += (o, a) => {
                 if (!IsAdding) {
                     MergeBooksAddedSince (DateTime.Now - TimeSpan.FromHours (2));
@@ -170,7 +156,6 @@ namespace Banshee.Audiobook
             var last_book = CurrentViewBook;
             if (last_book != null) {
                 CurrentViewBook = null;
-                book_label.Visible = false;
                 Properties.Set<ISourceContents> ("Nereid.SourceContents", grid_view);
                 Actions.UpdateActions ();
             }
@@ -178,10 +163,8 @@ namespace Banshee.Audiobook
 
         public void SwitchToBookView (DatabaseAlbumInfo book)
         {
-            if (!book_label.Visible) {
+            if (CurrentViewBook == null) {
                 CurrentViewBook = book;
-                book_label.Text = String.Format (" Â  {0}", book.DisplayTitle);
-                book_label.Visible = true;
                 book_view.SetSource (this);
                 book_view.Contents.SetBook (book);
                 Properties.Set<ISourceContents> ("Nereid.SourceContents", book_view);
diff --git a/src/Extensions/Banshee.Audiobook/Resources/ActiveSourceUI.xml b/src/Extensions/Banshee.Audiobook/Resources/ActiveSourceUI.xml
index 0d11bd7..9b7436a 100644
--- a/src/Extensions/Banshee.Audiobook/Resources/ActiveSourceUI.xml
+++ b/src/Extensions/Banshee.Audiobook/Resources/ActiveSourceUI.xml
@@ -1,6 +1,7 @@
 <ui>
     <toolbar name="HeaderToolbar">
         <placeholder name="SourceActions">
+            <toolitem action="AudiobookSwitchToGrid"/>
         </placeholder>
     </toolbar>
     <menubar name="MainMenu">



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