[osx] Set a custom icon for ~/SparkleShare

This commit is contained in:
Hylke Bons 2010-12-22 00:01:36 +01:00
parent a67971ef0f
commit e3b324e3c8
2 changed files with 24 additions and 8 deletions

View file

@ -15,6 +15,9 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using MonoMac.Foundation;
using MonoMac.AppKit;
using MonoMac.ObjCRuntime;
using SparkleLib;
using System;
using System.Diagnostics;
@ -24,12 +27,10 @@ namespace SparkleShare {
public class SparkleMacController : SparkleController {
// Creates a .desktop entry in autostart folder to
// start SparkleShare automatically at login
public override void EnableSystemAutostart ()
{
// N/A
}
@ -39,7 +40,7 @@ namespace SparkleShare {
public override void InstallLauncher ()
{
// N/A
}
@ -58,8 +59,21 @@ namespace SparkleShare {
public override bool CreateSparkleShareFolder ()
{
return true;
if (!Directory.Exists (SparklePaths.SparklePath)) {
Directory.CreateDirectory (SparklePaths.SparklePath);
NSWorkspace.SharedWorkspace.SetIconforFile (NSImage.ImageNamed ("sparkleshare.icns"),
SparklePaths.SparklePath, 0);
return true;
} else {
return false;
}
}

View file

@ -36,6 +36,7 @@ namespace SparkleShare {
public static SparkleStatusIcon StatusIcon;
public static List <SparkleLog> OpenLogs;
public SparkleUI ()
@ -43,8 +44,9 @@ namespace SparkleShare {
NSApplication.Init ();
NSApplication.SharedApplication.applicationIconImage = NSImage.ImageNamed ("sparkleshare.icns");
NSApplication.SharedApplication.applicationIconImage
= NSImage.ImageNamed ("sparkleshare.icns");
OpenLogs = new List <SparkleLog> ();
StatusIcon = new SparkleStatusIcon ();
@ -59,5 +61,5 @@ namespace SparkleShare {
}
}
}