*/
#include "modest-singletons.h"
+#include "modest-runtime.h"
/* 'private'/'protected' functions */
static void modest_singletons_class_init (ModestSingletonsClass *klass);
ModestMailOperationQueue *mail_op_queue;
TnyPlatformFactory *platform_fact;
TnyDevice *device;
+ ModestWindowMgr *window_mgr;
};
#define MODEST_SINGLETONS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \
MODEST_TYPE_SINGLETONS, \
priv->mail_op_queue = NULL;
priv->platform_fact = NULL;
priv->device = NULL;
+ priv->window_mgr = NULL;
priv->conf = modest_conf_new ();
if (!priv->conf) {
g_printerr ("modest: cannot create modest account mgr instance\n");
return;
}
+
+ priv->platform_fact = modest_tny_platform_factory_get_instance ();
+ if (!priv->platform_fact) {
+ g_printerr ("modest: cannot create platform 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");
+ return;
+ }
- priv->account_store = modest_tny_account_store_new (priv->account_mgr);
+ priv->account_store = modest_tny_account_store_new (priv->account_mgr, priv->device);
if (!priv->account_store) {
g_printerr ("modest: cannot create modest tny account store instance\n");
return;
return;
}
- priv->platform_fact = modest_tny_platform_factory_get_instance ();
- if (!priv->platform_fact) {
- g_printerr ("modest: cannot create platform 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");
+ priv->window_mgr = modest_window_mgr_new ();
+ if (!priv->window_mgr) {
+ g_printerr ("modest: cannot create modest window manager instance\n");
return;
}
-
-
-}
-
-
-static void
-check_object_is_dead (GObject *obj, gchar *name)
-{
- if (G_IS_OBJECT(obj))
- g_warning ("BUG: %s is still alive\n", name);
}
static void
modest_singletons_finalize (GObject *obj)
{
ModestSingletonsPrivate *priv;
+
priv = MODEST_SINGLETONS_GET_PRIVATE(obj);
if (priv->account_store) {
g_object_unref (G_OBJECT(priv->account_store));
- check_object_is_dead ((GObject*)priv->account_store,
- "priv->account_store");
+ modest_runtime_verify_object_death(priv->account_store,"");
priv->account_store = NULL;
}
if (priv->account_mgr) {
g_object_unref (G_OBJECT(priv->account_mgr));
- check_object_is_dead ((GObject*)priv->account_mgr,
- "priv->account_mgr");
+ modest_runtime_verify_object_death(priv->account_mgr,"");
priv->account_mgr = NULL;
}
if (priv->conf) {
g_object_unref (G_OBJECT(priv->conf));
- check_object_is_dead ((GObject*)priv->conf,
- "priv->conf");
+ modest_runtime_verify_object_death(priv->conf,"");
priv->conf = NULL;
}
if (priv->cache_mgr) {
g_object_unref (G_OBJECT(priv->cache_mgr));
- check_object_is_dead ((GObject*)priv->cache_mgr,
- "priv->cache_mgr");
+ modest_runtime_verify_object_death(priv->cache_mgr,"");
priv->cache_mgr = NULL;
}
if (priv->device) {
g_object_unref (G_OBJECT(priv->device));
- check_object_is_dead ((GObject*)priv->cache_mgr,
- "priv->device");
+ modest_runtime_verify_object_death(priv->device,"");
priv->device = NULL;
}
if (priv->platform_fact) {
g_object_unref (G_OBJECT(priv->platform_fact));
- check_object_is_dead ((GObject*)priv->cache_mgr,
- "priv->platform_fact");
+ modest_runtime_verify_object_death(priv->platform_fact,"");
priv->platform_fact = NULL;
}
-
+ if (priv->mail_op_queue) {
+ g_object_unref (G_OBJECT(priv->mail_op_queue));
+ modest_runtime_verify_object_death(priv->mail_op_queue,"");
+ priv->mail_op_queue = NULL;
+ }
+ if (priv->window_mgr) {
+ g_object_unref (G_OBJECT(priv->window_mgr));
+ modest_runtime_verify_object_death(priv->window_mgr,"");
+ priv->window_mgr = NULL;
+ }
+
G_OBJECT_CLASS(parent_class)->finalize (obj);
}
g_return_val_if_fail (self, NULL);
return MODEST_SINGLETONS_GET_PRIVATE(self)->platform_fact;
}
+
+ModestWindowMgr*
+modest_singletons_get_window_mgr (ModestSingletons *self)
+{
+ g_return_val_if_fail (self, NULL);
+ return MODEST_SINGLETONS_GET_PRIVATE(self)->window_mgr;
+}