spinner: fix coding style and whitespace
This commit is contained in:
parent
632c57da13
commit
aed1c9fa2d
|
@ -14,14 +14,14 @@
|
|||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
using Gtk;
|
||||
|
||||
using System.Timers;
|
||||
using Gtk;
|
||||
|
||||
namespace SparkleShare {
|
||||
|
||||
// This is a close implementation of GtkSpinner
|
||||
public class SparkleSpinner : Image
|
||||
{
|
||||
public class SparkleSpinner : Image {
|
||||
|
||||
public bool Active;
|
||||
|
||||
|
@ -32,9 +32,9 @@ namespace SparkleShare {
|
|||
private int NumSteps;
|
||||
private int Size;
|
||||
|
||||
|
||||
public SparkleSpinner (int size) : base ()
|
||||
{
|
||||
|
||||
Size = size;
|
||||
|
||||
CycleDuration = 600;
|
||||
|
@ -51,18 +51,12 @@ namespace SparkleShare {
|
|||
int i = 0;
|
||||
|
||||
for (int y = 0; y < frames_in_height; y++) {
|
||||
|
||||
for (int x = 0; x < frames_in_width; x++) {
|
||||
|
||||
if (!(y == 0 && x == 0)) {
|
||||
|
||||
Images [i] = new Gdk.Pixbuf (spinner_gallery, x * Size, y * Size, Size, Size);
|
||||
i++;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Timer = new Timer () {
|
||||
|
@ -74,52 +68,44 @@ namespace SparkleShare {
|
|||
};
|
||||
|
||||
Start ();
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void NextImage ()
|
||||
{
|
||||
|
||||
if (CurrentStep < NumSteps - 2)
|
||||
CurrentStep++;
|
||||
else
|
||||
CurrentStep = 0;
|
||||
|
||||
Application.Invoke (delegate { SetImage (); });
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void SetImage ()
|
||||
{
|
||||
|
||||
Pixbuf = Images [CurrentStep];
|
||||
|
||||
}
|
||||
|
||||
|
||||
public bool IsActive ()
|
||||
{
|
||||
|
||||
return Active;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void Start ()
|
||||
{
|
||||
|
||||
CurrentStep = 0;
|
||||
Active = true;
|
||||
Timer.Start ();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void Stop ()
|
||||
{
|
||||
|
||||
Active = false;
|
||||
Timer.Stop ();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue