*/
/* modest-tny-platform-factory.c */
+#include <config.h>
+
+/* MODES_PLATFORM_ID: 1 ==> gtk, 2==> maemo */
+#if MODEST_PLATFORM_ID==1
+#include <tny-gnome-device.h>
+#elif MODEST_PLATFORM_ID==2
+#include <tny-maemo-device.h>
+#endif
#include "modest-tny-platform-factory.h"
#include "modest-tny-account-store.h"
static GObject *modest_tny_platform_factory_constructor (GType type, guint n_construct_params,
GObjectConstructParam *construct_params);
static void tny_platform_factory_init (gpointer g, gpointer iface_data);
-static TnyAccountStore *modest_tny_platform_factory_new_account_store (TnyPlatformFactory *self);
-static TnyDevice *modest_tny_platform_factory_new_device (TnyPlatformFactory *self);
-static TnyMsgView *modest_tny_platform_factory_new_msg_view (TnyPlatformFactory *self);
+
+static TnyAccountStore* modest_tny_platform_factory_new_account_store (TnyPlatformFactory *self);
+static TnyDevice* modest_tny_platform_factory_new_device (TnyPlatformFactory *self);
+static TnyMsgView* modest_tny_platform_factory_new_msg_view (TnyPlatformFactory *self);
+static TnyMsg* modest_tny_platform_factory_new_msg (TnyPlatformFactory *self);
+static TnyMimePart* modest_tny_platform_factory_new_mime_part (TnyPlatformFactory *self);
+static TnyHeader* modest_tny_platform_factory_new_header (TnyPlatformFactory *self);
+
+
/* list my signals */
enum {
/* MY_SIGNAL_1, */
typedef struct _ModestTnyPlatformFactoryPrivate ModestTnyPlatformFactoryPrivate;
struct _ModestTnyPlatformFactoryPrivate {
- ModestTnyAccountStore *account_store;
- ModestConf *conf;
- ModestAccountMgr *account_mgr;
+ ModestTnyAccountStore *account_store;
+ ModestConf *conf;
+ ModestAccountMgr *account_mgr;
+ ModestMailOperationQueue *mail_op_queue;
};
+
#define MODEST_TNY_PLATFORM_FACTORY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \
MODEST_TYPE_TNY_PLATFORM_FACTORY, \
ModestTnyPlatformFactoryPrivate))
static void
modest_tny_platform_factory_init (ModestTnyPlatformFactory *obj)
{
- /* Empty implementation */
+ 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;
}
static GObject*
priv = MODEST_TNY_PLATFORM_FACTORY_GET_PRIVATE(obj);
- if (priv->account_mgr) {
+ if (priv->account_mgr)
g_object_unref (priv->account_mgr);
- priv->account_mgr = NULL;
- }
- if (priv->conf) {
+ if (priv->conf)
g_object_unref (priv->conf);
- priv->conf = NULL;
- }
- if (priv->account_store) {
+ if (priv->account_store)
g_object_unref (priv->account_store);
- priv->account_store = NULL;
- }
+
+ if (priv->mail_op_queue)
+ g_object_unref (priv->mail_op_queue);
G_OBJECT_CLASS(parent_class)->finalize (obj);
}
klass->new_account_store_func = modest_tny_platform_factory_new_account_store;
klass->new_device_func = modest_tny_platform_factory_new_device;
klass->new_msg_view_func = modest_tny_platform_factory_new_msg_view;
+ klass->new_msg_func = modest_tny_platform_factory_new_msg;
+ klass->new_mime_part_func = modest_tny_platform_factory_new_mime_part;
+ klass->new_header_func = modest_tny_platform_factory_new_header;
return;
}
static TnyDevice *
modest_tny_platform_factory_new_device (TnyPlatformFactory *self)
{
- /* FIXME: do not use GNOME */
+/* MODES_PLATFORM_ID: 1 ==> gtk, 2==> maemo */
+#if MODEST_PLATFORM_ID==1
return TNY_DEVICE (tny_gnome_device_new ());
+#elif MODEST_PLATFORM_ID==2
+ return TNY_DEVICE (tny_maemo_device_new ());
+#else
+ return NULL;
+#endif /* MODEST_PLATFORM */
}
static TnyMsgView*
return NULL;
}
+static TnyMsg*
+modest_tny_platform_factory_new_msg (TnyPlatformFactory *self)
+{
+ return tny_camel_msg_new ();
+}
+
+
+static TnyMimePart*
+modest_tny_platform_factory_new_mime_part (TnyPlatformFactory *self)
+{
+ return tny_camel_mime_part_new ();
+}
+
+
+static TnyHeader*
+modest_tny_platform_factory_new_header (TnyPlatformFactory *self)
+{
+ return tny_camel_header_new ();
+}
+
+
ModestAccountMgr *
modest_tny_platform_factory_get_modest_account_mgr_instance (TnyPlatformFactory *fact)
{
return priv->conf;
}
+
+ModestMailOperationQueue*
+modest_tny_platform_factory_get_modest_mail_operation_queue_instance (TnyPlatformFactory *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;
+}