+static void
+_search_account (TnyAccount *account,
+ SearchHelper *helper)
+{
+ TnyList *folders = tny_simple_list_new ();
+
+ g_debug ("%s: Searching account %s", __FUNCTION__, tny_account_get_name (account));
+
+ /* Add a "reference" to the folder total. This allows the code
+ not to finalize the helper if an account is fully refreshed
+ before we get the folders of the others */
+ helper->pending_calls++;
+
+ /* Get folders */
+ tny_folder_store_get_folders_async (TNY_FOLDER_STORE (account), folders, NULL,
+ FALSE, modest_search_account_get_folders_cb,
+ NULL, helper);
+}
+
+void
+modest_search_account (TnyAccount *account,
+ ModestSearch *search,
+ ModestSearchCallback callback,
+ gpointer user_data)
+{
+ SearchHelper *helper;
+
+ /* Create the helper */
+ helper = create_helper (callback, search, user_data);
+
+ /* Search */
+ _search_account (account, helper);
+}
+
+void
+modest_search_all_accounts (ModestSearch *search,
+ ModestSearchCallback callback,
+ gpointer user_data)