window: simplify refresh sources timeout code

This commit is contained in:
Georges Basile Stavracas Neto
2015-01-03 18:41:19 -02:00
parent 8aefe71316
commit 3cde8ad4f4
+2 -6
View File
@@ -818,19 +818,15 @@ static gboolean
refresh_sources (GcalWindow *window) refresh_sources (GcalWindow *window)
{ {
GcalWindowPrivate *priv; GcalWindowPrivate *priv;
static gint current_timeout = 0; static gint current_timeout = FAST_REFRESH_TIMEOUT;
priv = gcal_window_get_instance_private (window); priv = gcal_window_get_instance_private (window);
/* update current_timeout the first time it's called */
if (current_timeout == 0)
current_timeout = priv->refresh_timeout;
/* refresh sources */ /* refresh sources */
gcal_manager_refresh (priv->manager); gcal_manager_refresh (priv->manager);
/* check window state */ /* check window state */
if (current_timeout != 0 && current_timeout != priv->refresh_timeout) if (current_timeout != priv->refresh_timeout)
{ {
current_timeout = priv->refresh_timeout; current_timeout = priv->refresh_timeout;