modest_main_window_set_contents_style (win,
MODEST_MAIN_WINDOW_CONTENTS_STYLE_EMPTY);
} else {
- modest_main_window_set_contents_style (win,
- MODEST_MAIN_WINDOW_CONTENTS_STYLE_HEADERS);
-
- /* Restore configuration */
+ /* Restore configuration. There is no need to set the
+ contents style to headers because it was already
+ being done in folder_selection_changed */
modest_widget_memory_restore (modest_runtime_get_conf (),
G_OBJECT(header_view),
MODEST_CONF_HEADER_VIEW_KEY);
g_object_unref (account);
}
- if (tny_folder_get_all_count (TNY_FOLDER(folder_store)) == 0)
- modest_main_window_set_contents_style (main_window, MODEST_MAIN_WINDOW_CONTENTS_STYLE_EMPTY);
- else
- modest_main_window_set_contents_style (main_window, MODEST_MAIN_WINDOW_CONTENTS_STYLE_HEADERS);
-
+ /* Set the header view, we could change it to
+ the empty view after the refresh */
+ modest_main_window_set_contents_style (main_window,
+ MODEST_MAIN_WINDOW_CONTENTS_STYLE_HEADERS);
modest_widget_memory_save (modest_runtime_get_conf(),
G_OBJECT(header_view),
MODEST_CONF_HEADER_VIEW_KEY);
- /* Set folder on header view */
+
+ /* Set folder on header view. This function
+ will call tny_folder_refresh_async so we
+ pass a callback that will be called when
+ finished. We use that callback to set the
+ empty view if there are no messages */
modest_header_view_set_folder (MODEST_HEADER_VIEW(header_view),
TNY_FOLDER (folder_store),
folder_refreshed_cb,
main_window);
- modest_widget_memory_restore (modest_runtime_get_conf(),
- G_OBJECT(header_view),
- MODEST_CONF_HEADER_VIEW_KEY);
} else {
/* Update the active account */
modest_window_set_active_account (MODEST_WINDOW (main_window), NULL);