[controller] Fix size not being updated in statusicon

This commit is contained in:
Hylke Bons 2011-02-07 19:25:28 +00:00
parent 60e9a31527
commit e6b1101e91
4 changed files with 44 additions and 13 deletions

View file

@ -63,16 +63,6 @@ namespace SparkleShare {
Directory.CreateDirectory (SparklePaths.SparklePath);
string folder_icon_path = Path.Combine (NSBundle.MainBundle.ResourcePath,
"Pixmaps", "sparkleshare-folder.icns");
NSImage folder_icon = new NSImage (folder_icon_path);
NSWorkspace.SharedWorkspace.SetIconforFile (folder_icon,
SparklePaths.SparklePath, 0);
return true;
} else {

View file

@ -16,6 +16,7 @@
using System;
using System.Drawing;
using System.IO;
using System.Timers;
using MonoMac.Foundation;
using MonoMac.AppKit;
@ -69,7 +70,12 @@ namespace SparkleShare {
SparkleShare.Controller.FolderSizeChanged += delegate {
InvokeOnMainThread (delegate {
if (!Animation.Enabled)
SetNormalState ();
UpdateMenu ();
});
};
@ -160,8 +166,12 @@ namespace SparkleShare {
FolderMenuItem.Activated += delegate {
SparkleShare.Controller.OpenSparkleShareFolder ();
};
FolderMenuItem.Image = new NSImage (NSBundle.MainBundle.ResourcePath + "/Pixmaps/sparkleshare-mac-16.png");
string folder_icon_path = Path.Combine (NSBundle.MainBundle.ResourcePath,
"sparkleshare.icns");
FolderMenuItem.Image = new NSImage (folder_icon_path);
FolderMenuItem.Image.Size = new SizeF (16, 16);
Menu.AddItem (FolderMenuItem);

View file

@ -44,7 +44,8 @@ namespace SparkleShare {
{
NSApplication.Init ();
SetSparkleIcon ();
// TODO: Getting crashes when I remove this
NSApplication.SharedApplication.ApplicationIconImage
@ -92,7 +93,21 @@ namespace SparkleShare {
});
};
}
public void SetSparkleIcon ()
{
string folder_icon_path = Path.Combine (NSBundle.MainBundle.ResourcePath,
"sparkleshare.icns");
NSImage folder_icon = new NSImage (folder_icon_path);
NSWorkspace.SharedWorkspace.SetIconforFile (folder_icon,
SparkleShare.Controller.SparklePath, 0);
}

View file

@ -36,6 +36,8 @@ namespace SparkleShare {
public List <SparkleRepo> Repositories;
public string FolderSize;
public bool FirstRun;
public readonly string SparklePath;
public event OnQuitWhileSyncingEventHandler OnQuitWhileSyncing;
@ -86,7 +88,9 @@ namespace SparkleShare {
AddToBookmarks ();
FolderSize = GetFolderSize ();
SparklePath = SparklePaths.SparklePath;
string global_config_file_path = SparkleHelpers.CombineMore (SparklePaths.SparkleConfigPath, "config");
@ -555,6 +559,12 @@ namespace SparkleShare {
if (FolderListChanged != null)
FolderListChanged ();
FolderSize = GetFolderSize ();
if (FolderSizeChanged != null)
FolderSizeChanged (FolderSize);
}
@ -584,6 +594,12 @@ namespace SparkleShare {
if (FolderListChanged != null)
FolderListChanged ();
FolderSize = GetFolderSize ();
if (FolderSizeChanged != null)
FolderSizeChanged (FolderSize);
}