-/*****************/
-
-static void
-recurse_folders (TnyFolderStore *store, TnyFolderStoreQuery *query, TnyList *all_folders)
-{
- TnyIterator *iter;
- TnyList *folders = tny_simple_list_new ();
-
- tny_folder_store_get_folders (store, folders, query, NULL);
- iter = tny_list_create_iterator (folders);
-
- while (!tny_iterator_is_done (iter)) {
-
- TnyFolderStore *folder = (TnyFolderStore*) tny_iterator_get_current (iter);
- if (folder) {
- tny_list_prepend (all_folders, G_OBJECT (folder));
- recurse_folders (folder, query, all_folders);
- g_object_unref (G_OBJECT (folder));
- }
-
- tny_iterator_next (iter);
- }
- g_object_unref (G_OBJECT (iter));
- g_object_unref (G_OBJECT (folders));
-}
-
-/*
- * Issues the "progress-changed" signal. The timer won't be removed,
- * so you must call g_source_remove to stop the signal emission
- */
-static gboolean
-idle_notify_progress (gpointer data)
-{
- ModestMailOperation *mail_op = MODEST_MAIL_OPERATION (data);
- ModestMailOperationState *state;
-
- state = modest_mail_operation_clone_state (mail_op);
-
- /* This is a GDK lock because we are an idle callback and
- * the handlers of this signal can contain Gtk+ code */
-
- gdk_threads_enter (); /* CHECKED */
- g_signal_emit (G_OBJECT (mail_op), signals[PROGRESS_CHANGED_SIGNAL], 0, state, NULL);
- gdk_threads_leave (); /* CHECKED */
-
- g_slice_free (ModestMailOperationState, state);
-
- return TRUE;
-}
-
-/*
- * Issues the "progress-changed" signal and removes the timer. It uses
- * a lock to ensure that the progress information of the mail
- * operation is not modified while there are notifications pending
- */
-static gboolean
-idle_notify_progress_once (gpointer data)
-{
- ModestPair *pair;
-
- pair = (ModestPair *) data;
-
- /* This is a GDK lock because we are an idle callback and
- * the handlers of this signal can contain Gtk+ code */
-
- gdk_threads_enter (); /* CHECKED */
- g_signal_emit (G_OBJECT (pair->first), signals[PROGRESS_CHANGED_SIGNAL], 0, pair->second, NULL);
- gdk_threads_leave (); /* CHECKED */
-
- /* Free the state and the reference to the mail operation */
- g_slice_free (ModestMailOperationState, (ModestMailOperationState*)pair->second);
- g_object_unref (pair->first);
-
- return FALSE;
-}
-
-/*
- * Used to notify the queue from the main
- * loop. We call it inside an idle call to achieve that
- */
-static gboolean
-idle_notify_queue (gpointer data)
-{
- ModestMailOperation *mail_op = MODEST_MAIL_OPERATION (data);
-
- gdk_threads_enter ();
- modest_mail_operation_notify_end (mail_op);
- gdk_threads_leave ();
- g_object_unref (mail_op);
-
- return FALSE;
-}
-
-static int
-compare_headers_by_date (gconstpointer a,
- gconstpointer b)
-{
- TnyHeader **header1, **header2;
- time_t sent1, sent2;
-
- header1 = (TnyHeader **) a;
- header2 = (TnyHeader **) b;
-
- sent1 = tny_header_get_date_sent (*header1);
- sent2 = tny_header_get_date_sent (*header2);
-
- /* We want the most recent ones (greater time_t) at the
- beginning */
- if (sent1 < sent2)
- return 1;
- else
- return -1;
-}
-
-static gboolean
-set_last_updated_idle (gpointer data)