[osx] Set a custom icon for ~/SparkleShare

This commit is contained in:
Hylke Bons 2010-12-22 00:01:36 +01:00
parent f7cf25dda6
commit c5b47ac711
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,8 +59,21 @@ 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

@ -36,6 +36,7 @@ namespace SparkleShare {
public static SparkleStatusIcon StatusIcon; public static SparkleStatusIcon StatusIcon;
public static List <SparkleLog> OpenLogs; public static List <SparkleLog> OpenLogs;
public SparkleUI () public SparkleUI ()
@ -43,8 +44,9 @@ namespace SparkleShare {
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 ();
@ -59,5 +61,5 @@ namespace SparkleShare {
} }
} }
} }