[osx] Hook things up

This commit is contained in:
Hylke Bons 2010-12-18 01:01:43 +01:00
parent cd60a85825
commit 5ae4ba3638
16 changed files with 140 additions and 81 deletions

View file

@ -24,7 +24,7 @@ namespace SparkleLib {
public static class SparklePaths
{
public static string GitPath = GetGitPath ();
public static string GitPath = "/usr/bin/git"; // TODO: Don't hardcode this
public static string HomePath = new UnixUserInfo (UnixEnvironment.UserName).HomeDirectory;

View file

@ -2,6 +2,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>CFBundleIconFile</key>
<string>sparkleshare.icns</string>
<key>LSEnvironment</key>
<dict>
<key>PATH</key>

View file

@ -1,3 +1,20 @@
// SparkleShare, an instant update workflow to Git.
// Copyright (C) 2010 Hylke Bons <hylkebons@gmail.com>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Drawing;
using System.Timers;
@ -5,88 +22,39 @@ using MonoMac.Foundation;
using MonoMac.AppKit;
using MonoMac.ObjCRuntime;
using MonoMac.WebKit;
using MonoMac.Growl;
namespace SparkleShare
{
class MainClass
{
static void Main (string[] args)
{
NSApplication.Init ();
NSApplication.SharedApplication.ActivateIgnoringOtherApps (true);
NSApplication.SharedApplication.applicationIconImage = NSImage.ImageNamed ("sparkleshare.icns");
NSApplication.Main (args);
}
namespace SparkleShare {
public partial class AppDelegate : NSApplicationDelegate {
// Workaround to be able to work with SparkleUI as the main class
}
public partial class AppDelegate : NSApplicationDelegate
public class SparkleUI : AppDelegate
{
//MainWindowController mainWindowController;
NSStatusItem StatusItem;
NSMenu Menu;
NSMenuItem FolderMenuItem;
NSMenuItem [] FolderMenuItems;
NSMenuItem SyncMenuItem;
NSMenuItem NotificationsMenuItem;
NSMenuItem AboutMenuItem;
NSMenuItem QuitMenuItem;
SparkleLog Log;
int i = 0;
public SparkleStatusIcon StatusIcon;
/* public override NSMenu ApplicationDockMenu (NSApplication app)
public SparkleUI ()
{
NSApplication.Init ();
//NSApplication.SharedApplication.ActivateIgnoringOtherApps (true);
//NSApplication.SharedApplication.applicationIconImage = NSImage.ImageNamed ("sparkleshare.icns");
return (NSMenu) Menu;
}
*/
public AppDelegate ()
{
//StatusIcon = new SparkleStatusIcon ();
}
SparkleStatusIcon StatusIcon;
public override void FinishedLaunching (NSObject notification)
public void Run ()
{
StatusIcon = new SparkleStatusIcon ();
/* tile = NSApplication.SharedApplication.DockTile;
tile.BadgeLabel = "!";
tile.Display ();
*/
// mainWindowController = new MainWindowController ();
// mainWindowController.Window.MakeKeyAndOrderFront (this);
// SparkleStatusIcon = new SparkleStatusIcon ();
// SparkleRepo repo = new SparkleRepo ("/Users/hbons/SparkleShare/SparkleShare-Test");
//StatusItem = NSStatusBar.SystemStatusBar.CreateStatusItem (28);
NSApplication.SharedApplication.ActivateIgnoringOtherApps (true);
NSApplication.Main (new string [0]);
}
}
}

View file

Before

Width:  |  Height:  |  Size: 732 B

After

Width:  |  Height:  |  Size: 732 B

View file

Before

Width:  |  Height:  |  Size: 797 B

After

Width:  |  Height:  |  Size: 797 B

View file

Before

Width:  |  Height:  |  Size: 803 B

After

Width:  |  Height:  |  Size: 803 B

View file

Before

Width:  |  Height:  |  Size: 822 B

After

Width:  |  Height:  |  Size: 822 B

View file

Before

Width:  |  Height:  |  Size: 818 B

After

Width:  |  Height:  |  Size: 818 B

View file

Before

Width:  |  Height:  |  Size: 831 B

After

Width:  |  Height:  |  Size: 831 B

View file

Before

Width:  |  Height:  |  Size: 826 B

After

Width:  |  Height:  |  Size: 826 B

View file

Before

Width:  |  Height:  |  Size: 283 B

After

Width:  |  Height:  |  Size: 283 B

View file

Before

Width:  |  Height:  |  Size: 216 B

After

Width:  |  Height:  |  Size: 216 B

View file

@ -0,0 +1,75 @@
// SparkleShare, an instant update workflow to Git.
// Copyright (C) 2010 Hylke Bons <hylkebons@gmail.com>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Diagnostics;
using System.IO;
namespace SparkleShare {
public class SparkleMacController : SparkleController {
// Creates a .desktop entry in autostart folder to
// start SparkleShare automatically at login
public override void EnableSystemAutostart ()
{
}
// Installs a launcher so the user can launch SparkleShare
// from the Internet category if needed
public override void InstallLauncher ()
{
}
// Adds the SparkleShare folder to the user's
// list of bookmarked places
public override void AddToBookmarks ()
{
}
// Creates the SparkleShare folder in the user's home folder
public override bool CreateSparkleShareFolder ()
{
return true;
}
// Opens the SparkleShare folder or an (optional) subfolder
public override void OpenSparkleShareFolder (string subfolder)
{
}
}
}

View file

@ -44,6 +44,7 @@
<Reference Include="MonoMac">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Mono.Posix" />
</ItemGroup>
<ItemGroup>
<Compile Include="Main.cs" />
@ -53,6 +54,13 @@
<Compile Include="Layout.cs" />
<Compile Include="SparkleLog.cs" />
<Compile Include="SparkleStatusIcon.cs" />
<Compile Include="..\..\SparkleShare.cs">
<Link>SparkleShare.cs</Link>
</Compile>
<Compile Include="..\..\SparkleController.cs">
<Link>SparkleController.cs</Link>
</Compile>
<Compile Include="SparkleMacController.cs" />
</ItemGroup>
<ItemGroup>
<Page Include="MainMenu.xib" />
@ -63,16 +71,15 @@
<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" />
<Content Include="sparkleshare.icns" />
<Content Include="idle-active.png" />
<Content Include="idle.png" />
<Content Include="idle0.png" />
<Content Include="idle1.png" />
<Content Include="idle2.png" />
<Content Include="idle3.png" />
<Content Include="idle4.png" />
<Content Include="Pixmaps\idle.png" />
<Content Include="Pixmaps\idle0.png" />
<Content Include="Pixmaps\idle2.png" />
<Content Include="Pixmaps\idle-active.png" />
<Content Include="Pixmaps\idle1.png" />
<Content Include="Pixmaps\idle4.png" />
<Content Include="Pixmaps\idle3.png" />
<Content Include="Pixmaps\sparkleshare-idle.png" />
<Content Include="Pixmaps\sparkleshare-idle-focus.png" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\SparkleLib\SparkleLib.csproj">
@ -80,4 +87,10 @@
<Name>SparkleLib</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Pixmaps\" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Pixmaps\sparkleshare.icns" />
</ItemGroup>
</Project>

View file

@ -20,6 +20,7 @@ using System.Timers;
using MonoMac.Foundation;
using MonoMac.AppKit;
using MonoMac.ObjCRuntime;
using Mono.Unix;
namespace SparkleShare {
@ -39,12 +40,12 @@ namespace SparkleShare {
private NSMenuItem SyncMenuItem;
private NSMenuItem NotificationsMenuItem;
private NSMenuItem AboutMenuItem;
private NSMenuItem QuitMenuItem;
public string _ (string s)
// Short alias for the translations
public static string _ (string s)
{
return s;
return Catalog.GetString (s);
}
@ -57,7 +58,7 @@ namespace SparkleShare {
StatusItem.HighlightMode = true;
SetNormalState ();
SetAnimationState ();
CreateMenu ();