[blam/gtk3] Wire up preferences from the status icon
- From: Carlos Martín Nieto <cmartin src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [blam/gtk3] Wire up preferences from the status icon
- Date: Sun, 13 Oct 2013 15:31:37 +0000 (UTC)
commit 5e1756ec57a206547f0d38940046601fc45a2bd4
Author: Carlos Martín Nieto <cmn dwim me>
Date: Sun Oct 13 17:00:30 2013 +0200
Wire up preferences from the status icon
src/Blam.cs | 5 ++++-
src/ItemView.cs | 1 +
src/TrayIcon.cs | 9 ++++++++-
3 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/src/Blam.cs b/src/Blam.cs
index 9363bab..8aff1fb 100644
--- a/src/Blam.cs
+++ b/src/Blam.cs
@@ -106,7 +106,10 @@ namespace Blam
});
item = bld.GetObject<MenuItem>("menu-preferences");
- item.ObserveActivated().Subscribe(obj => {
+ Observable.Merge(
+ item.ObserveActivated().Select(_ => Unit.Default),
+ trayIcon.ObservePreferences)
+ .Subscribe(obj => {
using (var dialog = new PreferencesDialog(MainWindow, themeManager)) {
dialog.Run();
}
diff --git a/src/ItemView.cs b/src/ItemView.cs
index bf7d120..eefe0f0 100644
--- a/src/ItemView.cs
+++ b/src/ItemView.cs
@@ -95,6 +95,7 @@ namespace Blam
Console.WriteLine(theme.Render(replaces));
LoadString(theme.Render(replaces), null, null, baseDir);
}
+
}
}
diff --git a/src/TrayIcon.cs b/src/TrayIcon.cs
index ab374cd..a6134ab 100644
--- a/src/TrayIcon.cs
+++ b/src/TrayIcon.cs
@@ -48,6 +48,13 @@ namespace Blam
}
}
+ Subject<Unit> preferencesSubject = new Subject<Unit>();
+ public IObservable<Unit> ObservePreferences {
+ get {
+ return preferencesSubject;
+ }
+ }
+
public TrayIcon(ObservableCollection<Channel> channels, ObservableCollection<ChannelGroup>
groups)
{
IconName = "blam";
@@ -80,7 +87,7 @@ namespace Blam
Gtk.ImageMenuItem prefItem = new Gtk.ImageMenuItem(Catalog.GetString("Preferences"));
prefItem.Image = new Gtk.Image(Gtk.Stock.Preferences,IconSize.Menu);
- //prefItem.Activated += PreferencesEvent;
+ prefItem.Activated += (sender, e) => preferencesSubject.OnNext(Unit.Default);
Gtk.ImageMenuItem aboutItem = new Gtk.ImageMenuItem(Catalog.GetString("About Blam"));
aboutItem.Image = new Gtk.Image(Gtk.Stock.About,IconSize.Menu);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]