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



commit 85a11d5c853aaa42f50d9217624dd5563ede1cc4
Author: Gary Ching-Pang Lin <chingpang gmail com>
Date:   Wed Dec 15 16:59:36 2010 +0800

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

 services/twitter/twitter-item-view.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/services/twitter/twitter-item-view.c b/services/twitter/twitter-item-view.c
index 895e747..4401db1 100644
--- a/services/twitter/twitter-item-view.c
+++ b/services/twitter/twitter-item-view.c
@@ -624,9 +624,23 @@ _service_capabilities_changed_cb (SwService    *service,
                                   const gchar **caps,
                                   SwItemView   *item_view)
 {
+  SwTwitterItemViewPrivate *priv = GET_PRIVATE ((SwTwitterItemView*) item_view);
+
   if (sw_service_has_cap (caps, CREDENTIALS_VALID))
   {
     twitter_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]