[blam/gtk3] Wire up 'refresh all'
- From: Carlos Martín Nieto <cmartin src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [blam/gtk3] Wire up 'refresh all'
- Date: Sun, 13 Oct 2013 15:31:58 +0000 (UTC)
commit 2b793ce2a35bfb669c7e9e266e59419e7b9c46ac
Author: Carlos Martín Nieto <cmn dwim me>
Date: Sun Oct 13 17:32:05 2013 +0200
Wire up 'refresh all'
src/Blam.cs | 7 +++++++
src/TrayIcon.cs | 9 ++++++++-
2 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/src/Blam.cs b/src/Blam.cs
index 8aff1fb..a0defe3 100644
--- a/src/Blam.cs
+++ b/src/Blam.cs
@@ -83,6 +83,13 @@ namespace Blam
.Subscribe(chan => ItemList.Channel = chan);
wireMenuItems(bld);
+
+ var refreshAll = bld.GetObject<Button>("refresh-all");
+ Observable.Merge(
+ Observable.FromEventPattern(refreshAll, "Clicked").Select(_ => Unit.Default),
+ trayIcon.ObserveRefresh)
+ .Subscribe(_ => channels.RefreshAll());
+
restoreWindowState();
}
diff --git a/src/TrayIcon.cs b/src/TrayIcon.cs
index 290b915..b1bf197 100644
--- a/src/TrayIcon.cs
+++ b/src/TrayIcon.cs
@@ -55,6 +55,13 @@ namespace Blam
}
}
+ Subject<Unit> refreshSubject = new Subject<Unit>();
+ public IObservable<Unit> ObserveRefresh {
+ get {
+ return refreshSubject;
+ }
+ }
+
public TrayIcon(ObservableCollection<Channel> channels, ObservableCollection<ChannelGroup>
groups)
{
IconName = "blam";
@@ -83,7 +90,7 @@ namespace Blam
Gtk.Menu menu = new Gtk.Menu();
Gtk.ImageMenuItem refreshItem = new Gtk.ImageMenuItem(Catalog.GetString("_Refresh"));
refreshItem.Image = new Gtk.Image(Gtk.Stock.Refresh, IconSize.Menu);
- //refreshItem.Activated += RefreshAllEvent;
+ refreshItem.Activated += (sender, e) => refreshSubject.OnNext(Unit.Default);
Gtk.ImageMenuItem prefItem = new Gtk.ImageMenuItem(Catalog.GetString("Preferences"));
prefItem.Image = new Gtk.Image(Gtk.Stock.Preferences,IconSize.Menu);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]