[statusicon] code cleanup
This commit is contained in:
parent
9e83c7c151
commit
e52b5e930e
|
@ -52,8 +52,9 @@ namespace SparkleShare {
|
||||||
|
|
||||||
FolderSize = GetFolderSize (new DirectoryInfo (SparklePaths.SparklePath));
|
FolderSize = GetFolderSize (new DirectoryInfo (SparklePaths.SparklePath));
|
||||||
|
|
||||||
CreateAnimationFrames ();
|
FrameNumber = 0;
|
||||||
CreateTimer ();
|
AnimationFrames = CreateAnimationFrames ();
|
||||||
|
Timer = CreateTimer ();
|
||||||
|
|
||||||
SyncingReposCount = 0;
|
SyncingReposCount = 0;
|
||||||
|
|
||||||
|
@ -61,7 +62,11 @@ namespace SparkleShare {
|
||||||
StatusMenuItem = new MenuItem ();
|
StatusMenuItem = new MenuItem ();
|
||||||
|
|
||||||
CreateMenu ();
|
CreateMenu ();
|
||||||
|
|
||||||
|
// Primary mouse button
|
||||||
Activate += ShowMenu;
|
Activate += ShowMenu;
|
||||||
|
|
||||||
|
// Secondary mouse button
|
||||||
PopupMenu += ShowMenu;
|
PopupMenu += ShowMenu;
|
||||||
|
|
||||||
SetIdleState ();
|
SetIdleState ();
|
||||||
|
@ -70,29 +75,29 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void CreateAnimationFrames ()
|
private Gdk.Pixbuf [] CreateAnimationFrames ()
|
||||||
{
|
{
|
||||||
|
|
||||||
FrameNumber = 0;
|
Gdk.Pixbuf [] animation_frames = new Gdk.Pixbuf [5];
|
||||||
|
|
||||||
AnimationFrames = new Gdk.Pixbuf [5];
|
|
||||||
Gdk.Pixbuf frames_pixbuf = SparkleHelpers.GetIcon ("process-syncing-sparkleshare", 24);
|
Gdk.Pixbuf frames_pixbuf = SparkleHelpers.GetIcon ("process-syncing-sparkleshare", 24);
|
||||||
|
|
||||||
for (int i = 0; i < AnimationFrames.Length; i++)
|
for (int i = 0; i < animation_frames.Length; i++)
|
||||||
AnimationFrames [i] = new Gdk.Pixbuf (frames_pixbuf, (i * 24), 0, 24, 24);
|
animation_frames [i] = new Gdk.Pixbuf (frames_pixbuf, (i * 24), 0, 24, 24);
|
||||||
|
|
||||||
|
return animation_frames;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Creates the timer that handles the syncing animation
|
// Creates the timer that handles the syncing animation
|
||||||
private void CreateTimer ()
|
private Timer CreateTimer ()
|
||||||
{
|
{
|
||||||
|
|
||||||
Timer = new Timer () {
|
Timer timer = new Timer () {
|
||||||
Interval = 35
|
Interval = 35
|
||||||
};
|
};
|
||||||
|
|
||||||
Timer.Elapsed += delegate {
|
timer.Elapsed += delegate {
|
||||||
|
|
||||||
if (FrameNumber < AnimationFrames.Length - 1)
|
if (FrameNumber < AnimationFrames.Length - 1)
|
||||||
FrameNumber++;
|
FrameNumber++;
|
||||||
|
@ -103,6 +108,8 @@ namespace SparkleShare {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
return timer;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue