[libsocialweb] lastfm-item-view: Stop update timeout when the credentials are invalid



commit ea1dc52ef6dfba717e576d0dffe6435431efa079
Author: Gary Ching-Pang Lin <chingpang gmail com>
Date:   Wed Dec 15 17:01:18 2010 +0800

    lastfm-item-view: Stop update timeout when the credentials are invalid
    
    Signed-off-by: Gary Ching-Pang Lin <chingpang gmail com>

 services/lastfm/lastfm-item-view.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/services/lastfm/lastfm-item-view.c b/services/lastfm/lastfm-item-view.c
index cfc5b2f..18faab6 100644
--- a/services/lastfm/lastfm-item-view.c
+++ b/services/lastfm/lastfm-item-view.c
@@ -661,9 +661,24 @@ _service_capabilities_changed_cb (SwService    *service,
                                   const gchar **caps,
                                   SwItemView   *item_view)
 {
+  SwLastfmItemViewPrivate *priv = GET_PRIVATE ((SwLastfmItemView*) item_view);
+
   if (sw_service_has_cap (caps, CREDENTIALS_VALID))
   {
     lastfm_item_view_refresh (item_view);
+    if (!priv->timeout_id)
+    {
+      priv->timeout_id = g_timeout_add_seconds (UPDATE_TIMEOUT,
+                                                (GSourceFunc)_update_timeout_cb,
+                                                item_view);
+    }
+  } else {
+    if (priv->timeout_id)
+    {
+      g_source_remove (priv->timeout_id);
+      priv->timeout_id = 0;
+    }
+
   }
 }
 



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