[blam/gtk-builder] Hide the main window when closing
- From: Carlos Martín Nieto <cmartin src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [blam/gtk-builder] Hide the main window when closing
- Date: Thu, 10 Oct 2013 12:06:08 +0000 (UTC)
commit bb3bfacc0039a1f868976168fb47c0649ab2f6bc
Author: Carlos Martín Nieto <cmn dwim me>
Date: Thu Oct 10 14:06:31 2013 +0200
Hide the main window when closing
src/Blam.cs | 23 ++++++++++++++---------
src/blam.ui | 3 ++-
2 files changed, 16 insertions(+), 10 deletions(-)
---
diff --git a/src/Blam.cs b/src/Blam.cs
index 6e4f7e4..2762036 100644
--- a/src/Blam.cs
+++ b/src/Blam.cs
@@ -39,22 +39,16 @@ namespace Blam
bld.AddFromResource("blam.ui");
MainWindow = bld.GetObject<Window>("main-window");
- MainWindow.DeleteEvent += OnDelete;
MainWindow.IconName = "blam";
+ MainWindow.DeleteEvent += toggleVisible;
channels = ChannelCollection.LoadFromFile (Defines.APP_HOMEDIR + "/collection.xml");
trayIcon = new TrayIcon(channels.ObservableChannels, channels.ObservableGroups);
- //trayIcon.ButtonPressEvent += TrayIconButtonPressCb;
//trayIcon.RefreshAllEvent += RefreshAllActivated;
//trayIcon.PreferencesEvent += PreferencesActivated;
- //trayIcon.AboutEvent += AboutActivated;
- trayIcon.ObserveClick.Subscribe(_ => {
- if (MainWindow.Visible)
- MainWindow.Hide();
- else
- MainWindow.Show();
- });
+ trayIcon.ObserveClick.Subscribe(_ => toggleVisible());
+
FeedListSw = bld.GetObject<ScrolledWindow>("feed-list-scroll");
FeedList = new FeedList(channels.ObservableChannels, channels.ObservableGroups);
@@ -143,6 +137,17 @@ namespace Blam
Application.Run();
}
+ void toggleVisible(object sender = null, DeleteEventArgs args = null)
+ {
+ if (MainWindow.Visible)
+ MainWindow.Hide();
+ else
+ MainWindow.ShowAll();
+
+ if (args != null)
+ args.RetVal = true;
+ }
+
void OnDelete(object sender, DeleteEventArgs args)
{
Application.Quit();
diff --git a/src/blam.ui b/src/blam.ui
index c6beab1..5636e0a 100644
--- a/src/blam.ui
+++ b/src/blam.ui
@@ -135,10 +135,11 @@
</object>
</child>
<child>
- <object class="GtkMenuItem" id="markChannelAsReadMenuItem">
+ <object class="GtkMenuItem" id="menu-channel-mark-read">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_action_appearance">False</property>
+ <property name="label" translatable="yes">Mark as Read</property>
<accelerator key="K" signal="activate" modifiers="GDK_CONTROL_MASK"/>
</object>
</child>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]