+}
+
+static void
+modest_header_view_set_folder_intern (ModestHeaderView *self, TnyFolder *folder)
+{
+ TnyFolderType type;
+ TnyList *headers;
+ ModestHeaderViewPrivate *priv;
+ GList *cols, *cursor;
+ GtkTreeModel *filter_model, *sortable;
+ guint sort_colid;
+ GtkSortType sort_type;
+
+ priv = MODEST_HEADER_VIEW_GET_PRIVATE(self);
+
+ headers = TNY_LIST (tny_gtk_header_list_model_new ());
+
+ /* Start the monitor in the callback of the
+ tny_gtk_header_list_model_set_folder call. It's crucial to
+ do it there and not just after the call because we want the
+ monitor to observe only the headers returned by the
+ tny_folder_get_headers_async call that it's inside the
+ tny_gtk_header_list_model_set_folder call. This way the
+ monitor infrastructure could successfully cope with
+ duplicates. For example if a tny_folder_add_msg_async is
+ happening while tny_gtk_header_list_model_set_folder is
+ invoked, then the first call could add a header that will
+ be added again by tny_gtk_header_list_model_set_folder, so
+ we'd end up with duplicate headers. sergio */
+ tny_gtk_header_list_model_set_folder (TNY_GTK_HEADER_LIST_MODEL(headers),
+ folder, FALSE,
+ set_folder_intern_get_headers_async_cb,
+ NULL, self);