Fix modest_tny_msg_header_get_all_recipients_list (in case from is empty)
[modest] / src / modest-tny-platform-factory.c
index ded4a91..84290ef 100644 (file)
 #include <config.h>
 
 #include <modest-runtime.h>
+#include <modest-platform.h>
+
 #include <tny-camel-header.h>
 #include <tny-camel-mime-part.h>
 #include <tny-camel-msg.h>
 
 #include "modest-tny-platform-factory.h"
 #include "modest-tny-account-store.h"
+#ifdef MODEST_USE_MOZEMBED
+#include <widgets/modest-mozembed-msg-view.h>
+#else
+#include <widgets/modest-gtkhtml-msg-view.h>
+#endif
 
 /* 'private'/'protected' functions */
 static void modest_tny_platform_factory_class_init (ModestTnyPlatformFactoryClass *klass);
@@ -51,8 +58,6 @@ static TnyDevice*       modest_tny_platform_factory_new_device        (TnyPlatfo
 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 {
@@ -61,12 +66,16 @@ enum {
        LAST_SIGNAL
 };
 
-typedef struct _ModestTnyPlatformFactoryPrivate ModestTnyPlatformFactoryPrivate;
-struct _ModestTnyPlatformFactoryPrivate {};
+/* PRIVATE area commented as it's empty now. If you enable this again remember to enable also
+ * private area registration in class init */
+
+/* typedef struct _ModestTnyPlatformFactoryPrivate ModestTnyPlatformFactoryPrivate; */
+/* struct _ModestTnyPlatformFactoryPrivate {}; */
+
+/* #define MODEST_TNY_PLATFORM_FACTORY_GET_PRIVATE(o)      (G_TYPE_INSTANCE_GET_PRIVATE((o), \ */
+/*                                                          MODEST_TYPE_TNY_PLATFORM_FACTORY, \ */
+/*                                                          ModestTnyPlatformFactoryPrivate)) */
 
-#define MODEST_TNY_PLATFORM_FACTORY_GET_PRIVATE(o)      (G_TYPE_INSTANCE_GET_PRIVATE((o), \
-                                                         MODEST_TYPE_TNY_PLATFORM_FACTORY, \
-                                                         ModestTnyPlatformFactoryPrivate))
 /* globals */
 static GObjectClass *parent_class = NULL;
 static ModestTnyPlatformFactory *singleton = NULL;
@@ -116,7 +125,7 @@ modest_tny_platform_factory_class_init (ModestTnyPlatformFactoryClass *klass)
        gobject_class->finalize = modest_tny_platform_factory_finalize;
        gobject_class->constructor = modest_tny_platform_factory_constructor;
 
-       g_type_class_add_private (gobject_class, sizeof(ModestTnyPlatformFactoryPrivate));
+/*     g_type_class_add_private (gobject_class, sizeof(ModestTnyPlatformFactoryPrivate)); */
 }
 
 static void
@@ -155,13 +164,11 @@ tny_platform_factory_init (gpointer g, gpointer iface_data)
 {
        TnyPlatformFactoryIface *klass = (TnyPlatformFactoryIface *)g;
 
-       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;
-
+       klass->new_account_store = modest_tny_platform_factory_new_account_store;
+       klass->new_device        = modest_tny_platform_factory_new_device;
+       klass->new_msg_view      = modest_tny_platform_factory_new_msg_view;
+       klass->new_msg           = modest_tny_platform_factory_new_msg;
+       klass->new_mime_part     = modest_tny_platform_factory_new_mime_part;
        return;
 }
 
@@ -190,8 +197,12 @@ modest_tny_platform_factory_new_device (TnyPlatformFactory *self)
 static TnyMsgView*
 modest_tny_platform_factory_new_msg_view (TnyPlatformFactory *self)
 {
-       /* TODO */
-       return NULL;
+       /* Here we'll select one of the implementations available */
+#ifdef MODEST_USE_MOZEMBED
+       return g_object_new (MODEST_TYPE_MOZEMBED_MSG_VIEW, NULL);
+#else
+       return g_object_new (MODEST_TYPE_GTKHTML_MSG_VIEW, NULL);
+#endif
 }
 
 static TnyMsg*
@@ -208,8 +219,3 @@ modest_tny_platform_factory_new_mime_part (TnyPlatformFactory *self)
 }
 
 
-static TnyHeader*
-modest_tny_platform_factory_new_header (TnyPlatformFactory *self)
-{
-       return tny_camel_header_new ();
-}