2007-04-20 Murray Cumming <murrayc@murrayc.com>
[modest] / src / modest-singletons.c
index 396a4b3..11fb9e0 100644 (file)
@@ -44,6 +44,7 @@ struct _ModestSingletonsPrivate {
        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, \
@@ -100,6 +101,7 @@ modest_singletons_init (ModestSingletons *obj)
        priv->mail_op_queue  = NULL;
        priv->platform_fact  = NULL;
        priv->device         = NULL;
+       priv->window_mgr     = NULL;
        
        priv->conf           = modest_conf_new ();
        if (!priv->conf) {
@@ -141,7 +143,13 @@ modest_singletons_init (ModestSingletons *obj)
        if (!priv->mail_op_queue) {
                g_printerr ("modest: cannot create modest mail operation queue instance\n");
                return;
-       }       
+       }
+
+       priv->window_mgr = modest_window_mgr_new ();
+       if (!priv->window_mgr) {
+               g_printerr ("modest: cannot create modest window manager instance\n");
+               return;
+       }
 }
 
 static void
@@ -187,8 +195,18 @@ modest_singletons_finalize (GObject *obj)
                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);
 }
 
@@ -265,3 +283,10 @@ modest_singletons_get_platform_factory (ModestSingletons *self)
        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;
+}