[gnome-software] GsSpinner: Avoid restarting animation when repeatedly calling start



commit a642c0d44d19b05e0cd43e7a70fc36004a7374d7
Author: Kalev Lember <kalevlember gmail com>
Date:   Sun Oct 5 17:47:11 2014 +0200

    GsSpinner: Avoid restarting animation when repeatedly calling start

 src/gs-utils.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-utils.c b/src/gs-utils.c
index dc532e3..30fdd9c 100644
--- a/src/gs-utils.c
+++ b/src/gs-utils.c
@@ -80,8 +80,14 @@ gs_stop_spinner (GtkSpinner *spinner)
 void
 gs_start_spinner (GtkSpinner *spinner)
 {
+       gboolean active;
        guint id;
 
+       /* Don't do anything if it's already spinning */
+       g_object_get (spinner, "active", &active, NULL);
+       if (active || g_object_get_data (G_OBJECT (spinner), "start-timeout") != NULL)
+               return;
+
        gtk_widget_set_opacity (GTK_WIDGET (spinner), 0);
        id = g_timeout_add (SPINNER_DELAY, start_spinning, spinner);
        g_object_set_data_full (G_OBJECT (spinner), "start-timeout",


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]