Merged the new plugin system from branch plugin-system.
[modest] / src / modest-singletons.c
index 32ada6b..28f50a1 100644 (file)
@@ -29,6 +29,7 @@
 
 #include "modest-singletons.h"
 #include "modest-runtime.h"
+#include "modest-defs.h"
 #include "modest-debug.h"
 #include <tny-fs-stream-cache.h>
 
@@ -47,7 +48,13 @@ struct _ModestSingletonsPrivate {
        TnyPlatformFactory        *platform_fact;
        TnyDevice                 *device;
        ModestWindowMgr           *window_mgr;
+<<<<<<< .working
        TnyStreamCache            *images_cache;
+=======
+       ModestProtocolRegistry    *protocol_registry;
+       ModestPluginFactory   *plugin_factory;
+       TnyStreamCache            *images_cache;
+>>>>>>> .merge-right.r5668
 };
 #define MODEST_SINGLETONS_GET_PRIVATE(o)      (G_TYPE_INSTANCE_GET_PRIVATE((o), \
                                                MODEST_TYPE_SINGLETONS, \
@@ -106,7 +113,20 @@ modest_singletons_init (ModestSingletons *obj)
        priv->platform_fact   = NULL;
        priv->device          = NULL;
        priv->window_mgr      = NULL;
+<<<<<<< .working
+       priv->images_cache    = NULL;
+=======
+       priv->protocol_registry = NULL;
+       priv->plugin_factory = NULL;
+
+       priv->protocol_registry = modest_protocol_registry_new ();
+       if (!priv->protocol_registry) {
+               g_printerr ("modest:cannot create protocol registry instance\n");
+               return;
+       }
+       modest_protocol_registry_set_to_default (priv->protocol_registry);
        priv->images_cache    = NULL;
+>>>>>>> .merge-right.r5668
        
        priv->conf           = modest_conf_new ();
        if (!priv->conf) {
@@ -155,6 +175,7 @@ modest_singletons_init (ModestSingletons *obj)
                g_printerr ("modest: cannot create modest window manager instance\n");
                return;
        }
+<<<<<<< .working
 
        images_cache_path = g_build_filename (g_get_home_dir (), MODEST_DIR, MODEST_IMAGES_CACHE_DIR, NULL);
        priv->images_cache = tny_fs_stream_cache_new (images_cache_path, MODEST_IMAGES_CACHE_SIZE);
@@ -163,6 +184,23 @@ modest_singletons_init (ModestSingletons *obj)
                g_printerr ("modest: cannot create images cache instance\n");
                return;
        }
+=======
+
+       priv->plugin_factory = modest_plugin_factory_new ();
+       if (!priv->plugin_factory) {
+               g_printerr ("modest: cannot create modest mail plugin factory instance\n");
+               return;
+       }
+
+       images_cache_path = g_build_filename (g_get_home_dir (), MODEST_DIR, MODEST_IMAGES_CACHE_DIR, NULL);
+       priv->images_cache = tny_fs_stream_cache_new (images_cache_path, MODEST_IMAGES_CACHE_SIZE);
+       g_free (images_cache_path);
+       if (!priv->images_cache) {
+               g_printerr ("modest: cannot create images cache instance\n");
+               return;
+       }
+
+>>>>>>> .merge-right.r5668
 }
 
 static void
@@ -252,7 +290,8 @@ modest_singletons_new (void)
        
        /* widget_factory will still be NULL, as it is initialized lazily */
        if (!(priv->conf && priv->account_mgr && priv->email_clipboard && 
-             priv->cache_mgr && priv->mail_op_queue && priv->device && priv->platform_fact)) {
+             priv->cache_mgr && priv->mail_op_queue && priv->device && 
+             priv->platform_fact && priv->plugin_factory)) {
                g_printerr ("modest: failed to create singletons object\n");
                g_object_unref (G_OBJECT(self));
                self = NULL;
@@ -319,6 +358,7 @@ modest_singletons_get_window_mgr (ModestSingletons *self)
        g_return_val_if_fail (self, NULL);
        return MODEST_SINGLETONS_GET_PRIVATE(self)->window_mgr;
 }
+<<<<<<< .working
 
 TnyStreamCache* 
 modest_singletons_get_images_cache (ModestSingletons *self)
@@ -326,3 +366,27 @@ modest_singletons_get_images_cache (ModestSingletons *self)
        g_return_val_if_fail (self, NULL);
        return MODEST_SINGLETONS_GET_PRIVATE(self)->images_cache;
 }
+=======
+
+ModestProtocolRegistry* 
+modest_singletons_get_protocol_registry (ModestSingletons *self)
+{
+       g_return_val_if_fail (self, NULL);
+       return MODEST_SINGLETONS_GET_PRIVATE(self)->protocol_registry;
+}
+
+TnyStreamCache* 
+modest_singletons_get_images_cache (ModestSingletons *self)
+{
+       g_return_val_if_fail (self, NULL);
+       return MODEST_SINGLETONS_GET_PRIVATE(self)->images_cache;
+}
+
+ModestPluginFactory *
+modest_singletons_get_plugin_factory (ModestSingletons *self)
+{
+       g_return_val_if_fail (self, NULL);
+
+       return MODEST_SINGLETONS_GET_PRIVATE (self)->plugin_factory;
+}
+>>>>>>> .merge-right.r5668