animate statusicon when syncing

This commit is contained in:
Hylke Bons 2010-05-23 16:02:46 +01:00
parent de18760314
commit ea3c0dcbb1
5 changed files with 1002 additions and 25 deletions

View file

@ -193,6 +193,7 @@ namespace SparkleShare {
// Push again in case of a conflict
Push ();
}
// SparkleUI.NotificationIcon.SetIdleState ();
}
// Commits the made changes

View file

@ -18,13 +18,16 @@ using Gtk;
using Mono.Unix;
using SparkleShare;
using System;
using System.IO;
using System.Diagnostics;
using System.IO;
using System.Timers;
namespace SparkleShare {
public class SparkleStatusIcon : StatusIcon {
private Timer Timer;
// Short alias for the translations
public static string _ (string s) {
return Catalog.GetString (s);
@ -39,6 +42,8 @@ namespace SparkleShare {
public SparkleStatusIcon () : base () {
Timer = new Timer ();
Activate += delegate {
Menu Menu = new Menu();
@ -135,11 +140,46 @@ namespace SparkleShare {
}
public void SetIdleState () {
IconName = "folder-sparkleshare";
Timer.Stop ();
Pixbuf = SparkleHelpers.GetIcon ("folder-sparkleshare", 24);
}
public void SetSyncingState () {
// IconName = "folder-syncing";
// TODO: Animate statusicon when syncing
/* int CycleDuration = 250;
int CurrentStep = 0;
int Size = 24;
Gdk.Pixbuf SpinnerGallery = SparkleHelpers.GetIcon ("process-syncing-sparkleshare",
Size);
int FramesInWidth = SpinnerGallery.Width / Size;
int FramesInHeight = SpinnerGallery.Height / Size;
int NumSteps = FramesInWidth * FramesInHeight;
Gdk.Pixbuf [] Images = new Gdk.Pixbuf [NumSteps - 1];
int i = 0;
for (int y = 0; y < FramesInHeight; y++) {
for (int x = 0; x < FramesInWidth; x++) {
if (!(y == 0 && x == 0)) {
Images [i] = new Gdk.Pixbuf (SpinnerGallery,
x * Size, y * Size, Size, Size);
i++;
}
}
}
Timer.Interval = CycleDuration / NumSteps;
Timer.Elapsed += delegate {
if (CurrentStep < NumSteps)
CurrentStep++;
else
CurrentStep = 0;
Pixbuf = Images [CurrentStep];
};
Timer.Start ();
*/
}
public void SetErrorState () {

View file

@ -72,6 +72,11 @@ namespace SparkleShare {
}
if (!HideUI) {
// Create the status icon
NotificationIcon = new SparkleStatusIcon ();
}
// Get all the repos in ~/SparkleShare
SparkleRepo [] TmpRepos =
new SparkleRepo [Directory.GetDirectories (SparklePath).Length];
@ -106,9 +111,6 @@ namespace SparkleShare {
// Don't create the window and status
// icon when --disable-gui was given
if (!HideUI) {
// Create the status icon
NotificationIcon = new SparkleStatusIcon ();
// Show a notification if there are no folders yet
if (SparkleShare.Repositories.Length == 0) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

File diff suppressed because it is too large Load diff

Before

Width:  |  Height:  |  Size: 858 KiB

After

Width:  |  Height:  |  Size: 924 KiB