[build] Add Cocoa solution and status icon in Cocoa

This commit is contained in:
Hylke Bons 2010-11-14 23:06:41 +00:00
parent 1625d2df31
commit 677b4e6ed5
14 changed files with 4644 additions and 0 deletions

2
.gitignore vendored
View file

@ -1,7 +1,9 @@
*~
.DS_Store
*.exe
*.exe.mdb
*.userprefs
*.app
*.pidb
*.gmo
po/POTFILES

View file

@ -0,0 +1,125 @@
using System;
using System.Drawing;
using MonoMac.Foundation;
using MonoMac.AppKit;
using MonoMac.ObjCRuntime;
namespace SparkleShare
{
public partial class AppDelegate : NSApplicationDelegate
{
MainWindowController mainWindowController;
public AppDelegate ()
{
}
public override void FinishedLaunching (NSObject notification)
{
mainWindowController = new MainWindowController ();
mainWindowController.Window.MakeKeyAndOrderFront (this);
// SparkleStatusIcon = new SparkleStatusIcon ();
var statusItem = NSStatusBar.SystemStatusBar.CreateStatusItem (32);
statusItem.Enabled = true;
statusItem.Image = NSImage.ImageNamed ("sparkleshare-idle.png");
statusItem.AlternateImage = NSImage.ImageNamed ("sparkleshare-idle-focus.png");
statusItem.Image.Size = new SizeF (16, 16);
statusItem.AlternateImage.Size = new SizeF (16, 16);
NSMenu menu = new NSMenu() {};
menu.AddItem (new NSMenuItem () { Title="Up to date (102 MB)", Enabled = true });
menu.AddItem (NSMenuItem.SeparatorItem);
var item = new NSMenuItem () {
Title="SparkleShare", Enabled = true,
Action = new Selector ("ddd")
};
item.Activated += delegate {
Console.WriteLine ("DDDD");
};
item.Image = NSImage.ImageNamed ("NSFolder");
item.Image.Size = new SizeF (16, 16);
menu.AddItem (item);
var tmp = new NSMenuItem () {
Title="gnome-design", Enabled = true,
Action = new Selector ("ddd")
};
tmp.Activated += delegate {
Console.WriteLine ("DDDD");
};
tmp.Image = NSImage.ImageNamed ("NSFolder");
tmp.Image.Size = new SizeF (16, 16);
menu.AddItem (tmp);
menu.AddItem (NSMenuItem.SeparatorItem);
Console.WriteLine (item.Action.Name);
NSMenuItem sync_menu_item = new NSMenuItem () {
Title = "Sync Remote Folder..."
};
sync_menu_item.Activated += delegate {
Console.WriteLine ("DDDD");
};
menu.AddItem (sync_menu_item);
menu.AddItem (NSMenuItem.SeparatorItem);
NSMenuItem notifications_menu_item = new NSMenuItem () {
Title = "Show Notifications",
State = NSCellStateValue.On
};
notifications_menu_item.Activated += delegate {
statusItem.Image = NSImage.ImageNamed ("NSComputer");
if (notifications_menu_item.State == NSCellStateValue.On)
notifications_menu_item.State = NSCellStateValue.Off;
else
notifications_menu_item.State = NSCellStateValue.On;
};
menu.AddItem (notifications_menu_item);
menu.AddItem (NSMenuItem.SeparatorItem);
NSMenuItem about_menu_item = new NSMenuItem () {
Title = "About"
};
about_menu_item.Activated += delegate {
Console.WriteLine ("DDDD");
statusItem.Title = "bla";
};
menu.AddItem (about_menu_item);
menu.AddItem (NSMenuItem.SeparatorItem);
NSMenuItem quit_menu_item = new NSMenuItem () {
Title = "Quit"
};
quit_menu_item.Activated += delegate {
Console.WriteLine ("DDDD");
Environment.Exit (0);
};
menu.AddItem (quit_menu_item);
statusItem.Menu = menu;
statusItem.HighlightMode = true;
}
}
}

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIdentifier</key>
<string>com.yourcompany.SparkleShare</string>
<key>CFBundleName</key>
<string>SparkleShare</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>10.6</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>

View file

@ -0,0 +1,18 @@
using System;
using System.Drawing;
using MonoMac.Foundation;
using MonoMac.AppKit;
using MonoMac.ObjCRuntime;
namespace SparkleShare
{
class MainClass
{
static void Main (string[] args)
{
NSApplication.Init ();
NSApplication.Main (args);
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,18 @@
// ------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Mono Runtime Version: 2.0.50727.1433
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
// ------------------------------------------------------------------------------
namespace SparkleShare {
// Should subclass MonoMac.AppKit.NSResponder
[MonoMac.Foundation.Register("AppDelegate")]
public partial class AppDelegate {
}
}

View file

@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MonoMac.Foundation;
using MonoMac.AppKit;
namespace SparkleShare
{
public partial class MainWindow : MonoMac.AppKit.NSWindow
{
#region Constructors
// Called when created from unmanaged code
public MainWindow (IntPtr handle) : base(handle)
{
Initialize ();
}
// Called when created directly from a XIB file
[Export("initWithCoder:")]
public MainWindow (NSCoder coder) : base(coder)
{
Initialize ();
}
// Shared initialization code
void Initialize ()
{
}
#endregion
}
}

View file

@ -0,0 +1,190 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1060</int>
<string key="IBDocument.SystemVersion">10D573</string>
<string key="IBDocument.InterfaceBuilderVersion">762</string>
<string key="IBDocument.AppKitVersion">1038.29</string>
<string key="IBDocument.HIToolboxVersion">460.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="NS.object.0">762</string>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="2"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys" id="0">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSCustomObject" id="1001">
<string key="NSClassName">MainWindowController</string>
</object>
<object class="NSCustomObject" id="1003">
<string key="NSClassName">FirstResponder</string>
</object>
<object class="NSCustomObject" id="1004">
<string key="NSClassName">NSApplication</string>
</object>
<object class="NSWindowTemplate" id="748157544">
<int key="NSWindowStyleMask">15</int>
<int key="NSWindowBacking">2</int>
<string key="NSWindowRect">{{131, 74}, {606, 354}}</string>
<int key="NSWTFlags">611844096</int>
<string key="NSWindowTitle">Window</string>
<string key="NSWindowClass">MainWindow</string>
<nil key="NSViewClass"/>
<string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
<object class="NSView" key="NSWindowView" id="312036702">
<reference key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<string key="NSFrameSize">{606, 354}</string>
<reference key="NSSuperview"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1280, 778}}</string>
<string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
</object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">window</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="748157544"/>
</object>
<int key="connectionID">6</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBObjectRecord">
<int key="objectID">0</int>
<reference key="object" ref="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="1001"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="1003"/>
<reference key="parent" ref="0"/>
<string key="objectName">First Responder</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-3</int>
<reference key="object" ref="1004"/>
<reference key="parent" ref="0"/>
<string key="objectName">Application</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">2</int>
<reference key="object" ref="748157544"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="312036702"/>
</object>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">3</int>
<reference key="object" ref="312036702"/>
<reference key="parent" ref="748157544"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>-1.IBPluginDependency</string>
<string>-2.IBPluginDependency</string>
<string>-3.IBPluginDependency</string>
<string>2.IBEditorWindowLastContentRect</string>
<string>2.IBPluginDependency</string>
<string>2.IBWindowTemplateEditedContentRect</string>
<string>2.NSWindowTemplate.visibleAtLaunch</string>
<string>3.IBPluginDependency</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{319, 371}, {606, 354}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{319, 371}, {606, 354}}</string>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="activeLocalization"/>
<object class="NSMutableDictionary" key="localizations">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="sourceID"/>
<int key="maxID">6</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">MainWindow</string>
<string key="superclassName">NSWindow</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBUserSource</string>
<string key="minorKey"/>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">MainWindowController</string>
<string key="superclassName">NSWindowController</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBUserSource</string>
<string key="minorKey"/>
</object>
</object>
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
<integer value="3000" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<nil key="IBDocument.LastKnownRelativeProjectPath"/>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
</data>
</archive>

View file

@ -0,0 +1,23 @@
// ------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Mono Runtime Version: 2.0.50727.1433
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
// ------------------------------------------------------------------------------
namespace SparkleShare {
// Should subclass MonoMac.AppKit.NSWindow
[MonoMac.Foundation.Register("MainWindow")]
public partial class MainWindow {
}
// Should subclass MonoMac.AppKit.NSWindowController
[MonoMac.Foundation.Register("MainWindowController")]
public partial class MainWindowController {
}
}

View file

@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MonoMac.Foundation;
using MonoMac.AppKit;
namespace SparkleShare
{
public partial class MainWindowController : MonoMac.AppKit.NSWindowController
{
#region Constructors
// Called when created from unmanaged code
public MainWindowController (IntPtr handle) : base(handle)
{
Initialize ();
}
// Called when created directly from a XIB file
[Export("initWithCoder:")]
public MainWindowController (NSCoder coder) : base(coder)
{
Initialize ();
}
// Call to load from the XIB/NIB file
public MainWindowController () : base("MainWindow")
{
Initialize ();
}
// Shared initialization code
void Initialize ()
{
}
#endregion
//strongly typed window accessor
public new MainWindow Window {
get { return (MainWindow)base.Window; }
}
}
}

View file

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{709CB8F4-F82F-4C94-B4E2-DC502087525B}</ProjectGuid>
<ProjectTypeGuids>{1C533B1C-72DD-4CB1-9F6B-BF11D93BCFBE};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<RootNamespace>SparkleShare</RootNamespace>
<AssemblyName>SparkleShare</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Drawing" />
<Reference Include="MonoMac">
<SpecificVersion>False</SpecificVersion>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="MainWindow.cs">
<DependentUpon>MainWindow.xib</DependentUpon>
</Compile>
<Compile Include="MainWindowController.cs">
<DependentUpon>MainWindow.xib</DependentUpon>
</Compile>
<Compile Include="MainWindow.xib.designer.cs">
<DependentUpon>MainWindow.xib</DependentUpon>
</Compile>
<Compile Include="Main.cs" />
<Compile Include="AppDelegate.cs">
<DependentUpon>MainMenu.xib</DependentUpon>
</Compile>
<Compile Include="MainMenu.xib.designer.cs">
<DependentUpon>MainMenu.xib</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Page Include="MainWindow.xib" />
<Page Include="MainMenu.xib" />
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Mono\MonoMac\v0.0\Mono.MonoMac.targets" />
<ItemGroup>
<Content Include="sparkleshare-idle-focus.png" />
<Content Include="sparkleshare-idle.png" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SparkleShare", "SparkleShare.csproj", "{709CB8F4-F82F-4C94-B4E2-DC502087525B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{709CB8F4-F82F-4C94-B4E2-DC502087525B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{709CB8F4-F82F-4C94-B4E2-DC502087525B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{709CB8F4-F82F-4C94-B4E2-DC502087525B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{709CB8F4-F82F-4C94-B4E2-DC502087525B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = SparkleShare.csproj
EndGlobalSection
EndGlobal

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 B