X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fmodest-singletons.c;h=e4159e4b6f73c0c29f32daec7d77fd0da607fb22;hb=0322239e8fd08ce70d12c09b6c2328e20e665c8c;hp=76f6ec19e6fa0341a6b2cbb180adcfbe786052b1;hpb=9f073d6025a94379ba9e17f3a5eff44bed3b9925;p=modest diff --git a/src/modest-singletons.c b/src/modest-singletons.c index 76f6ec1..e4159e4 100644 --- a/src/modest-singletons.c +++ b/src/modest-singletons.c @@ -34,7 +34,7 @@ #ifdef MODEST_TOOLKIT_HILDON2 #include "hildon2/modest-hildon2-window-mgr.h" #else -#include "widgets/modest-hildon1-window-mgr.h" +#include "gtk/modest-gtk-window-mgr.h" #endif #include @@ -55,6 +55,7 @@ struct _ModestSingletonsPrivate { ModestWindowMgr *window_mgr; ModestProtocolRegistry *protocol_registry; ModestPluginFactory *plugin_factory; + ModestToolkitFactory *toolkit_factory; TnyStreamCache *images_cache; }; #define MODEST_SINGLETONS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \ @@ -116,6 +117,7 @@ modest_singletons_init (ModestSingletons *obj) priv->window_mgr = NULL; priv->protocol_registry = NULL; priv->plugin_factory = NULL; + priv->toolkit_factory = NULL; priv->protocol_registry = modest_protocol_registry_new (); if (!priv->protocol_registry) { @@ -149,6 +151,12 @@ modest_singletons_init (ModestSingletons *obj) return; } + priv->toolkit_factory = modest_toolkit_factory_get_instance (); + if (!priv->toolkit_factory) { + g_printerr ("modest: cannot create toolkit 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"); @@ -170,7 +178,7 @@ modest_singletons_init (ModestSingletons *obj) #if MODEST_TOOLKIT_HILDON2 priv->window_mgr = modest_hildon2_window_mgr_new (); #else - priv->window_mgr = modest_hildon1_window_mgr_new (); + priv->window_mgr = modest_gtk_window_mgr_new (); #endif if (!priv->window_mgr) { g_printerr ("modest: cannot create modest window manager instance\n"); @@ -242,18 +250,18 @@ modest_singletons_finalize (GObject *obj) priv->email_clipboard = NULL; } - if (priv->plugin_factory) { - MODEST_DEBUG_VERIFY_OBJECT_LAST_REF(priv->plugin_factory,""); - g_object_unref (G_OBJECT(priv->plugin_factory)); - priv->plugin_factory = NULL; - } - if (priv->protocol_registry) { MODEST_DEBUG_VERIFY_OBJECT_LAST_REF(priv->protocol_registry,""); g_object_unref (G_OBJECT(priv->protocol_registry)); priv->protocol_registry = NULL; } + if (priv->plugin_factory) { + MODEST_DEBUG_VERIFY_OBJECT_LAST_REF(priv->plugin_factory,""); + g_object_unref (G_OBJECT(priv->plugin_factory)); + priv->plugin_factory = NULL; + } + /* It is important that the account manager is uninitialized after * the mail op queue is uninitialized because the mail op queue * cancells any mail operations which in turn access the account @@ -354,6 +362,13 @@ modest_singletons_get_platform_factory (ModestSingletons *self) return MODEST_SINGLETONS_GET_PRIVATE(self)->platform_fact; } +ModestToolkitFactory* +modest_singletons_get_toolkit_factory (ModestSingletons *self) +{ + g_return_val_if_fail (self, NULL); + return MODEST_SINGLETONS_GET_PRIVATE(self)->toolkit_factory; +} + ModestWindowMgr* modest_singletons_get_window_mgr (ModestSingletons *self) {