[banshee] [PlaybackShuffleActions] optionally expose repeat



commit c72dfb72192554503be36b7f72e76393d188cc9c
Author: Aaron Bockover <abockover novell com>
Date:   Sun Mar 21 17:13:30 2010 -0400

    [PlaybackShuffleActions] optionally expose repeat
    
    CreateMenu API now offers an option to create a menu item for repeat
    options as well, which is used by the NextButton when running on MeeGo.
    
    On MeeGo, do not create a footer/status bar, which is traditionally
    where the repeat menu goes.

 src/Clients/Nereid/Nereid/PlayerInterface.cs       |   13 +++++++++++--
 .../Banshee.Gui.Widgets/NextButton.cs              |    8 ++++++--
 .../Banshee.Gui/PlaybackShuffleActions.cs          |   11 +++++++++++
 3 files changed, 28 insertions(+), 4 deletions(-)
---
diff --git a/src/Clients/Nereid/Nereid/PlayerInterface.cs b/src/Clients/Nereid/Nereid/PlayerInterface.cs
index 4ff2704..09fa988 100644
--- a/src/Clients/Nereid/Nereid/PlayerInterface.cs
+++ b/src/Clients/Nereid/Nereid/PlayerInterface.cs
@@ -186,7 +186,7 @@ namespace Nereid
                 AttachOptions.Expand | AttachOptions.Fill,
                 AttachOptions.Shrink, 0, 0);
 
-            Widget next_button = new NextButton (ActionService);
+            Widget next_button = new NextButton (ActionService, PlatformDetection.IsMeeGo);
             next_button.Show ();
             ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/NextArrowButton", next_button);
 
@@ -201,7 +201,7 @@ namespace Nereid
             ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/TrackInfoDisplay", editable, true);
 
             if (PlatformDetection.IsMeeGo) {
-                var menu = (Menu)(ServiceManager.Get<InterfaceActionService> ().UIManager.GetWidget ("/ToolbarMenu"));
+                var menu = (Menu)(ActionService.UIManager.GetWidget ("/ToolbarMenu"));
                 var menu_button = new Hyena.Widgets.MenuButton (new Image (Stock.Preferences, IconSize.LargeToolbar), menu, true);
                 menu_button.Show ();
                 ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/ToolbarMenuPlaceholder", menu_button);
@@ -212,6 +212,7 @@ namespace Nereid
                 ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/ClosePlaceholder", close_button);
 
                 ServiceManager.PlayerEngine.Volume = 100;
+
             } else {
                 var volume_button = new ConnectedVolumeButton ();
                 volume_button.Show ();
@@ -280,6 +281,10 @@ namespace Nereid
 
         private void BuildFooter ()
         {
+            if (PlatformDetection.IsMeeGo) {
+                return;
+            }
+
             footer_toolbar = new HBox () { BorderWidth = 2 };
 
             Widget task_status = new Banshee.Gui.Widgets.TaskStatusIcon ();
@@ -635,6 +640,10 @@ namespace Nereid
 
         private void UpdateSourceInformation ()
         {
+            if (status_label == null) {
+                return;
+            }
+
             Source source = ServiceManager.SourceManager.ActiveSource;
             if (source == null) {
                 status_label.Text = String.Empty;
diff --git a/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/NextButton.cs b/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/NextButton.cs
index 1211f22..1c2f1ed 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/NextButton.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/NextButton.cs
@@ -39,12 +39,16 @@ namespace Banshee.Gui.Widgets
         PlaybackShuffleActions shuffle_actions;
         Widget button;
 
-        public NextButton (InterfaceActionService actionService)
+        public NextButton (InterfaceActionService actionService) : this (actionService, false)
+        {
+        }
+
+        public NextButton (InterfaceActionService actionService, bool withRepeatActions)
         {
             shuffle_actions = actionService.PlaybackActions.ShuffleActions;
 
             button = actionService.PlaybackActions["NextAction"].CreateToolItem ();
-            var menu = shuffle_actions.CreateMenu ();
+            var menu = shuffle_actions.CreateMenu (withRepeatActions);
             Construct (button, menu, true);
 
             TooltipText = actionService.PlaybackActions["NextAction"].Tooltip;
diff --git a/src/Core/Banshee.ThickClient/Banshee.Gui/PlaybackShuffleActions.cs b/src/Core/Banshee.ThickClient/Banshee.Gui/PlaybackShuffleActions.cs
index bd45d45..316914a 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Gui/PlaybackShuffleActions.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Gui/PlaybackShuffleActions.cs
@@ -216,6 +216,11 @@ namespace Banshee.Gui
 
         public Menu CreateMenu ()
         {
+            return CreateMenu (false);
+        }
+
+        public Menu CreateMenu (bool withRepeatActions)
+        {
             Menu menu = new Gtk.Menu ();
             bool separator = false;
             foreach (RadioAction action in this) {
@@ -225,6 +230,12 @@ namespace Banshee.Gui
                     menu.Append (new SeparatorMenuItem ());
                 }
             }
+
+            if (withRepeatActions) {
+                menu.Append (new SeparatorMenuItem ());
+                menu.Append (ServiceManager.Get<InterfaceActionService> ().PlaybackActions.RepeatActions.CreateSubmenu ());
+            }
+
             menu.ShowAll ();
             return menu;
         }



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