+
+ return result;
+}
+
+GtkWidget *
+modest_window_mgr_get_msg_view_window (ModestWindowMgr *self)
+{
+ GtkWidget *result;
+ ModestWindowMgrPrivate *priv;
+
+ g_return_val_if_fail (self && MODEST_IS_WINDOW_MGR(self), NULL);
+
+ priv = MODEST_WINDOW_MGR_GET_PRIVATE(self);
+
+ if (priv->cached_view) {
+ result = priv->cached_view;
+ priv->cached_view = NULL;
+ load_new_view (self);
+ } else {
+ result = g_object_new (MODEST_TYPE_MSG_VIEW_WINDOW, NULL);
+ }
+
+ return result;
+}
+
+void
+modest_window_mgr_register_banner (ModestWindowMgr *self)
+{
+ ModestWindowMgrPrivate *priv;
+
+ g_return_if_fail (MODEST_IS_WINDOW_MGR (self));
+ priv = MODEST_WINDOW_MGR_GET_PRIVATE (self);
+
+ priv->banner_counter++;
+}
+
+void
+modest_window_mgr_unregister_banner (ModestWindowMgr *self)
+{
+ ModestWindowMgrPrivate *priv;
+
+ g_return_if_fail (MODEST_IS_WINDOW_MGR (self));
+ priv = MODEST_WINDOW_MGR_GET_PRIVATE (self);
+
+ priv->banner_counter--;
+ if (modest_window_mgr_get_num_windows (self) == 0)
+ g_signal_emit (self, signals[WINDOW_LIST_EMPTY_SIGNAL], 0);
+}
+
+ModestWindow *
+modest_window_mgr_show_initial_window (ModestWindowMgr *self)
+{
+ ModestWindow *window = NULL;
+
+ /* Call the children */
+ window = MODEST_WINDOW_MGR_GET_CLASS (self)->show_initial_window (self);
+
+ if (window) {
+ ModestAccountMgr *mgr;
+
+ /* Show the initial window */
+ gtk_widget_show (GTK_WIDGET (window));
+
+ /* If there are no accounts then show the account wizard */
+ mgr = modest_runtime_get_account_mgr();
+ if (!modest_account_mgr_has_accounts (mgr, TRUE))
+ modest_ui_actions_run_account_setup_wizard (window);
+ }
+
+ return window;
+}
+
+static ModestWindow *
+modest_window_mgr_show_initial_window_default (ModestWindowMgr *self)
+{
+ /* By default it returns the main window creating it if
+ needed */
+ return modest_window_mgr_get_main_window (self, TRUE);