Skip to content

Commit

Permalink
[macOS] Close app on red button click. (#16)
Browse files Browse the repository at this point in the history
* Make app name consistent throughout menu items.

* Make app exit on window close.
  • Loading branch information
JunielKatarn authored Nov 26, 2019
1 parent 2d63f2f commit 8248661
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 9 deletions.
20 changes: 17 additions & 3 deletions macOS/AppDelegate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ namespace Jammit.macOS
[Register("AppDelegate")]
public partial class AppDelegate : FormsApplicationDelegate
{
NSWindow _window;

NSWindow _window;

public AppDelegate()
{
var style = NSWindowStyle.Closable | NSWindowStyle.Resizable | NSWindowStyle.Titled;
Expand Down Expand Up @@ -65,6 +65,20 @@ void ShowHelp(NSObject sender)
public override void WillTerminate(NSNotification notification)
{
// Insert code here to tear down your application
}
}

#region NSApplicationDelegate overrides

/// <summary>
/// Make application exit when closing the main window.
/// </summary>
/// <param name="sender"></param>
/// <returns></returns>
public override bool ApplicationShouldTerminateAfterLastWindowClosed(NSApplication sender)
{
return true;
}

#endregion NSApplicationDelegate overrides
}
}
8 changes: 4 additions & 4 deletions macOS/MainMenu.xib
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Unjammit!" systemMenu="apple" id="57">
<items>
<menuItem title="About Unjammit..." id="58">
<menuItem title="About Unjammit!..." id="58">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="orderFrontStandardAboutPanel:" target="-2" id="142"/>
Expand All @@ -29,7 +29,7 @@
<menu key="submenu" title="Services" systemMenu="services" id="130"/>
</menuItem>
<menuItem isSeparatorItem="YES" id="144"/>
<menuItem title="Hide Unjammit" keyEquivalent="h" id="134">
<menuItem title="Hide Unjammit!" keyEquivalent="h" id="134">
<connections>
<action selector="hide:" target="-1" id="367"/>
</connections>
Expand All @@ -47,7 +47,7 @@
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="149"/>
<menuItem title="Quit Unjammit" keyEquivalent="q" id="136">
<menuItem title="Quit Unjammit!" keyEquivalent="q" id="136">
<connections>
<action selector="terminate:" target="-1" id="369"/>
</connections>
Expand Down Expand Up @@ -142,7 +142,7 @@
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Help" systemMenu="help" id="106">
<items>
<menuItem title="Unjammit Help" keyEquivalent="?" id="111">
<menuItem title="Unjammit! Help" keyEquivalent="?" id="111">
<connections>
<action selector="customHelp:" target="-1" id="tdR-jf-Hmc"/>
</connections>
Expand Down
2 changes: 1 addition & 1 deletion macOS/ViewController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using AppKit;
using Foundation;

namespace Jam.NET.macOS
namespace Jammit.macOS
{
public partial class ViewController : NSViewController
{
Expand Down
2 changes: 1 addition & 1 deletion macOS/ViewController.designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8248661

Please sign in to comment.