[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/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
using MonoMac.Foundation;
using MonoMac.AppKit;
using MonoMac.ObjCRuntime;
using SparkleLib; using SparkleLib;
using System; using System;
using System.Diagnostics; using System.Diagnostics;
@ -24,12 +27,10 @@ namespace SparkleShare {
public class SparkleMacController : SparkleController { public class SparkleMacController : SparkleController {
// Creates a .desktop entry in autostart folder to
// start SparkleShare automatically at login
public override void EnableSystemAutostart () public override void EnableSystemAutostart ()
{ {
// N/A
} }
@ -39,7 +40,7 @@ namespace SparkleShare {
public override void InstallLauncher () public override void InstallLauncher ()
{ {
// N/A
} }
@ -58,7 +59,20 @@ namespace SparkleShare {
public override bool CreateSparkleShareFolder () 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

@ -38,12 +38,14 @@ namespace SparkleShare {
public static List <SparkleLog> OpenLogs; public static List <SparkleLog> OpenLogs;
public SparkleUI () public SparkleUI ()
{ {
NSApplication.Init (); NSApplication.Init ();
NSApplication.SharedApplication.applicationIconImage = NSImage.ImageNamed ("sparkleshare.icns"); NSApplication.SharedApplication.applicationIconImage
= NSImage.ImageNamed ("sparkleshare.icns");
OpenLogs = new List <SparkleLog> (); OpenLogs = new List <SparkleLog> ();
StatusIcon = new SparkleStatusIcon (); StatusIcon = new SparkleStatusIcon ();