Save icon work

This commit is contained in:
Hylke Bons 2012-09-09 13:25:36 +01:00
parent 55a680aa01
commit bc22af1817
41 changed files with 1378 additions and 2260 deletions

File diff suppressed because it is too large Load diff

Before

Width:  |  Height:  |  Size: 988 KiB

After

Width:  |  Height:  |  Size: 917 KiB

View file

@ -21,11 +21,9 @@ app_theme_icons = \
places,sparkleshare-256.png \
places,sparkleshare-32.png \
places,sparkleshare-48.png \
status,process-syncing-i-24.png \
status,process-syncing-ii-24.png \
status,process-syncing-iii-24.png \
status,process-syncing-iiii-24.png \
status,process-syncing-iiiii-24.png \
status,process-syncing-up-24.png \
status,process-syncing-down-24.png \
status,process-syncing-24.png \
status,process-syncing-error-24.png \
status,document-added-12.png \
status,document-edited-12.png \

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 923 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 931 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 918 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 918 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 922 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -2,11 +2,10 @@ dark_theme = ubuntu-mono-dark
dark_themedir = /usr/share/icons/$(dark_theme)
dark_theme_icons = \
status,process-syncing-i-24.png \
status,process-syncing-ii-24.png \
status,process-syncing-iii-24.png \
status,process-syncing-iiii-24.png \
status,process-syncing-iiiii-24.png \
status,process-syncing-idle-24.png \
status,process-syncing-up-24.png \
status,process-syncing-down-24.png \
status,process-syncing-24.png \
status,process-syncing-error-24.png
install_icon_exec = $(top_srcdir)/build/icon-theme-installer \

Binary file not shown.

Before

Width:  |  Height:  |  Size: 806 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 837 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 829 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 831 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 838 B

View file

@ -2,11 +2,10 @@ light_theme = ubuntu-mono-light
light_themedir = /usr/share/icons/$(light_theme)
light_theme_icons = \
status,process-syncing-i-24.png \
status,process-syncing-ii-24.png \
status,process-syncing-iii-24.png \
status,process-syncing-iiii-24.png \
status,process-syncing-iiiii-24.png \
status,process-syncing-idle-24.png \
status,process-syncing-up-24.png \
status,process-syncing-down-24.png \
status,process-syncing-24.png \
status,process-syncing-error-24.png
install_icon_exec = $(top_srcdir)/build/icon-theme-installer \

Binary file not shown.

Before

Width:  |  Height:  |  Size: 795 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 825 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 807 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 833 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 563 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 560 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 617 B

View file

Before

Width:  |  Height:  |  Size: 264 B

After

Width:  |  Height:  |  Size: 264 B

View file

Before

Width:  |  Height:  |  Size: 292 B

After

Width:  |  Height:  |  Size: 292 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 276 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 281 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 308 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 280 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 300 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 288 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 303 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 566 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 618 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 584 B

View file

@ -15,21 +15,21 @@
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<Optimize>False</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CustomCommands>
<CustomCommands>
<Command type="AfterBuild" command="mkdir -p ${TargetDir}/${SolutionName}.app/Contents/Frameworks; cp -R Growl.framework ${TargetDir}/${SolutionName}.app/Contents/Frameworks; cp -R git ${TargetDir}/${SolutionName}.app/Contents/Resources; cp -R SparkleShareInviteOpener.app ${TargetDir}/${SolutionName}.app/Contents/Resources" externalConsole="true" />
<Command type="AfterBuild" command="mkdir -p ${TargetDir}/${SolutionName}.app/Contents/Frameworks; cp -R Growl.framework ${TargetDir}/${SolutionName}.app/Contents/Frameworks; cp -R git ${TargetDir}/${SolutionName}.app/Contents/Resources; cp -R SparkleShareInviteOpener.app ${TargetDir}/${SolutionName}.app/Contents/Resources" externalConsole="True" />
</CustomCommands>
</CustomCommands>
<EnableCodeSigning>false</EnableCodeSigning>
<CreatePackage>false</CreatePackage>
<EnablePackageSigning>false</EnablePackageSigning>
<IncludeMonoRuntime>true</IncludeMonoRuntime>
<ConsolePause>false</ConsolePause>
<EnableCodeSigning>False</EnableCodeSigning>
<CreatePackage>False</CreatePackage>
<EnablePackageSigning>False</EnablePackageSigning>
<IncludeMonoRuntime>True</IncludeMonoRuntime>
<ConsolePause>False</ConsolePause>
<CodeSigningKey>Mac Developer</CodeSigningKey>
<PackageSigningKey>3rd Party Mac Developer Installer</PackageSigningKey>
</PropertyGroup>
@ -120,42 +120,6 @@
<Content Include="Pixmaps\sparkleshare-app.icns">
<Link>sparkleshare-app.icns</Link>
</Content>
<Content Include="Pixmaps\process-syncing-i-active.png">
<Link>Pixmaps\process-syncing-i-active.png</Link>
</Content>
<Content Include="Pixmaps\process-syncing-i.png">
<Link>Pixmaps\process-syncing-i.png</Link>
</Content>
<Content Include="Pixmaps\process-syncing-ii-active.png">
<Link>Pixmaps\process-syncing-ii-active.png</Link>
</Content>
<Content Include="Pixmaps\process-syncing-ii.png">
<Link>Pixmaps\process-syncing-ii.png</Link>
</Content>
<Content Include="Pixmaps\process-syncing-iii-active.png">
<Link>Pixmaps\process-syncing-iii-active.png</Link>
</Content>
<Content Include="Pixmaps\process-syncing-iii.png">
<Link>Pixmaps\process-syncing-iii.png</Link>
</Content>
<Content Include="Pixmaps\process-syncing-iiii-active.png">
<Link>Pixmaps\process-syncing-iiii-active.png</Link>
</Content>
<Content Include="Pixmaps\process-syncing-iiii.png">
<Link>Pixmaps\process-syncing-iiii.png</Link>
</Content>
<Content Include="Pixmaps\process-syncing-iiiii-active.png">
<Link>Pixmaps\process-syncing-iiiii-active.png</Link>
</Content>
<Content Include="Pixmaps\process-syncing-iiiii.png">
<Link>Pixmaps\process-syncing-iiiii.png</Link>
</Content>
<Content Include="Pixmaps\process-syncing-error.png">
<Link>Pixmaps\process-syncing-error.png</Link>
</Content>
<Content Include="Pixmaps\process-syncing-error-active.png">
<Link>Pixmaps\process-syncing-error-active.png</Link>
</Content>
<Content Include="..\Linux\Pixmaps\icons\document-added-12.png">
<Link>Pixmaps\document-added-12.png</Link>
</Content>
@ -256,6 +220,16 @@
<Link>Plugins\ssnet.xml</Link>
</Content>
<Content Include="Growl.plist" />
<Content Include="Pixmaps\process-syncing-active.png" />
<Content Include="Pixmaps\process-syncing-down-active.png" />
<Content Include="Pixmaps\process-syncing-down.png" />
<Content Include="Pixmaps\process-syncing-error-active.png" />
<Content Include="Pixmaps\process-syncing-error.png" />
<Content Include="Pixmaps\process-syncing-idle-active.png" />
<Content Include="Pixmaps\process-syncing-idle.png" />
<Content Include="Pixmaps\process-syncing-up-active.png" />
<Content Include="Pixmaps\process-syncing-up.png" />
<Content Include="Pixmaps\process-syncing.png" />
</ItemGroup>
<ItemGroup>
<Folder Include="Pixmaps\" />

View file

@ -45,11 +45,19 @@ namespace SparkleShare {
private NSMenuItem notify_item;
private NSMenuItem recent_events_item;
private NSMenuItem quit_item;
private NSImage syncing_idle_image;
private NSImage syncing_up_image;
private NSImage syncing_down_image;
private NSImage syncing_image;
private NSImage syncing_error_image;
private NSImage syncing_idle_image_active;
private NSImage syncing_up_image_active;
private NSImage syncing_down_image_active;
private NSImage syncing_image_active;
private NSImage syncing_error_image_active;
private NSImage [] animation_frames;
private NSImage [] animation_frames_active;
private NSImage error_image;
private NSImage error_image_active;
private NSImage folder_image;
private NSImage caution_image;
private NSImage sparkleshare_image;
@ -62,15 +70,25 @@ namespace SparkleShare {
{
using (var a = new NSAutoreleasePool ())
{
CreateAnimationFrames ();
this.status_item = NSStatusBar.SystemStatusBar.CreateStatusItem (28);
this.status_item.HighlightMode = true;
this.status_item.Image = this.animation_frames [0];
this.status_item.Image = this.animation_frames [0];
this.status_item.Image.Size = new SizeF (16, 16);
this.status_item.AlternateImage = this.animation_frames_active [0];
this.syncing_idle_image = new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-idle.png"));
this.syncing_up_image = new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-up.png"));
this.syncing_down_image = new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-down.png"));
this.syncing_image = new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing.png"));
this.syncing_error_image = new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-error.png"));
this.syncing_idle_image_active = new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-idle-active.png"));
this.syncing_up_image_active = new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-up-active.png"));
this.syncing_down_image_active = new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-down-active.png"));
this.syncing_image_active = new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-active.png"));
this.syncing_error_image_active = new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-error-active.png"));
this.status_item.Image = this.syncing_idle_image;
this.status_item.Image.Size = new SizeF (16, 16);
this.status_item.AlternateImage = this.syncing_idle_image_active;
this.status_item.AlternateImage.Size = new SizeF (16, 16);
this.folder_image = NSImage.ImageNamed ("NSFolder");
@ -81,22 +99,40 @@ namespace SparkleShare {
}
Controller.UpdateIconEvent += delegate (int icon_frame) {
Controller.UpdateIconEvent += delegate (IconState state) {
using (var a = new NSAutoreleasePool ())
{
InvokeOnMainThread (delegate {
if (icon_frame > -1) {
this.status_item.Image = this.animation_frames [icon_frame];
this.status_item.Image.Size = new SizeF (16, 16);
this.status_item.AlternateImage = this.animation_frames_active [icon_frame];
this.status_item.AlternateImage.Size = new SizeF (16, 16);
} else {
this.status_item.Image = this.error_image;
this.status_item.AlternateImage = this.error_image_active;
this.status_item.Image.Size = new SizeF (16, 16);
this.status_item.AlternateImage.Size = new SizeF (16, 16);
switch (state) {
case IconState.Idle: {
this.status_item.Image = this.syncing_idle_image;
this.status_item.AlternateImage = this.syncing_idle_image_active;
break;
}
case IconState.SyncingUp: {
this.status_item.Image = this.syncing_up_image;
this.status_item.AlternateImage = this.syncing_up_image_active;
break;
}
case IconState.SyncingDown: {
this.status_item.Image = this.syncing_down_image;
this.status_item.AlternateImage = this.syncing_down_image_active;
break;
}
case IconState.Syncing: {
this.status_item.Image = this.syncing_image;
this.status_item.AlternateImage = this.syncing_image_active;
break;
}
case IconState.Error: {
this.status_item.Image = this.syncing_error_image;
this.status_item.AlternateImage = this.syncing_error_image_active;
break;
}
}
this.status_item.Image.Size = new SizeF (16, 16);
this.status_item.AlternateImage.Size = new SizeF (16, 16);
});
}
};
@ -314,32 +350,6 @@ namespace SparkleShare {
Controller.SubfolderClicked (name);
};
}
private void CreateAnimationFrames ()
{
this.animation_frames = new NSImage [] {
new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-i.png")),
new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-ii.png")),
new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-iii.png")),
new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-iiii.png")),
new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-iiiii.png"))
};
this.animation_frames_active = new NSImage [] {
new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-i-active.png")),
new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-ii-active.png")),
new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-iii-active.png")),
new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-iiii-active.png")),
new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-iiiii-active.png"))
};
this.error_image = new NSImage (
Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-error.png"));
this.error_image_active = new NSImage (
Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-error.png"));
}
}

View file

@ -36,7 +36,7 @@ namespace SparkleShare {
public class SparkleStatusIconController {
public event UpdateIconEventHandler UpdateIconEvent = delegate { };
public delegate void UpdateIconEventHandler (int icon_frame);
public delegate void UpdateIconEventHandler (IconState state);
public event UpdateMenuEventHandler UpdateMenuEvent = delegate { };
public delegate void UpdateMenuEventHandler (IconState state);
@ -119,14 +119,8 @@ namespace SparkleShare {
}
private Timer animation;
private int animation_frame_number;
public SparkleStatusIconController ()
{
InitAnimation ();
Program.Controller.FolderListChanged += delegate {
if (CurrentState != IconState.Error) {
CurrentState = IconState.Idle;
@ -155,9 +149,7 @@ namespace SparkleShare {
UpdateQuitItemEvent (QuitItemEnabled);
UpdateStatusItemEvent (StateText);
this.animation.Stop ();
UpdateIconEvent (0);
UpdateIconEvent (CurrentState);
UpdateMenuEvent (CurrentState);
};
@ -200,11 +192,9 @@ namespace SparkleShare {
StateText += " " + ProgressPercentage + "% " + ProgressSpeed;
UpdateIconEvent (CurrentState);
UpdateStatusItemEvent (StateText);
UpdateQuitItemEvent (QuitItemEnabled);
if (!this.animation.Enabled)
this.animation.Start ();
};
Program.Controller.OnError += delegate {
@ -213,10 +203,8 @@ namespace SparkleShare {
UpdateQuitItemEvent (QuitItemEnabled);
UpdateStatusItemEvent (StateText);
this.animation.Stop ();
UpdateIconEvent (-1);
UpdateIconEvent (CurrentState);
};
}
@ -255,24 +243,5 @@ namespace SparkleShare {
{
Program.Controller.Quit ();
}
private void InitAnimation ()
{
this.animation_frame_number = 0;
this.animation = new Timer () {
Interval = 50
};
this.animation.Elapsed += delegate {
if (this.animation_frame_number < 4)
this.animation_frame_number++;
else
this.animation_frame_number = 0;
UpdateIconEvent (this.animation_frame_number);
};
}
}
}