[banshee] [Nereid] Make UI cleaner



commit ef0c0a4afb05a3e810d018af46b8b5f50d56491f
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Sun Sep 5 09:12:28 2010 -0500

    [Nereid] Make UI cleaner
    
    Get rid of the source title/actions bar, moving the search entry up
    beside volume, and any custom widgets (like Play Queue's Auto DJ
    controls) beneath the source contents.

 src/Clients/Nereid/Nereid/PlayerInterface.cs       |   15 ++--
 src/Clients/Nereid/Nereid/ViewContainer.cs         |   91 ++++++--------------
 .../Resources/core-ui-actions-layout.xml           |    1 +
 .../Banshee.InternetArchive/HeaderFilters.cs       |    3 +-
 4 files changed, 39 insertions(+), 71 deletions(-)
---
diff --git a/src/Clients/Nereid/Nereid/PlayerInterface.cs b/src/Clients/Nereid/Nereid/PlayerInterface.cs
index 676b61f..20cdb9c 100644
--- a/src/Clients/Nereid/Nereid/PlayerInterface.cs
+++ b/src/Clients/Nereid/Nereid/PlayerInterface.cs
@@ -166,6 +166,11 @@ namespace Nereid
             BuildViews ();
             BuildFooter ();
 
+            var box = new Alignment (1.0f, 0.5f, 0f, 0f);
+            box.Child = view_container.SearchEntry;
+            ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/SearchEntry", box);
+            box.ShowAll ();
+
             primary_vbox.Show ();
             Add (primary_vbox);
         }
@@ -439,7 +444,6 @@ namespace Nereid
                     return;
                 }
 
-                view_container.Title = source.Name;
                 view_container.SearchEntry.Ready = false;
                 view_container.SearchEntry.CancelSearch ();
 
@@ -550,10 +554,10 @@ namespace Nereid
                 source.Properties.Set<IListView<TrackInfo>>  ("Track.IListView", track_content.TrackView);
             }
 
-            view_container.Header.Visible = source.Properties.Contains ("Nereid.SourceContents.HeaderVisible") ?
-                source.Properties.Get<bool> ("Nereid.SourceContents.HeaderVisible") : true;
-
-            view_container.SetTitleWidget (source.Properties.Get<Widget> ("Nereid.SourceContents.TitleWidget"));
+            var title_widget = source.Properties.Get<Widget> ("Nereid.SourceContents.TitleWidget");
+            if (title_widget != null) {
+                Hyena.Log.Warning ("Nereid.SourceContents.TitleWidget is no longer used (from {0})", source.Name);
+            }
 
             Widget header_widget = null;
             if (source.Properties.Contains ("Nereid.SourceContents.HeaderWidget")) {
@@ -579,7 +583,6 @@ namespace Nereid
             if (args.Source == ServiceManager.SourceManager.ActiveSource) {
                 ThreadAssist.ProxyToMain (delegate {
                     UpdateSourceInformation ();
-                    view_container.Title = args.Source.Name;
                 });
             }
         }
diff --git a/src/Clients/Nereid/Nereid/ViewContainer.cs b/src/Clients/Nereid/Nereid/ViewContainer.cs
index 5c59915..c7da08a 100644
--- a/src/Clients/Nereid/Nereid/ViewContainer.cs
+++ b/src/Clients/Nereid/Nereid/ViewContainer.cs
@@ -44,13 +44,9 @@ namespace Nereid
     public class ViewContainer : VBox
     {
         private SearchEntry search_entry;
-        private HBox header;
-        private Alignment header_align;
-        private EventBox header_box;
+        private Alignment source_actions_align;
+        private EventBox source_actions_box;
 
-        private EventBox default_title_box;
-        private Label title_label;
-        private HBox custom_title_box;
         private Banshee.ContextPane.ContextPane context_pane;
         private VBox footer;
 
@@ -66,44 +62,23 @@ namespace Nereid
 
         private void BuildHeader ()
         {
-            header_align = new Alignment (0.0f, 0.5f, 1.0f, 1.0f);
+            source_actions_align = new Gtk.Alignment (0f, .5f, 1f, 0f) {
+                RightPadding = 0,
+                LeftPadding = 0,
+                NoShowAll = true
+            };
+
             if (Hyena.PlatformDetection.IsMeeGo) {
-                header_align.RightPadding = 5;
-                header_align.TopPadding = 5;
+                source_actions_align.RightPadding = 5;
+                source_actions_align.TopPadding = 5;
             }
 
-            header = new HBox ();
             footer = new VBox ();
 
-            default_title_box = new EventBox ();
-            title_label = new Label ();
-            title_label.Xalign = 0.0f;
-            title_label.Ellipsize = Pango.EllipsizeMode.End;
-
-            default_title_box.Add (title_label);
-
-            // Show the source context menu when the title is right clicked
-            default_title_box.PopupMenu += delegate {
-                ServiceManager.Get<InterfaceActionService> ().SourceActions ["SourceContextMenuAction"].Activate ();
-            };
-
-            default_title_box.ButtonPressEvent += delegate (object o, ButtonPressEventArgs press) {
-                if (press.Event.Button == 3) {
-                    ServiceManager.Get<InterfaceActionService> ().SourceActions ["SourceContextMenuAction"].Activate ();
-                }
-            };
-
-            header_box = new EventBox ();
-
-            custom_title_box = new HBox () { Visible = false };
+            source_actions_box = new EventBox () { Visible = true };
 
             BuildSearchEntry ();
 
-            header.PackStart (default_title_box, true, true, 0);
-            header.PackStart (custom_title_box, true, true, 0);
-            header.PackStart (header_box, false, false, 0);
-            header.PackStart (search_entry, false, false, 0);
-
             InterfaceActionService uia = ServiceManager.Get<InterfaceActionService> ();
             if (uia != null) {
                 Gtk.Action action = uia.GlobalActions["WikiSearchHelpAction"];
@@ -119,20 +94,22 @@ namespace Nereid
                 }
             }
 
-            header_align.Add (header);
-            header_align.ShowAll ();
+            source_actions_box.ShowAll ();
+            source_actions_align.Add (source_actions_box);
+            source_actions_align.Hide ();
             search_entry.Show ();
 
-            PackStart (header_align, false, false, 0);
-            PackEnd (footer, false, false, 0);
 
             context_pane = new Banshee.ContextPane.ContextPane ();
             context_pane.ExpandHandler = b => {
                 SetChildPacking (content.Widget, !b, true, 0, PackType.Start);
                 SetChildPacking (context_pane, b, b, 0, PackType.End);
             };
-            PackEnd (context_pane, false, false, 0);
 
+            // Top to bottom, their order is reverse of this:
+            PackEnd (footer, false, false, 0);
+            PackEnd (context_pane, false, false, 0);
+            PackEnd (source_actions_align, false, false, 0);
             PackEnd (new ConnectedMessageBar (), false, true, 0);
         }
 
@@ -201,17 +178,17 @@ namespace Nereid
         public void SetHeaderWidget (Widget widget)
         {
             if (widget != null) {
-                header_box.Add (widget);
+                source_actions_box.Add (widget);
                 widget.Show ();
-                header_box.Show ();
+                source_actions_align.Show ();
             }
         }
 
         public void ClearHeaderWidget ()
         {
-            header_box.Hide ();
-            if (header_box.Child != null) {
-                header_box.Remove (header_box.Child);
+            source_actions_align.Hide ();
+            if (source_actions_box.Child != null) {
+                source_actions_box.Remove (source_actions_box.Child);
             }
         }
 
@@ -233,32 +210,19 @@ namespace Nereid
         }
 
         public Alignment Header {
-            get { return header_align; }
+            get { return source_actions_align; }
         }
 
         public SearchEntry SearchEntry {
             get { return search_entry; }
         }
 
+        [Obsolete]
         public void SetTitleWidget (Widget widget)
         {
-            var child = custom_title_box.Children.Length == 0 ? null : custom_title_box.Children[0];
-            if (widget == child) {
-                return;
-            }
-
-            if (child != null) {
-                custom_title_box.Remove (child);
-            }
-
             if (widget != null) {
-                widget.HeightRequest = search_entry.Allocation.Height;
-                widget.Show ();
-                custom_title_box.PackStart (widget, false, false, 0);
+                Hyena.Log.Warning ("Nereid.SourceContents.TitleWidget is no longer used (from {0})", ServiceManager.SourceManager.ActiveSource.Name);
             }
-
-            custom_title_box.Visible = widget != null;
-            default_title_box.Visible = widget == null;
         }
 
         public ISourceContents Content {
@@ -288,8 +252,9 @@ namespace Nereid
             }
         }
 
+        [Obsolete]
         public string Title {
-            set { title_label.Markup = String.Format ("<b>{0}</b>", GLib.Markup.EscapeText (value)); }
+            set {}
         }
 
         public bool SearchSensitive {
diff --git a/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml b/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml
index 7376552..0876c51 100644
--- a/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml
+++ b/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml
@@ -8,6 +8,7 @@
     <placeholder name="SourceActions">
         <toolitem name="RefreshSmartPlaylist" action="RefreshSmartPlaylistAction"/>
     </placeholder>
+    <placeholder name="SearchEntry"/>
     <placeholder name="VolumeButton"/>
     <placeholder name="ToolbarMenuPlaceholder"/>
     <placeholder name="ClosePlaceholder"/>
diff --git a/src/Extensions/Banshee.InternetArchive/Banshee.InternetArchive/HeaderFilters.cs b/src/Extensions/Banshee.InternetArchive/Banshee.InternetArchive/HeaderFilters.cs
index a096ca2..cb99ade 100644
--- a/src/Extensions/Banshee.InternetArchive/Banshee.InternetArchive/HeaderFilters.cs
+++ b/src/Extensions/Banshee.InternetArchive/Banshee.InternetArchive/HeaderFilters.cs
@@ -68,7 +68,6 @@ namespace Banshee.InternetArchive
 
             Spacing = 6;
 
-            PackStart (new Label () { Visible = true }, true, true, 0);
             BuildMediaTypeCombo ();
             BuildSortCombo ();
             BuildSearchEntry ();
@@ -150,7 +149,7 @@ namespace Banshee.InternetArchive
                 }
             };
 
-            PackStart (entry, false, false, 0);
+            PackStart (entry, true, true, 0);
         }
 
         private void BuildSortCombo ()



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