X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=src%2Fmodest-singletons.c;h=e4159e4b6f73c0c29f32daec7d77fd0da607fb22;hb=f32c12901d7c629a6c44b42415b001d198b0e7ce;hp=28f50a111cd6eb18912d2e9447e7b57703a1f41e;hpb=627c4af6ac85444cc3256fa568baf4a8d62178ae;p=modest diff --git a/src/modest-singletons.c b/src/modest-singletons.c index 28f50a1..e4159e4 100644 --- a/src/modest-singletons.c +++ b/src/modest-singletons.c @@ -31,6 +31,11 @@ #include "modest-runtime.h" #include "modest-defs.h" #include "modest-debug.h" +#ifdef MODEST_TOOLKIT_HILDON2 +#include "hildon2/modest-hildon2-window-mgr.h" +#else +#include "gtk/modest-gtk-window-mgr.h" +#endif #include /* 'private'/'protected' functions */ @@ -48,13 +53,10 @@ struct _ModestSingletonsPrivate { TnyPlatformFactory *platform_fact; TnyDevice *device; ModestWindowMgr *window_mgr; -<<<<<<< .working - TnyStreamCache *images_cache; -======= ModestProtocolRegistry *protocol_registry; ModestPluginFactory *plugin_factory; + ModestToolkitFactory *toolkit_factory; TnyStreamCache *images_cache; ->>>>>>> .merge-right.r5668 }; #define MODEST_SINGLETONS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \ MODEST_TYPE_SINGLETONS, \ @@ -113,11 +115,9 @@ 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->toolkit_factory = NULL; priv->protocol_registry = modest_protocol_registry_new (); if (!priv->protocol_registry) { @@ -126,7 +126,6 @@ modest_singletons_init (ModestSingletons *obj) } modest_protocol_registry_set_to_default (priv->protocol_registry); priv->images_cache = NULL; ->>>>>>> .merge-right.r5668 priv->conf = modest_conf_new (); if (!priv->conf) { @@ -152,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,21 +175,15 @@ modest_singletons_init (ModestSingletons *obj) return; } - priv->window_mgr = modest_window_mgr_new (); +#if MODEST_TOOLKIT_HILDON2 + priv->window_mgr = modest_hildon2_window_mgr_new (); +#else + priv->window_mgr = modest_gtk_window_mgr_new (); +#endif if (!priv->window_mgr) { 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); - g_free (images_cache_path); - if (!priv->images_cache) { - g_printerr ("modest: cannot create images cache instance\n"); - return; - } -======= priv->plugin_factory = modest_plugin_factory_new (); if (!priv->plugin_factory) { @@ -200,7 +199,6 @@ modest_singletons_init (ModestSingletons *obj) return; } ->>>>>>> .merge-right.r5668 } static void @@ -252,6 +250,18 @@ modest_singletons_finalize (GObject *obj) priv->email_clipboard = 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 @@ -352,21 +362,19 @@ modest_singletons_get_platform_factory (ModestSingletons *self) return MODEST_SINGLETONS_GET_PRIVATE(self)->platform_fact; } -ModestWindowMgr* -modest_singletons_get_window_mgr (ModestSingletons *self) +ModestToolkitFactory* +modest_singletons_get_toolkit_factory (ModestSingletons *self) { g_return_val_if_fail (self, NULL); - return MODEST_SINGLETONS_GET_PRIVATE(self)->window_mgr; + return MODEST_SINGLETONS_GET_PRIVATE(self)->toolkit_factory; } -<<<<<<< .working -TnyStreamCache* -modest_singletons_get_images_cache (ModestSingletons *self) +ModestWindowMgr* +modest_singletons_get_window_mgr (ModestSingletons *self) { g_return_val_if_fail (self, NULL); - return MODEST_SINGLETONS_GET_PRIVATE(self)->images_cache; + return MODEST_SINGLETONS_GET_PRIVATE(self)->window_mgr; } -======= ModestProtocolRegistry* modest_singletons_get_protocol_registry (ModestSingletons *self) @@ -389,4 +397,3 @@ modest_singletons_get_plugin_factory (ModestSingletons *self) return MODEST_SINGLETONS_GET_PRIVATE (self)->plugin_factory; } ->>>>>>> .merge-right.r5668