+#if MODEST_TOOLKIT_HILDON2
+ priv->window_mgr = modest_hildon2_window_mgr_new ();
+#else
+ priv->window_mgr = modest_hildon1_window_mgr_new ();
+#endif
+ if (!priv->window_mgr) {
+ g_printerr ("modest: cannot create modest window manager 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;
+ }