+TnyDevice*
+modest_runtime_get_device (void)
+{
+ g_return_val_if_fail (_singletons, NULL);
+ return modest_singletons_get_device (_singletons);
+}
+
+
+
+
ModestTnySendQueue*
modest_runtime_get_send_queue (TnyTransportAccount *account)
{
*
* get the ModestConf singleton instance
*
- * Returns: the ModestConf singleton
+ * Returns: the ModestConf singleton. This should NOT be unref'd.
**/
ModestConf* modest_runtime_get_conf (void);
*
* get the ModestAccountMgr singleton instance
*
- * Returns: the ModestAccountMgr singleton
+ * Returns: the ModestAccountMgr singleton. This should NOT be unref'd.
**/
ModestAccountMgr* modest_runtime_get_account_mgr (void);
*
* get the ModestTnyAccountStore singleton instance
*
- * Returns: the ModestTnyAccountStore singleton
+ * Returns: the ModestTnyAccountStore singleton. This should NOT be unref'd.
**/
ModestTnyAccountStore* modest_runtime_get_account_store (void);
*
* get the ModestCacheMgr singleton instance
*
- * Returns: the ModestCacheMgr singleton
+ * Returns: the ModestCacheMgr singleton. This should NOT be unref'd.
**/
ModestCacheMgr* modest_runtime_get_cache_mgr (void);
+
+/**
+ * modest_runtime_get_cache_mgr:
+ *
+ * get the TnyDevice singleton instance
+ *
+ * Returns: the TnyDevice singleton. This should NOT be unref'd.
+ **/
+TnyDevice* modest_runtime_get_device (void);
+
+
+
/**
* modest_runtime_get_mail_operation_queue:
*
* get the #ModestMailOperationQueue singleton instance
*
- * Returns: the #ModestMailOperationQueue singleton
+ * Returns: the #ModestMailOperationQueue singleton. This should NOT be unref'd.
**/
ModestMailOperationQueue* modest_runtime_get_mail_operation_queue (void);
* get the send queue for the given account
*
* Returns: the #ModestTnySendQueue singleton instance for this account
- * (ie., one singleton per account)
+ * (ie., one singleton per account). This should NOT be unref'd.
**/
ModestTnySendQueue* modest_runtime_get_send_queue (TnyTransportAccount *account);
ModestTnyAccountStore *account_store;
ModestCacheMgr *cache_mgr;
ModestMailOperationQueue *mail_op_queue;
+ TnyPlatformFactory *platform_fact;
+ TnyDevice *device;
};
#define MODEST_SINGLETONS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \
MODEST_TYPE_SINGLETONS, \
priv->account_store = NULL;
priv->cache_mgr = NULL;
priv->mail_op_queue = NULL;
+ priv->platform_fact = NULL;
+ priv->device = NULL;
priv->conf = modest_conf_new ();
if (!priv->conf) {
g_printerr ("modest: cannot create modest mail operation queue instance\n");
return;
}
+
+ priv->platform_fact = modest_tny_platform_factory_get_instance ();
+ if (!priv->platform_fact) {
+ g_printerr ("modest: cannot create platform factory instance\n");
+ return;
+ }
+
+ priv->device = tny_platform_factory_new_device (priv->platform_fact);
+ if (!priv->device) {
+ g_printerr ("modest: cannot create tny device instance\n");
+ return;
+ }
+
+
}
"priv->cache_mgr");
priv->cache_mgr = NULL;
}
+
+ if (priv->device) {
+ g_object_unref (G_OBJECT(priv->device));
+ check_object_is_dead ((GObject*)priv->cache_mgr,
+ "priv->device");
+ priv->device = NULL;
+ }
+
+ if (priv->platform_fact) {
+ g_object_unref (G_OBJECT(priv->platform_fact));
+ check_object_is_dead ((GObject*)priv->cache_mgr,
+ "priv->platform_fact");
+ priv->platform_fact = NULL;
+ }
+
+
G_OBJECT_CLASS(parent_class)->finalize (obj);
}
/* widget_factory will still be NULL, as it is initialized lazily */
if (!(priv->conf && priv->account_mgr && priv->account_store &&
- priv->cache_mgr && priv->mail_op_queue)) {
+ priv->cache_mgr && priv->mail_op_queue && priv->device && priv->platform_fact)) {
g_printerr ("modest: failed to create singletons instance\n");
g_object_unref (G_OBJECT(self));
self = NULL;
g_return_val_if_fail (self, NULL);
return MODEST_SINGLETONS_GET_PRIVATE(self)->mail_op_queue;
}
+
+
+
+TnyDevice*
+modest_singletons_get_device (ModestSingletons *self)
+{
+ g_return_val_if_fail (self, NULL);
+ return MODEST_SINGLETONS_GET_PRIVATE(self)->device;
+}
+
+
+
+TnyPlatformFactory*
+modest_singletons_get_platform_factory (ModestSingletons *self)
+{
+ g_return_val_if_fail (self, NULL);
+ return MODEST_SINGLETONS_GET_PRIVATE(self)->platform_fact;
+}
#include <modest-tny-account-store.h>
#include <modest-mail-operation-queue.h>
#include <modest-cache-mgr.h>
+#include <modest-tny-platform-factory.h>
G_BEGIN_DECLS
ModestCacheMgr* modest_singletons_get_cache_mgr (ModestSingletons *self);
+
+/**
+ * modest_singletons_get_platform_factory:
+ * @self: a valid #ModestSingletons instance
+ *
+ * get the #TnyPlatformFactory singleton instance
+ * don't use this function directly, use the modest-runtime
+ * functions instead.
+ *
+ * Returns: the #TnyPlatformFactory singleton
+ **/
+TnyPlatformFactory* modest_singletons_get_platform_factory (ModestSingletons *self);
+
+
+/**
+ * modest_singletons_get_device:
+ * @self: a valid #ModestSingletons instance
+ *
+ * get the #TnyDevice singleton instance
+ * don't use this function directly, use the modest-runtime
+ * functions instead.
+ *
+ * Returns: the #TnyDevice singleton
+ **/
+TnyDevice* modest_singletons_get_device (ModestSingletons *self);
+
+
/**
* modest_singletons_get_mail_operation_queue:
* @self: a valid ModestSingletons instance
ModestTnyAccountStorePrivate *priv;
priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE (self);
-
+
if (!priv->device)
priv->device = tny_platform_factory_new_device
(modest_tny_platform_factory_get_instance());