[banshee] [Shuffler] Fix UI updates when random modes change
- From: Gabriel Burt <gburt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] [Shuffler] Fix UI updates when random modes change
- Date: Thu, 18 Feb 2010 00:53:31 +0000 (UTC)
commit d153c11a0b875413c682d66399fd1c8184460a28
Author: Gabriel Burt <gabriel burt gmail com>
Date: Wed Feb 17 16:51:41 2010 -0800
[Shuffler] Fix UI updates when random modes change
PlayQueue dropdown and the Next button's menu are now updated.
.../Banshee.Gui.Widgets/NextButton.cs | 8 +++++---
.../Banshee.Gui/PlaybackShuffleActions.cs | 1 +
.../Banshee.PlayQueue/HeaderWidget.cs | 8 ++++++++
3 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/NextButton.cs b/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/NextButton.cs
index 2e2c11f..1211f22 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/NextButton.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/NextButton.cs
@@ -37,7 +37,6 @@ namespace Banshee.Gui.Widgets
public class NextButton : MenuButton
{
PlaybackShuffleActions shuffle_actions;
- Menu menu;
Widget button;
public NextButton (InterfaceActionService actionService)
@@ -45,7 +44,7 @@ namespace Banshee.Gui.Widgets
shuffle_actions = actionService.PlaybackActions.ShuffleActions;
button = actionService.PlaybackActions["NextAction"].CreateToolItem ();
- menu = shuffle_actions.CreateMenu ();
+ var menu = shuffle_actions.CreateMenu ();
Construct (button, menu, true);
TooltipText = actionService.PlaybackActions["NextAction"].Tooltip;
@@ -56,8 +55,11 @@ namespace Banshee.Gui.Widgets
private void OnActionsChanged (object o, EventArgs args)
{
if (!shuffle_actions.Sensitive) {
- menu.Deactivate ();
+ Menu.Deactivate ();
}
+
+ Menu = shuffle_actions.CreateMenu ();
+
ToggleButton.Sensitive = shuffle_actions.Sensitive;
if (Arrow != null) {
Arrow.Sensitive = shuffle_actions.Sensitive;
diff --git a/src/Core/Banshee.ThickClient/Banshee.Gui/PlaybackShuffleActions.cs b/src/Core/Banshee.ThickClient/Banshee.Gui/PlaybackShuffleActions.cs
index b9a70d6..0a40431 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Gui/PlaybackShuffleActions.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Gui/PlaybackShuffleActions.cs
@@ -149,6 +149,7 @@ namespace Banshee.Gui
}
Active.Activate ();
+ OnChanged ();
}
private void OnShuffleModeChanged (object o, EventArgs<string> args)
diff --git a/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/HeaderWidget.cs b/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/HeaderWidget.cs
index 40bc212..5ad10da 100644
--- a/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/HeaderWidget.cs
+++ b/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/HeaderWidget.cs
@@ -55,6 +55,9 @@ namespace Banshee.PlayQueue
var mode_combo = new DictionaryComboBox<RandomBy> ();
foreach (var random_by in shuffler.RandomModes.OrderBy (r => r.Adverb)) {
mode_combo.Add (random_by.Adverb, random_by);
+ if (random_by.Id == "off") {
+ mode_combo.Default = random_by;
+ }
}
fill_label.MnemonicWidget = mode_combo;
@@ -93,7 +96,12 @@ namespace Banshee.PlayQueue
var default_randomby = shuffler.RandomModes.FirstOrDefault (r => r.Id == shuffle_mode_id);
if (default_randomby != null) {
mode_combo.ActiveValue = default_randomby;
+ } else {
+ mode_combo.ActiveValue = mode_combo.Default;
}
+
+ shuffler.RandomModeAdded += (r) => mode_combo.Add (r.Adverb, r);
+ shuffler.RandomModeRemoved += (r) => mode_combo.Remove (r);
}
}
}
\ No newline at end of file
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]