Added _gtk_range_set_round_digits() insternal function

It's needed by gtkscale
This commit is contained in:
Javier Jardón 2010-08-13 01:50:09 +02:00
parent d38bf4825a
commit 1814ea6abd
3 changed files with 14 additions and 5 deletions

View File

@ -3997,3 +3997,10 @@ _gtk_range_get_stop_positions (GtkRange *range,
return range->layout->n_marks;
}
void
_gtk_range_set_round_digits (GtkRange *range,
gint round_digits)
{
range->round_digits = round_digits;
}

View File

@ -201,6 +201,8 @@ void _gtk_range_set_stop_values (GtkRange *range
gint n_values);
gint _gtk_range_get_stop_positions (GtkRange *range,
gint **values);
void _gtk_range_set_round_digits (GtkRange *range,
gint round_digits);
G_END_DECLS

View File

@ -408,7 +408,7 @@ gtk_scale_init (GtkScale *scale)
priv->draw_value = TRUE;
priv->value_pos = GTK_POS_TOP;
priv->digits = 1;
range->round_digits = priv->digits;
_gtk_range_set_round_digits (range, priv->digits);
gtk_scale_orientation_notify (range, NULL);
g_signal_connect (scale, "notify::orientation",
@ -575,8 +575,8 @@ gtk_scale_set_digits (GtkScale *scale,
{
priv->digits = digits;
if (priv->draw_value)
range->round_digits = digits;
_gtk_range_set_round_digits (range, digits);
_gtk_scale_clear_layout (scale);
gtk_widget_queue_resize (GTK_WIDGET (scale));
@ -624,9 +624,9 @@ gtk_scale_set_draw_value (GtkScale *scale,
{
priv->draw_value = draw_value;
if (draw_value)
GTK_RANGE (scale)->round_digits = priv->digits;
_gtk_range_set_round_digits (GTK_RANGE (scale), priv->digits);
else
GTK_RANGE (scale)->round_digits = -1;
_gtk_range_set_round_digits (GTK_RANGE (scale), -1);
_gtk_scale_clear_layout (scale);