* src/maemo/modest-progress-bar-widget.c:
[modest] / src / maemo / modest-progress-bar-widget.c
index e8ce5d8..638ab31 100644 (file)
@@ -236,15 +236,17 @@ modest_progress_bar_add_operation (ModestProgressObject *self,
                                                 G_CALLBACK (on_progress_changed),
                                                 me);
        /* Set curent operation */
-       priv->current = mail_op;
-
-       /* Call progress_change handler to initialize progress message */
-       state = g_malloc0(sizeof(ModestMailOperationState));
-       state->done = 0;
-       state->total = 0;
-       state->op_type = modest_mail_operation_get_type_operation (mail_op);;
-/*     on_progress_changed (mail_op, state, me); */
-       g_free(state);
+       if (priv->current == NULL) {
+               priv->current = mail_op;
+
+               /* Call progress_change handler to initialize progress message */
+               state = g_malloc0(sizeof(ModestMailOperationState));
+               state->done = 0;
+               state->total = 0;
+               state->op_type = modest_mail_operation_get_type_operation (mail_op);
+               on_progress_changed (mail_op, state, me);
+               g_free(state);
+       }
 
        /* Add operation to obserbable objects list */
        priv->observables = g_slist_prepend (priv->observables, data);
@@ -372,7 +374,7 @@ on_progress_changed (ModestMailOperation  *mail_op,
        if (priv->current == mail_op) {
                gchar *msg = NULL;
                
-               determined = (state->done > 0 && state->total > 0) && 
+               determined = (state->done > 0 && state->total > 1) && 
                        !(state->done == 1 && state->total == 100);
 
                switch (state->op_type) {