* modest-cache-mgr.c:
authorDirk-Jan C. Binnema <dirk-jan.binnema@nokia.com>
Mon, 22 Jan 2007 13:27:20 +0000 (13:27 +0000)
committerDirk-Jan C. Binnema <dirk-jan.binnema@nokia.com>
Mon, 22 Jan 2007 13:27:20 +0000 (13:27 +0000)
  - glib < 2.12 does not support g_hash_table_remove_all, therefore
    use g_hash_table_foreach_remove instead

pmo-trunk-r693

src/modest-cache-mgr.c

index 3097e26..61fb100 100644 (file)
@@ -182,6 +182,13 @@ modest_cache_mgr_get_cache   (ModestCacheMgr* self, ModestCacheMgrCacheType type
 }
 
 
+static gboolean
+always_true (gpointer key, gpointer value, gpointer user_data)
+{
+       return TRUE;
+}
+
+
 void
 modest_cache_mgr_flush (ModestCacheMgr *self, ModestCacheMgrCacheType type)
 {
@@ -192,10 +199,11 @@ modest_cache_mgr_flush (ModestCacheMgr *self, ModestCacheMgrCacheType type)
        g_return_if_fail (type >= 0 && type <= MODEST_CACHE_MGR_CACHE_TYPE_NUM);
 
        priv  = MODEST_CACHE_MGR_GET_PRIVATE(self);
+
        cache = get_cache (priv, type);
-       
        if (cache)
-               g_hash_table_remove_all (cache);
+               g_hash_table_foreach_remove (cache, always_true, NULL);
+       /*  g_hash_table_remove_all (cache) in only available since GLIB 2.12 */
 }