Hiding Dock Icon, Programatically showing it while opening setup or events. Added menu-item for ending the application

This commit is contained in:
Phate 2012-01-03 21:37:24 +01:00
parent 5665ea831e
commit 60f5b02e78
5 changed files with 32 additions and 5 deletions

View file

@ -8,9 +8,11 @@
<string>org.sparkleshare.sparkleshare</string>
<key>CFBundleName</key>
<string>SparkleShare</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>10.6</string>
<key>CFBundleVersion</key>
<key>LSUIElement</key>
<string>1</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>

View file

@ -28,6 +28,8 @@ using MonoMac.WebKit;
namespace SparkleShare {
public class SparkleEventLog : NSWindow {
public SparkleEventLogController Controller = new SparkleEventLogController ();
@ -51,7 +53,7 @@ namespace SparkleShare {
// TODO: Window needs to be made resizable
public SparkleEventLog () : base ()
{
{
Title = "Recent Events";
Delegate = new SparkleEventsDelegate ();

4
SparkleShare/Mac/SparkleShare.csproj Executable file → Normal file
View file

@ -6,7 +6,7 @@
<ProductVersion>10.0.0</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{CF5BC8DB-A633-4FCC-8A3E-E3AC9B59FABC}</ProjectGuid>
<ProjectTypeGuids>{1C533B1C-72DD-4CB1-9F6B-BF11D93BCFBE};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<ProjectTypeGuids>{948B3504-5B70-4649-8FE4-BDE1FB46EC69};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<RootNamespace>SparkleShare</RootNamespace>
<AssemblyName>SparkleShare</AssemblyName>
@ -116,7 +116,7 @@
</Compile>
</ItemGroup>
<ItemGroup>
<Page Include="MainMenu.xib" />
<InterfaceDefinition Include="MainMenu.xib" xmlns="" />
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />

View file

@ -46,6 +46,7 @@ namespace SparkleShare {
private NSMenuItem AboutMenuItem;
private NSMenuItem NotificationsMenuItem;
private NSMenuItem RecentEventsMenuItem;
private NSMenuItem QuitAppMenuItem;
private NSImage [] AnimationFrames;
private NSImage [] AnimationFramesActive;
private NSImage ErrorImage;
@ -251,6 +252,9 @@ namespace SparkleShare {
if (Controller.Folders.Length > 0) {
RecentEventsMenuItem.Activated += delegate {
InvokeOnMainThread (delegate {
//Show the icon in Dock
Program.UI.SetRegularActivationPolicy();
NSApplication.SharedApplication.ActivateIgnoringOtherApps (true);
if (SparkleUI.EventLog == null)
@ -303,9 +307,21 @@ namespace SparkleShare {
});
};
QuitAppMenuItem = new NSMenuItem () {
Title = "Quit SparkleShare",
Enabled = true
};
QuitAppMenuItem.Activated += delegate {
InvokeOnMainThread (delegate {
NSApplication.SharedApplication.Terminate(this);
});
};
Menu.AddItem (AboutMenuItem);
Menu.AddItem (QuitAppMenuItem);
StatusItem.Menu = Menu;
StatusItem.Menu.Update ();

View file

@ -67,6 +67,8 @@ namespace SparkleShare {
Bubbles = new SparkleBubbles ();
if (Program.Controller.FirstRun) {
//Show Icon in Dock
this.SetRegularActivationPolicy();
Setup = new SparkleSetup ();
Setup.Controller.ShowSetupPage ();
}
@ -90,6 +92,11 @@ namespace SparkleShare {
{
NSApplication.Main (new string [0]);
}
public void SetRegularActivationPolicy()
{
NSApplication.SharedApplication.ActivationPolicy = NSApplicationActivationPolicy.Regular;
}
[Export("registrationDictionaryForGrowl")]