/* globals */
static GtkWindowClass *parent_class = NULL;
+static GtkWidget *pre_created_accounts_window = NULL;
/************************************************************************/
* after disconnecting all signals, in destroy stage */
}
-ModestWindow *
-modest_accounts_window_new (void)
+static ModestWindow *
+modest_accounts_window_new_real (void)
{
ModestAccountsWindow *self = NULL;
ModestAccountsWindowPrivate *priv = NULL;
- HildonProgram *app;
GdkPixbuf *window_icon;
GdkPixbuf *new_message_pixbuf;
- GtkWidget *action_area_box;
guint accel_key;
GdkModifierType accel_mods;
GtkAccelGroup *accel_group;
G_CALLBACK (on_queue_changed),
self);
- priv->account_view = GTK_WIDGET (modest_account_view_new (modest_runtime_get_account_mgr ()));
-
- action_area_box = hildon_tree_view_get_action_area_box (GTK_TREE_VIEW (priv->account_view));
priv->new_message_button = hildon_button_new (0, HILDON_BUTTON_ARRANGEMENT_HORIZONTAL);
hildon_button_set_title (HILDON_BUTTON (priv->new_message_button), _("mcen_ti_new_message"));
hildon_button_set_image (HILDON_BUTTON (priv->new_message_button), gtk_image_new_from_pixbuf (new_message_pixbuf));
- gtk_box_pack_start (GTK_BOX (action_area_box), priv->new_message_button, TRUE, TRUE, 0);
gtk_widget_show_all (priv->new_message_button);
- hildon_tree_view_set_action_area_visible (GTK_TREE_VIEW (priv->account_view), TRUE);
g_object_unref (new_message_pixbuf);
setup_menu (self);
- gtk_container_add (GTK_CONTAINER (priv->pannable), priv->account_view);
gtk_box_pack_start (GTK_BOX (priv->box), priv->pannable, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (box_alignment), priv->box);
gtk_container_add (GTK_CONTAINER (self), box_alignment);
gtk_widget_show (priv->box);
gtk_widget_show (box_alignment);
- connect_signals (MODEST_ACCOUNTS_WINDOW (self));
-
- /* Load previous osso state, for instance if we are being restored from
- * hibernation: */
- modest_osso_load_state ();
-
/* Get device name */
modest_maemo_utils_get_device_name ();
- app = hildon_program_get_instance ();
- hildon_program_add_window (app, HILDON_WINDOW (self));
-
/* Set window icon */
window_icon = modest_platform_get_icon (MODEST_APP_ICON, MODEST_ICON_SIZE_BIG);
if (window_icon) {
g_object_unref (window_icon);
}
+ accel_group = gtk_accel_group_new ();
+ gtk_accelerator_parse ("<Control>n", &accel_key, &accel_mods);
+ gtk_widget_add_accelerator (priv->new_message_button, "clicked", accel_group,
+ accel_key, accel_mods, 0);
+ gtk_window_add_accel_group (GTK_WINDOW (self), accel_group);
+
+ return MODEST_WINDOW(self);
+}
+
+ModestWindow *
+modest_accounts_window_new (void)
+{
+ GtkWidget *action_area_box;
+ ModestWindow *self;
+ ModestAccountsWindowPrivate *priv = NULL;
+ HildonProgram *app;
+
+ if (pre_created_accounts_window) {
+ self = MODEST_WINDOW (pre_created_accounts_window);
+ pre_created_accounts_window = NULL;
+ } else {
+ self = modest_accounts_window_new_real ();
+ }
+ priv = MODEST_ACCOUNTS_WINDOW_GET_PRIVATE(self);
+ priv->account_view = GTK_WIDGET (modest_account_view_new (modest_runtime_get_account_mgr ()));
+
+ action_area_box = hildon_tree_view_get_action_area_box (GTK_TREE_VIEW (priv->account_view));
+ gtk_box_pack_start (GTK_BOX (action_area_box), priv->new_message_button, TRUE, TRUE, 0);
+ hildon_tree_view_set_action_area_visible (GTK_TREE_VIEW (priv->account_view), TRUE);
+ gtk_container_add (GTK_CONTAINER (priv->pannable), priv->account_view);
+
+ connect_signals (MODEST_ACCOUNTS_WINDOW (self));
+
+ /* Load previous osso state, for instance if we are being restored from
+ * hibernation: */
+ modest_osso_load_state ();
+
+ app = hildon_program_get_instance ();
+ hildon_program_add_window (app, HILDON_WINDOW (self));
+
/* Dont't restore settings here,
* because it requires a gtk_widget_show(),
* and we don't want to do that until later,
g_signal_connect (G_OBJECT (self), "map-event",
G_CALLBACK (_modest_accounts_window_map_event),
G_OBJECT (self));
- update_progress_hint (self);
+ update_progress_hint (MODEST_ACCOUNTS_WINDOW (self));
- row_count_changed (self);
-
- accel_group = gtk_accel_group_new ();
- gtk_accelerator_parse ("<Control>n", &accel_key, &accel_mods);
- gtk_widget_add_accelerator (priv->new_message_button, "clicked", accel_group,
- accel_key, accel_mods, 0);
- gtk_window_add_accel_group (GTK_WINDOW (self), accel_group);
+ row_count_changed (MODEST_ACCOUNTS_WINDOW (self));
- return MODEST_WINDOW(self);
+ return self;
}
+
ModestAccountView *
modest_accounts_window_get_account_view (ModestAccountsWindow *self)
{
}
}
+void
+modest_accounts_window_pre_create (void)
+{
+ static gboolean pre_created = FALSE;
+ if (!pre_created) {
+ pre_created = TRUE;
+ pre_created_accounts_window = GTK_WIDGET (modest_accounts_window_new_real ());
+ }
+}
static ModestWindow *modest_hildon2_window_mgr_show_initial_window (ModestWindowMgr *self);
static ModestWindow *modest_hildon2_window_mgr_get_current_top (ModestWindowMgr *self);
static gboolean modest_hildon2_window_mgr_screen_is_on (ModestWindowMgr *self);
+static void modest_hildon2_window_mgr_create_caches (ModestWindowMgr *self);
static void osso_display_event_cb (osso_display_state_t state,
gpointer data);
static void on_account_removed (TnyAccountStore *acc_store,
mgr_class->show_initial_window = modest_hildon2_window_mgr_show_initial_window;
mgr_class->get_current_top = modest_hildon2_window_mgr_get_current_top;
mgr_class->screen_is_on = modest_hildon2_window_mgr_screen_is_on;
+ mgr_class->create_caches = modest_hildon2_window_mgr_create_caches;
g_type_class_add_private (gobject_class, sizeof(ModestHildon2WindowMgrPrivate));
return (priv->display_state == OSSO_DISPLAY_ON) ? TRUE : FALSE;
}
+static void
+modest_hildon2_window_mgr_create_caches (ModestWindowMgr *self)
+{
+ g_return_if_fail (MODEST_IS_HILDON2_WINDOW_MGR (self));
+
+ modest_accounts_window_pre_create ();
+
+ MODEST_WINDOW_MGR_CLASS(parent_class)->create_caches (self);
+
+}
+
static void
osso_display_event_cb (osso_display_state_t state,
gpointer data)
static ModestWindow *modest_window_mgr_show_initial_window_default (ModestWindowMgr *self);
static ModestWindow *modest_window_mgr_get_current_top_default (ModestWindowMgr *self);
static gboolean modest_window_mgr_screen_is_on_default (ModestWindowMgr *self);
+static void modest_window_mgr_create_caches_default (ModestWindowMgr *self);
static void modest_window_mgr_on_queue_changed (ModestMailOperationQueue *queue,
ModestMailOperation *mail_op,
ModestMailOperationQueueNotification type,
mgr_class->show_initial_window = modest_window_mgr_show_initial_window_default;
mgr_class->get_current_top = modest_window_mgr_get_current_top_default;
mgr_class->screen_is_on = modest_window_mgr_screen_is_on_default;
+ mgr_class->create_caches = modest_window_mgr_create_caches_default;
g_type_class_add_private (gobject_class, sizeof(ModestWindowMgrPrivate));
return FALSE;
} else {
priv->main_window = window;
- load_new_view (self);
- load_new_editor (self);
}
}
return TRUE;
}
+void
+modest_window_mgr_create_caches (ModestWindowMgr *mgr)
+{
+ MODEST_WINDOW_MGR_GET_CLASS (mgr)->create_caches (mgr);
+}
+
+static void
+modest_window_mgr_create_caches_default (ModestWindowMgr *self)
+{
+ load_new_editor (self);
+ load_new_view (self);
+}
+
static gboolean
tny_list_find (TnyList *list, GObject *item)
{
return account_ops;
}
+