animate statusicon when syncing
This commit is contained in:
parent
bdc9264653
commit
2a89dce0c8
|
@ -193,6 +193,7 @@ namespace SparkleShare {
|
|||
// Push again in case of a conflict
|
||||
Push ();
|
||||
}
|
||||
// SparkleUI.NotificationIcon.SetIdleState ();
|
||||
}
|
||||
|
||||
// Commits the made changes
|
||||
|
|
|
@ -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 () {
|
||||
|
|
|
@ -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];
|
||||
|
@ -107,9 +112,6 @@ namespace SparkleShare {
|
|||
// 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 |
Loading…
Reference in a new issue