File xfce4-panel-plugin-timeout-1.0.0-hidden_progress_bar.patch of Package xfce4-panel-plugin-timeout
# Rationale:
# Most of the time time_out_lock_countdown_update() calls
# time_out_lock_screen_set_remaining() with arguments that are incompatible
# with gtk_progress_bar (resulting fraction to be set on the progress bar
# can range from infinity through zero to a number > 1), which in turn leads
# to GTK errors on stderr every second.
#
# https://bugzilla.xfce.org/show_bug.cgi?id=7660
#
# Patch:
# Check for occurrences of such conditions and as these imply that the lock
# progress bar is hidden anyway, do not update it.
diff -Ndpru10 xfce4-time-out-plugin-1.0.0/panel-plugin/time-out-lock-screen.c xfce4-time-out-plugin-1.0.0.new/panel-plugin/time-out-lock-screen.c
--- xfce4-time-out-plugin-1.0.0/panel-plugin/time-out-lock-screen.c 2010-12-06 17:34:50.000000000 +0100
+++ xfce4-time-out-plugin-1.0.0.new/panel-plugin/time-out-lock-screen.c 2011-05-25 14:03:13.884840608 +0200
@@ -320,22 +320,25 @@ time_out_lock_screen_set_remaining (Time
/* Get long string representation of the remaining time */
time_string = time_out_countdown_seconds_to_string (seconds, lock_screen->display_seconds, lock_screen->display_hours, FALSE);
/* Add markup */
g_string_prepend (time_string, "<span size=\"x-large\">");
g_string_append (time_string, "</span>");
/* Update widgets */
gtk_label_set_markup (GTK_LABEL (lock_screen->time_label), time_string->str);
- gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (lock_screen->progress),
- ((gdouble)seconds) / ((gdouble)lock_screen->max_seconds));
+ if ((0 < lock_screen->max_seconds) && (0 <= seconds) && (seconds <= lock_screen->max_seconds))
+ {
+ gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (lock_screen->progress),
+ ((gdouble)seconds) / ((gdouble)lock_screen->max_seconds));
+ }
/* Free time string */
g_string_free (time_string, TRUE);
}
void
time_out_lock_screen_set_allow_postpone (TimeOutLockScreen *lock_screen,
gboolean allow_postpone)