Commit f0d016ef authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen

Replace a really gross way of rounding to a specified number of digits.

2004-10-06  Matthias Clasen  <mclasen@redhat.com>

	* gtk/gtkrange.c (gtk_range_real_change_value): Replace a really
	gross way of rounding to a specified number of digits.  (#145232,
	Peter Zelezny, patch by Soeren Sandmann)
parent 73e7b083
2004-10-06 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkrange.c (gtk_range_real_change_value): Replace a really
gross way of rounding to a specified number of digits. (#145232,
Peter Zelezny, patch by Soeren Sandmann)
Wed Oct 6 00:45:04 2004 <timj@birnet.org>
* gdk/gdkwindow.c (gdk_window_is_viewable): check the iteration window
......
2004-10-06 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkrange.c (gtk_range_real_change_value): Replace a really
gross way of rounding to a specified number of digits. (#145232,
Peter Zelezny, patch by Soeren Sandmann)
Wed Oct 6 00:45:04 2004 <timj@birnet.org>
* gdk/gdkwindow.c (gdk_window_is_viewable): check the iteration window
......
2004-10-06 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkrange.c (gtk_range_real_change_value): Replace a really
gross way of rounding to a specified number of digits. (#145232,
Peter Zelezny, patch by Soeren Sandmann)
Wed Oct 6 00:45:04 2004 <timj@birnet.org>
* gdk/gdkwindow.c (gdk_window_is_viewable): check the iteration window
......
2004-10-06 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkrange.c (gtk_range_real_change_value): Replace a really
gross way of rounding to a specified number of digits. (#145232,
Peter Zelezny, patch by Soeren Sandmann)
Wed Oct 6 00:45:04 2004 <timj@birnet.org>
* gdk/gdkwindow.c (gdk_window_is_viewable): check the iteration window
......
......@@ -2390,12 +2390,15 @@ gtk_range_real_change_value (GtkRange *range,
if (range->round_digits >= 0)
{
char buffer[128];
glong power;
gint i;
/* This is just so darn lame. */
g_snprintf (buffer, 128, "%0.*f",
range->round_digits, value);
sscanf (buffer, "%lf", &value);
i = range->round_digits;
power = 1;
while (i--)
power *= 10;
value = floor ((value * power) + 0.5) / power;
}
if (range->adjustment->value != value)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment