[controller] Fix size not being updated in statusicon

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

View file

@ -63,16 +63,6 @@ namespace SparkleShare {
Directory.CreateDirectory (SparklePaths.SparklePath); 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; return true;
} else { } else {

View file

@ -16,6 +16,7 @@
using System; using System;
using System.Drawing; using System.Drawing;
using System.IO;
using System.Timers; using System.Timers;
using MonoMac.Foundation; using MonoMac.Foundation;
using MonoMac.AppKit; using MonoMac.AppKit;
@ -69,7 +70,12 @@ namespace SparkleShare {
SparkleShare.Controller.FolderSizeChanged += delegate { SparkleShare.Controller.FolderSizeChanged += delegate {
InvokeOnMainThread (delegate { InvokeOnMainThread (delegate {
if (!Animation.Enabled)
SetNormalState ();
UpdateMenu (); UpdateMenu ();
}); });
}; };
@ -161,7 +167,11 @@ namespace SparkleShare {
SparkleShare.Controller.OpenSparkleShareFolder (); 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); FolderMenuItem.Image.Size = new SizeF (16, 16);
Menu.AddItem (FolderMenuItem); Menu.AddItem (FolderMenuItem);

View file

@ -45,6 +45,7 @@ namespace SparkleShare {
NSApplication.Init (); NSApplication.Init ();
SetSparkleIcon ();
// TODO: Getting crashes when I remove this // TODO: Getting crashes when I remove this
NSApplication.SharedApplication.ApplicationIconImage NSApplication.SharedApplication.ApplicationIconImage
@ -96,6 +97,20 @@ 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);
}
public void Run () public void Run ()
{ {

View file

@ -37,6 +37,8 @@ namespace SparkleShare {
public string FolderSize; public string FolderSize;
public bool FirstRun; public bool FirstRun;
public readonly string SparklePath;
public event OnQuitWhileSyncingEventHandler OnQuitWhileSyncing; public event OnQuitWhileSyncingEventHandler OnQuitWhileSyncing;
public delegate void OnQuitWhileSyncingEventHandler (); public delegate void OnQuitWhileSyncingEventHandler ();
@ -88,6 +90,8 @@ namespace SparkleShare {
FolderSize = GetFolderSize (); FolderSize = GetFolderSize ();
SparklePath = SparklePaths.SparklePath;
string global_config_file_path = SparkleHelpers.CombineMore (SparklePaths.SparkleConfigPath, "config"); string global_config_file_path = SparkleHelpers.CombineMore (SparklePaths.SparkleConfigPath, "config");
// Show the introduction screen if SparkleShare isn't configured // Show the introduction screen if SparkleShare isn't configured
@ -555,6 +559,12 @@ namespace SparkleShare {
if (FolderListChanged != null) if (FolderListChanged != null)
FolderListChanged (); FolderListChanged ();
FolderSize = GetFolderSize ();
if (FolderSizeChanged != null)
FolderSizeChanged (FolderSize);
} }
@ -584,6 +594,12 @@ namespace SparkleShare {
if (FolderListChanged != null) if (FolderListChanged != null)
FolderListChanged (); FolderListChanged ();
FolderSize = GetFolderSize ();
if (FolderSizeChanged != null)
FolderSizeChanged (FolderSize);
} }