aboutsummaryrefslogtreecommitdiffstats
path: root/e-util
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2012-01-25 11:52:51 +0800
committerMatthew Barnes <mbarnes@redhat.com>2012-01-25 11:52:51 +0800
commitbab2f2ef127bcb3ac7a12b4790dfd4501623b521 (patch)
tree36141e590dadc451057a80bbc097b11d458068e4 /e-util
parentd75f6c636406385abb50025b4c371dec262b1c4b (diff)
downloadgsoc2013-evolution-bab2f2ef127bcb3ac7a12b4790dfd4501623b521.tar
gsoc2013-evolution-bab2f2ef127bcb3ac7a12b4790dfd4501623b521.tar.gz
gsoc2013-evolution-bab2f2ef127bcb3ac7a12b4790dfd4501623b521.tar.bz2
gsoc2013-evolution-bab2f2ef127bcb3ac7a12b4790dfd4501623b521.tar.lz
gsoc2013-evolution-bab2f2ef127bcb3ac7a12b4790dfd4501623b521.tar.xz
gsoc2013-evolution-bab2f2ef127bcb3ac7a12b4790dfd4501623b521.tar.zst
gsoc2013-evolution-bab2f2ef127bcb3ac7a12b4790dfd4501623b521.zip
Bug 668595 - Suppress bogus percentage in status messages
Diffstat (limited to 'e-util')
-rw-r--r--e-util/e-activity.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/e-util/e-activity.c b/e-util/e-activity.c
index 2c0ba6adf0..1c1655f010 100644
--- a/e-util/e-activity.c
+++ b/e-util/e-activity.c
@@ -40,6 +40,10 @@ struct _EActivityPrivate {
gchar *icon_name;
gchar *text;
gdouble percent;
+
+ /* Whether to emit a runtime warning if we
+ * have to suppress a bogus percent value. */
+ gboolean warn_bogus_percent;
};
enum {
@@ -222,6 +226,19 @@ activity_describe (EActivity *activity)
percent = e_activity_get_percent (activity);
state = e_activity_get_state (activity);
+ /* Sanity check the percentage. */
+ if (percent > 100.0) {
+ if (activity->priv->warn_bogus_percent) {
+ g_warning (
+ "Nonsensical (%d%% complete) reported on "
+ "activity \"%s\"", (gint) (percent), text);
+ activity->priv->warn_bogus_percent = FALSE;
+ }
+ percent = -1.0; /* suppress it */
+ } else {
+ activity->priv->warn_bogus_percent = TRUE;
+ }
+
if (state == E_ACTIVITY_CANCELLED) {
/* Translators: This is a cancelled activity. */
g_string_printf (string, _("%s (cancelled)"), text);
@@ -338,6 +355,8 @@ e_activity_init (EActivity *activity)
{
activity->priv = G_TYPE_INSTANCE_GET_PRIVATE (
activity, E_TYPE_ACTIVITY, EActivityPrivate);
+
+ activity->priv->warn_bogus_percent = TRUE;
}
EActivity *