X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=src%2Fmodest-tny-platform-factory.c;h=1ca0853ae74095b05ef4ba58067f985ee9ded1ee;hb=964440c19ad82d995617ddfea3f5ce52bb606b59;hp=dcf393fdeee9de500f0076476e8e25a95b67b6fb;hpb=e89a59542dc457b92443a0af5e7dc4cc03ac6eb2;p=modest diff --git a/src/modest-tny-platform-factory.c b/src/modest-tny-platform-factory.c index dcf393f..1ca0853 100644 --- a/src/modest-tny-platform-factory.c +++ b/src/modest-tny-platform-factory.c @@ -30,6 +30,7 @@ /* modest-tny-platform-factory.c */ #include +#include #include #include #include @@ -68,12 +69,7 @@ enum { }; typedef struct _ModestTnyPlatformFactoryPrivate ModestTnyPlatformFactoryPrivate; -struct _ModestTnyPlatformFactoryPrivate { - ModestTnyAccountStore *account_store; - ModestConf *conf; - ModestAccountMgr *account_mgr; - ModestMailOperationQueue *mail_op_queue; -}; +struct _ModestTnyPlatformFactoryPrivate {}; #define MODEST_TNY_PLATFORM_FACTORY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \ MODEST_TYPE_TNY_PLATFORM_FACTORY, \ @@ -82,9 +78,6 @@ struct _ModestTnyPlatformFactoryPrivate { static GObjectClass *parent_class = NULL; static ModestTnyPlatformFactory *singleton = NULL; -/* uncomment the following if you have defined any signals */ -/* static guint signals[LAST_SIGNAL] = {0}; */ - GType modest_tny_platform_factory_get_type (void) { @@ -136,13 +129,7 @@ modest_tny_platform_factory_class_init (ModestTnyPlatformFactoryClass *klass) static void modest_tny_platform_factory_init (ModestTnyPlatformFactory *obj) { - ModestTnyPlatformFactoryPrivate *priv; - priv = MODEST_TNY_PLATFORM_FACTORY_GET_PRIVATE(obj); - - priv->account_mgr = NULL; - priv->conf = NULL; - priv->account_store = NULL; - priv->mail_op_queue = NULL; + /* empty */ } static GObject* @@ -167,22 +154,6 @@ modest_tny_platform_factory_constructor (GType type, guint n_construct_params, static void modest_tny_platform_factory_finalize (GObject *obj) { - ModestTnyPlatformFactoryPrivate *priv; - - priv = MODEST_TNY_PLATFORM_FACTORY_GET_PRIVATE(obj); - - if (priv->account_mgr) - g_object_unref (priv->account_mgr); - - if (priv->conf) - g_object_unref (priv->conf); - - if (priv->account_store) - g_object_unref (priv->account_store); - - if (priv->mail_op_queue) - g_object_unref (priv->mail_op_queue); - G_OBJECT_CLASS(parent_class)->finalize (obj); } @@ -212,18 +183,8 @@ modest_tny_platform_factory_get_instance (void) static TnyAccountStore * modest_tny_platform_factory_new_account_store (TnyPlatformFactory *self) { - ModestTnyPlatformFactoryPrivate *priv; - - priv = MODEST_TNY_PLATFORM_FACTORY_GET_PRIVATE(self); - - if (!priv->account_store) { - if (!priv->account_mgr) - modest_tny_platform_factory_get_account_mgr_instance (self); - - priv->account_store = modest_tny_account_store_new (priv->account_mgr); - } - - return TNY_ACCOUNT_STORE (priv->account_store); + return TNY_ACCOUNT_STORE(modest_tny_account_store_new + (modest_runtime_get_account_mgr())); } static TnyDevice * @@ -265,46 +226,3 @@ modest_tny_platform_factory_new_header (TnyPlatformFactory *self) { return tny_camel_header_new (); } - - -ModestAccountMgr * -modest_tny_platform_factory_get_account_mgr_instance (ModestTnyPlatformFactory *fact) -{ - ModestTnyPlatformFactoryPrivate *priv; - - priv = MODEST_TNY_PLATFORM_FACTORY_GET_PRIVATE(fact); - - if (!priv->account_mgr) { - if (!priv->conf) - modest_tny_platform_factory_get_conf_instance (fact); - priv->account_mgr = modest_account_mgr_new (priv->conf); - } - - return priv->account_mgr; -} - -ModestConf * -modest_tny_platform_factory_get_conf_instance (ModestTnyPlatformFactory *fact) -{ - ModestTnyPlatformFactoryPrivate *priv; - - priv = MODEST_TNY_PLATFORM_FACTORY_GET_PRIVATE(fact); - - if (!priv->conf) - priv->conf = modest_conf_new (); - - return priv->conf; -} - -ModestMailOperationQueue* -modest_tny_platform_factory_get_mail_operation_queue_instance (ModestTnyPlatformFactory *fact) -{ - ModestTnyPlatformFactoryPrivate *priv; - - priv = MODEST_TNY_PLATFORM_FACTORY_GET_PRIVATE(fact); - - if (!priv->mail_op_queue) - priv->mail_op_queue = modest_mail_operation_queue_new (); - - return priv->mail_op_queue; -}