[banshee] [Podcasting] Finish podcast combo box
- From: Gabriel Burt <gburt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] [Podcasting] Finish podcast combo box
- Date: Tue, 26 Oct 2010 23:30:56 +0000 (UTC)
commit 04af32338706d2f8bc6108c0915d38c741dd718a
Author: Gabriel Burt <gabriel burt gmail com>
Date: Tue Oct 26 18:26:51 2010 -0500
[Podcasting] Finish podcast combo box
.../Banshee.Podcasting.Gui/HeaderWidget.cs | 53 +++++++++++++++++---
src/Hyena | 2 +-
2 files changed, 47 insertions(+), 8 deletions(-)
---
diff --git a/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/HeaderWidget.cs b/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/HeaderWidget.cs
index da594a1..a85dd0b 100644
--- a/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/HeaderWidget.cs
+++ b/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/HeaderWidget.cs
@@ -33,6 +33,9 @@ using System.Collections.Generic;
using System.Linq;
using Hyena;
+using Hyena.Data;
+using Migo.Syndication;
+
using Banshee.PlaybackController;
using Banshee.Sources;
using Banshee.Collection.Database;
@@ -40,6 +43,47 @@ using Banshee.Widgets;
namespace Banshee.Podcasting.Gui
{
+ public class ModelComboBox<T> : DictionaryComboBox<T>
+ {
+ private IListModel<T> model;
+ private Func<T, string> text_func;
+
+ public ModelComboBox (IListModel<T> model, Func<T, string> text_func)
+ {
+ this.model = model;
+ this.text_func = text_func;
+
+ Changed += delegate {
+ model.Selection.Clear (false);
+ model.Selection.Select (Active);
+ };
+
+ model.Reloaded += delegate { ThreadAssist.ProxyToMain (Reload); };
+ Reload ();
+ }
+
+ private void Reload ()
+ {
+ var active = ActiveValue;
+ Clear ();
+
+ bool set_active = false;
+ for (int i = 0; i < model.Count; i++) {
+ var item = model[i];
+ Add (text_func (item), item);
+
+ if (item.Equals (active)) {
+ ActiveValue = item;
+ set_active = true;
+ }
+ }
+
+ if (!set_active) {
+ Active = 0;
+ }
+ }
+ }
+
public class HeaderWidget : HBox
{
public HeaderWidget (PodcastSource source)
@@ -48,14 +92,8 @@ namespace Banshee.Podcasting.Gui
Spacing = 6;
var podcast_label = new Label (Catalog.GetString ("_Limit to episodes from"));
- var podcast_combo = new DictionaryComboBox<string> ();
- podcast_combo.Add ("All Podcasts", "bar");
- podcast_combo.Add ("Foo", "bar");
- podcast_combo.Add ("Baz", "lkjer");
- podcast_combo.Active = 0;
-
+ var podcast_combo = new ModelComboBox<Feed> (source.FeedModel, feed => feed.Title);
podcast_label.MnemonicWidget = podcast_combo;
- //podcast_combo.Changed += OnModeComboChanged;
var new_check = new CheckButton ("new") { Active = true };
new_check.Toggled += (o, a) => {
@@ -78,6 +116,7 @@ namespace Banshee.Podcasting.Gui
PackStart (downloaded_check, false, false, 0);
}
+
/*private void OnModeComboChanged (object o, EventArgs args)
{
var random_by = mode_combo.ActiveValue;
diff --git a/src/Hyena b/src/Hyena
index 7b7cd86..09d17e8 160000
--- a/src/Hyena
+++ b/src/Hyena
@@ -1 +1 @@
-Subproject commit 7b7cd8674f284ad2d2e288bff2231c7134ef8915
+Subproject commit 09d17e85aa99e594df9a63b94a546ed30d8d8ccc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]