ModestProgressBarWidget *me = NULL;
ObservableData *data = NULL;
ModestProgressBarWidgetPrivate *priv = NULL;
- ModestMailOperationState *state = NULL;
me = MODEST_PROGRESS_BAR_WIDGET (self);
priv = MODEST_PROGRESS_BAR_WIDGET_GET_PRIVATE (me);
data = g_malloc0 (sizeof (ObservableData));
data->mail_op = g_object_ref (mail_op);
- data->signal_handler = g_signal_connect (data->mail_op,
+ data->signal_handler = g_signal_connect (data->mail_op,
"progress-changed",
G_CALLBACK (on_progress_changed),
me);
/* Set curent operation */
if (priv->current == NULL) {
priv->current = mail_op;
-
+
priv->count = 0;
-
+
/* 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);
+ modest_progress_bar_widget_set_undetermined_progress (MODEST_PROGRESS_BAR_WIDGET(self), mail_op);
}
/* Add operation to obserbable objects list */
if (priv->current == NULL) return;
- /* If received canceled we shall show banner */
- if (modest_mail_operation_get_type_operation (priv->current) ==
- MODEST_MAIL_OPERATION_TYPE_RECEIVE)
- modest_platform_information_banner (NULL, NULL,
- _("emev_ib_ui_pop3_msg_recv_cancel"));
-
modest_mail_operation_cancel (priv->current);
}
me = MODEST_PROGRESS_BAR_WIDGET (self);
priv = MODEST_PROGRESS_BAR_WIDGET_GET_PRIVATE (me);
- /* If received canceled we shall show banner */
- if (priv->current && modest_mail_operation_get_type_operation (priv->current) ==
- MODEST_MAIL_OPERATION_TYPE_RECEIVE)
- modest_platform_information_banner (NULL, NULL,
- _("emev_ib_ui_pop3_msg_recv_cancel"));
-
/* Cancel all the mail operations */
modest_mail_operation_queue_cancel_all (modest_runtime_get_mail_operation_queue ());
}
/* If we have byte information use it */
if ((state->bytes_done != 0) && (state->bytes_total != 0))
- modest_progress_bar_widget_set_progress (self, msg,
- state->bytes_done,
+ modest_progress_bar_widget_set_progress (self, msg,
+ state->bytes_done,
state->bytes_total);
else
modest_progress_bar_widget_set_progress (self, msg,
gtk_progress_bar_set_bar_style (GTK_PROGRESS_BAR (priv->progress_bar), /* Deprecated */
GTK_PROGRESS_CONTINUOUS);
gtk_progress_bar_pulse (GTK_PROGRESS_BAR (priv->progress_bar));
- printf ("debug: %s:\n undetermined progress (%i) changed (%i/%i) : %i\n", __FUNCTION__,
- (int) priv->progress_bar,
- done,
- total,
- priv->count);
+/* printf ("debug: %s:\n undetermined progress (%i) changed (%i/%i) : %i\n", __FUNCTION__, */
+/* (int) priv->progress_bar, */
+/* done, */
+/* total, */
+/* priv->count); */
} else {
gdouble percent = 0;
if (total != 0) /* Avoid division by zero. */
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (priv->progress_bar),
percent);
- printf ("debug: %s:\n determined progress (%i) changed (%i/%i) : %i\n", __FUNCTION__,
- (int) priv->progress_bar,
- done,
- total,
- priv->count);
+/* printf ("debug: %s:\n determined progress (%i) changed (%i/%i) : %i\n", __FUNCTION__, */
+/* (int) priv->progress_bar, */
+/* done, */
+/* total, */
+/* priv->count); */
}
/* Set text */
gtk_progress_bar_set_text (GTK_PROGRESS_BAR (priv->progress_bar), message);
}
+
+void
+modest_progress_bar_widget_set_undetermined_progress (ModestProgressBarWidget *self,
+ ModestMailOperation *mail_op)
+{
+ ModestMailOperationState *state = NULL;
+
+ 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, self);
+ g_free(state);
+}