Added all the bugs sent by the testers.
[modest] / src / maemo / modest-progress-bar-widget.c
index ed8fe67..5c8d239 100644 (file)
@@ -367,7 +367,7 @@ on_progress_changed (ModestMailOperation  *mail_op,
                }
                
                /* If we have byte information use it */
-               if ((state->bytes_done == 0) && (state->bytes_total == 0))
+               if ((state->bytes_done != 0) && (state->bytes_total != 0))
                        modest_progress_bar_widget_set_progress (self, msg, 
                                                                 state->bytes_done, 
                                                                 state->bytes_total);
@@ -407,17 +407,22 @@ modest_progress_bar_widget_set_progress (ModestProgressBarWidget *self,
        g_return_if_fail (done <= total);
        
        priv = MODEST_PROGRESS_BAR_WIDGET_GET_PRIVATE (self);
-       
-       /* Set progress */
-       if (total != 100) /* FIXME: tinymail send 1/100 when it doesn't know better.. */ {
+
+       /* Set progress. Tinymail sometimes returns us 1/100 when it
+          does not have any clue, NOTE that 1/100 could be also a
+          valid progress (we will loose it), but it will be recovered
+          once the done is greater than 1 */
+       if ((done == 0 && total == 0) || 
+           (done == 1 && total == 100)) {
+               gtk_progress_bar_pulse (GTK_PROGRESS_BAR (priv->progress_bar));
+       } else {
                gdouble percent = 0;
                if (total != 0) /* Avoid division by zero. */
                        percent = (gdouble)done/(gdouble)total;
 
                gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (priv->progress_bar),
-                                              percent);
-       }else
-               gtk_progress_bar_pulse (GTK_PROGRESS_BAR (priv->progress_bar));
+                                                      percent);
+       }
 
        /* Set text */
        gtk_progress_bar_set_text (GTK_PROGRESS_BAR (priv->progress_bar), message);