spinner: fix coding style and whitespace

This commit is contained in:
Hylke Bons 2011-05-14 01:38:55 +01:00
parent 632c57da13
commit aed1c9fa2d

View file

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