2007-05-28 Murray Cumming <murrayc@murrayc.com>
[modest] / src / widgets / modest-folder-view.c
index 1c7538e..ca54cbf 100644 (file)
@@ -693,6 +693,13 @@ filter_row (GtkTreeModel *model,
                            TNY_GTK_FOLDER_STORE_TREE_MODEL_INSTANCE_COLUMN, &instance,
                            -1);
 
+       /* Do not show if there is no instance, this could indeed
+          happen when the model is being modified while it's being
+          drawn. This could occur for example when moving folders
+          using drag&drop */
+       if (!instance)
+               return FALSE;
+
        if (type == TNY_FOLDER_TYPE_ROOT) {
                /* TNY_FOLDER_TYPE_ROOT means that the instance is an account instead of a folder. */
                if (TNY_IS_ACCOUNT (instance)) {
@@ -1156,18 +1163,19 @@ typedef struct _DndHelper {
  * and drop action
  */
 static void
-on_progress_changed (ModestMailOperation *mail_op, gpointer user_data)
+on_progress_changed (ModestMailOperation *mail_op, 
+                    ModestMailOperationState *state,
+                    gpointer user_data)
 {
        gboolean success;
        DndHelper *helper;
 
        helper = (DndHelper *) user_data;
 
-       if (!modest_mail_operation_is_finished (mail_op))
+       if (!state->finished)
                return;
 
-       if (modest_mail_operation_get_status (mail_op) == 
-           MODEST_MAIL_OPERATION_STATUS_SUCCESS) {
+       if (state->status == MODEST_MAIL_OPERATION_STATUS_SUCCESS) {
                success = TRUE;
        } else {
                success = FALSE;
@@ -1212,7 +1220,7 @@ drag_and_drop_from_header_view (GtkTreeModel *source_model,
                            &folder, -1);
 
        /* Transfer message */
-       mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_ID_RECEIVE, NULL);
+       mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_TYPE_RECEIVE, NULL);
 
        modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (),
                                         mail_op);
@@ -1273,7 +1281,7 @@ drag_and_drop_from_folder_view (GtkTreeModel     *source_model,
                            &folder, -1);
 
        /* Do the mail operation */
-       mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_ID_RECEIVE, NULL);
+       mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_TYPE_RECEIVE, NULL);
        modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), 
                                         mail_op);
        g_signal_connect (G_OBJECT (mail_op), "progress-changed",