ModestConf *conf;
ModestAccountMgr *account_mgr;
ModestMailOperationQueue *mail_op_queue;
+ ModestCacheMgr *cache_mgr;
};
#define MODEST_TNY_PLATFORM_FACTORY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \
priv->conf = NULL;
priv->account_store = NULL;
priv->mail_op_queue = NULL;
+ priv->cache_mgr = NULL;
}
static GObject*
priv = MODEST_TNY_PLATFORM_FACTORY_GET_PRIVATE(obj);
if (priv->account_mgr)
- g_object_unref (priv->account_mgr);
+ g_object_unref (G_OBJECT(priv->account_mgr));
if (priv->conf)
- g_object_unref (priv->conf);
+ g_object_unref (G_OBJECT(priv->conf));
if (priv->account_store)
- g_object_unref (priv->account_store);
+ g_object_unref (G_OBJECT(priv->account_store));
if (priv->mail_op_queue)
- g_object_unref (priv->mail_op_queue);
+ g_object_unref (G_OBJECT(priv->mail_op_queue));
+
+ if (priv->cache_mgr)
+ g_object_unref (G_OBJECT(priv->cache_mgr));
G_OBJECT_CLASS(parent_class)->finalize (obj);
}
{
ModestTnyPlatformFactoryPrivate *priv;
+ g_return_val_if_fail (fact, NULL);
+
priv = MODEST_TNY_PLATFORM_FACTORY_GET_PRIVATE(fact);
if (!priv->account_mgr) {
modest_tny_platform_factory_get_conf_instance (ModestTnyPlatformFactory *fact)
{
ModestTnyPlatformFactoryPrivate *priv;
-
+
+ g_return_val_if_fail (fact, NULL);
+
priv = MODEST_TNY_PLATFORM_FACTORY_GET_PRIVATE(fact);
if (!priv->conf)
{
ModestTnyPlatformFactoryPrivate *priv;
+ g_return_val_if_fail (fact, NULL);
+
priv = MODEST_TNY_PLATFORM_FACTORY_GET_PRIVATE(fact);
if (!priv->mail_op_queue)
return priv->mail_op_queue;
}
+
+
+
+ModestCacheMgr*
+modest_tny_platform_factory_get_cache_mgr_instance (ModestTnyPlatformFactory *fact)
+{
+ ModestTnyPlatformFactoryPrivate *priv;
+
+ g_return_val_if_fail (fact, NULL);
+
+ priv = MODEST_TNY_PLATFORM_FACTORY_GET_PRIVATE(fact);
+
+ if (!priv->cache_mgr)
+ priv->cache_mgr = modest_cache_mgr_new ();
+
+ return priv->cache_mgr;
+}
#include <glib-object.h>
#include <tny-platform-factory.h>
-#include "modest-account-mgr.h"
-#include "modest-conf.h"
-#include "modest-mail-operation-queue.h"
+#include <modest-account-mgr.h>
+#include <modest-conf.h>
+#include <modest-mail-operation-queue.h>
+#include <modest-cache-mgr.h>
G_BEGIN_DECLS
ModestMailOperationQueue* modest_tny_platform_factory_get_mail_operation_queue_instance (ModestTnyPlatformFactory *fact);
+/**
+ * modest_tny_platform_factory_get_cache_mgr_instance:
+ * @fact: the #TnyPlatformFactory that holds the #ModestCacheMgr instance
+ *
+ * Gets a new instance of a #ModestCacheMgr if it is the
+ * first call to the function, or the current instantiated one
+ * otherwise. This object is supposed to be a singleton
+ *
+ * Returns: an instance of a #ModestCacheMgr.
+ **/
+ModestCacheMgr* modest_tny_platform_factory_get_cache_mgr_instance (ModestTnyPlatformFactory *fact);
+
+
+
+
G_END_DECLS
#endif /* __MODEST_TNY_PLATFORM_FACTORY_H__ */