Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
* Monsoon/MainWindow.cs:
Browse files Browse the repository at this point in the history
* Monsoon/gtk-gui/gui.stetic:
* Monsoon/gtk-gui/Monsoon.MainWindow.cs: Fix #492064 - Add Close
  action to File menu

svn path=/trunk/monsoon/; revision=131537
  • Loading branch information
jaredh committed Apr 12, 2009
1 parent c2a4f67 commit be6cf73
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
10 changes: 9 additions & 1 deletion Monsoon/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// MainWindow.cs
//
// Author:
// Jared Hendry (buchan@gmail.com)
// Jared Hendry (hendry.jared@gmail.com)
// Mirco Bauer (meebey@meebey.net)
//
// Copyright (C) 2007 Jared Hendry
Expand Down Expand Up @@ -1321,5 +1321,13 @@ void OnPriorityHighest (object sender, System.EventArgs e)
{
TorrentController.SetPriority (TorrentController.SelectedDownload, 1);
}

protected virtual void OnCloseActionActivated (object sender, System.EventArgs e)
{
if (!Preferences.QuitOnClose)
OnDeleteEvent (null,new DeleteEventArgs ());

Hide();
}
}
}
8 changes: 7 additions & 1 deletion Monsoon/gtk-gui/Monsoon.MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public partial class MainWindow {

private Gtk.Action gotoBottomAction;

private Gtk.Action CloseAction;

private Gtk.VBox vbox1;

private Gtk.MenuBar menubar1;
Expand Down Expand Up @@ -279,6 +281,9 @@ public partial class MainWindow {
w1.Add(this.gotoTopAction, null);
this.gotoBottomAction = new Gtk.Action("gotoBottomAction", null, null, "gtk-goto-bottom");
w1.Add(this.gotoBottomAction, null);
this.CloseAction = new Gtk.Action("CloseAction", Mono.Unix.Catalog.GetString("Close"), null, "gtk-close");
this.CloseAction.ShortLabel = Mono.Unix.Catalog.GetString("Close");
w1.Add(this.CloseAction, null);
this.UIManager.InsertActionGroup(w1, 0);
this.AddAccelGroup(this.UIManager.AccelGroup);
this.Name = "Monsoon.MainWindow";
Expand All @@ -288,7 +293,7 @@ public partial class MainWindow {
this.vbox1 = new Gtk.VBox();
this.vbox1.Name = "vbox1";
// Container child vbox1.Gtk.Box+BoxChild
this.UIManager.AddUiFromString("<ui><menubar name='menubar1'><menu name='FileAction' action='FileAction'><menuitem name='NewTorrent' action='NewTorrent'/><menuitem name='OpenTorrent' action='OpenTorrent'/><separator/><menuitem name='Quit' action='Quit'/></menu><menu name='EditAction' action='EditAction'><menuitem name='preferences' action='preferences'/></menu><menu name='ViewAction' action='ViewAction'><menuitem name='EditColumns' action='EditColumns'/><separator/><menuitem name='ShowLabels' action='ShowLabels'/><menuitem name='ShowDetailedInfo' action='ShowDetailedInfo'/></menu><menu name='HelpAction' action='HelpAction'><menuitem name='About' action='About'/><menuitem name='ReportBugAction' action='ReportBugAction'/></menu></menubar></ui>");
this.UIManager.AddUiFromString("<ui><menubar name='menubar1'><menu name='FileAction' action='FileAction'><menuitem name='NewTorrent' action='NewTorrent'/><menuitem name='OpenTorrent' action='OpenTorrent'/><separator/><menuitem name='CloseAction' action='CloseAction'/><menuitem name='Quit' action='Quit'/></menu><menu name='EditAction' action='EditAction'><menuitem name='preferences' action='preferences'/></menu><menu name='ViewAction' action='ViewAction'><menuitem name='EditColumns' action='EditColumns'/><separator/><menuitem name='ShowLabels' action='ShowLabels'/><menuitem name='ShowDetailedInfo' action='ShowDetailedInfo'/></menu><menu name='HelpAction' action='HelpAction'><menuitem name='About' action='About'/><menuitem name='ReportBugAction' action='ReportBugAction'/></menu></menubar></ui>");
this.menubar1 = ((Gtk.MenuBar)(this.UIManager.GetWidget("/menubar1")));
this.menubar1.Name = "menubar1";
this.vbox1.Add(this.menubar1);
Expand Down Expand Up @@ -1041,6 +1046,7 @@ public partial class MainWindow {
this.ReportBugAction.Activated += new System.EventHandler(this.OnReportBugActivated);
this.gotoTopAction.Activated += new System.EventHandler(this.OnPriorityHighest);
this.gotoBottomAction.Activated += new System.EventHandler(this.OnPriorityLowest);
this.CloseAction.Activated += new System.EventHandler(this.OnCloseActionActivated);
}
}
}
8 changes: 8 additions & 0 deletions Monsoon/gtk-gui/gui.stetic
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,13 @@
<property name="StockId">gtk-goto-bottom</property>
<signal name="Activated" handler="OnPriorityLowest" />
</action>
<action id="CloseAction">
<property name="Type">Action</property>
<property name="Label" translatable="yes">Close</property>
<property name="ShortLabel" translatable="yes">Close</property>
<property name="StockId">gtk-close</property>
<signal name="Activated" handler="OnCloseActionActivated" />
</action>
</action-group>
<property name="MemberName" />
<property name="Visible">False</property>
Expand All @@ -210,6 +217,7 @@
<node type="Menuitem" action="NewTorrent" />
<node type="Menuitem" action="OpenTorrent" />
<node type="Separator" />
<node type="Menuitem" action="CloseAction" />
<node type="Menuitem" action="Quit" />
</node>
<node type="Menu" action="EditAction">
Expand Down

0 comments on commit be6cf73

Please sign in to comment.