animate statusicon when syncing
This commit is contained in:
parent
de18760314
commit
ea3c0dcbb1
|
@ -193,6 +193,7 @@ namespace SparkleShare {
|
||||||
// Push again in case of a conflict
|
// Push again in case of a conflict
|
||||||
Push ();
|
Push ();
|
||||||
}
|
}
|
||||||
|
// SparkleUI.NotificationIcon.SetIdleState ();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Commits the made changes
|
// Commits the made changes
|
||||||
|
|
|
@ -18,13 +18,16 @@ using Gtk;
|
||||||
using Mono.Unix;
|
using Mono.Unix;
|
||||||
using SparkleShare;
|
using SparkleShare;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.Timers;
|
||||||
|
|
||||||
namespace SparkleShare {
|
namespace SparkleShare {
|
||||||
|
|
||||||
public class SparkleStatusIcon : StatusIcon {
|
public class SparkleStatusIcon : StatusIcon {
|
||||||
|
|
||||||
|
private Timer Timer;
|
||||||
|
|
||||||
// Short alias for the translations
|
// Short alias for the translations
|
||||||
public static string _ (string s) {
|
public static string _ (string s) {
|
||||||
return Catalog.GetString (s);
|
return Catalog.GetString (s);
|
||||||
|
@ -39,6 +42,8 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public SparkleStatusIcon () : base () {
|
public SparkleStatusIcon () : base () {
|
||||||
|
|
||||||
|
Timer = new Timer ();
|
||||||
|
|
||||||
Activate += delegate {
|
Activate += delegate {
|
||||||
|
|
||||||
Menu Menu = new Menu();
|
Menu Menu = new Menu();
|
||||||
|
@ -135,11 +140,46 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetIdleState () {
|
public void SetIdleState () {
|
||||||
IconName = "folder-sparkleshare";
|
Timer.Stop ();
|
||||||
|
Pixbuf = SparkleHelpers.GetIcon ("folder-sparkleshare", 24);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetSyncingState () {
|
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 () {
|
public void SetErrorState () {
|
||||||
|
|
|
@ -72,6 +72,11 @@ namespace SparkleShare {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!HideUI) {
|
||||||
|
// Create the status icon
|
||||||
|
NotificationIcon = new SparkleStatusIcon ();
|
||||||
|
}
|
||||||
|
|
||||||
// Get all the repos in ~/SparkleShare
|
// Get all the repos in ~/SparkleShare
|
||||||
SparkleRepo [] TmpRepos =
|
SparkleRepo [] TmpRepos =
|
||||||
new SparkleRepo [Directory.GetDirectories (SparklePath).Length];
|
new SparkleRepo [Directory.GetDirectories (SparklePath).Length];
|
||||||
|
@ -106,9 +111,6 @@ namespace SparkleShare {
|
||||||
// Don't create the window and status
|
// Don't create the window and status
|
||||||
// icon when --disable-gui was given
|
// icon when --disable-gui was given
|
||||||
if (!HideUI) {
|
if (!HideUI) {
|
||||||
|
|
||||||
// Create the status icon
|
|
||||||
NotificationIcon = new SparkleStatusIcon ();
|
|
||||||
|
|
||||||
// Show a notification if there are no folders yet
|
// Show a notification if there are no folders yet
|
||||||
if (SparkleShare.Repositories.Length == 0) {
|
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