Revert "Scale: Always sync ::digits to Range::round-digits"
This reverts commit fd218fee46.
https://bugzilla.gnome.org/show_bug.cgi?id=781605
This commit is contained in:
committed by
Christoph Reiter
parent
bb39a1292c
commit
7191a048c1
@@ -269,18 +269,11 @@ gtk_scale_class_init (GtkScaleClass *class)
|
||||
G_TYPE_STRING, 1,
|
||||
G_TYPE_DOUBLE);
|
||||
|
||||
/**
|
||||
* GtkScale:digits:
|
||||
*
|
||||
* The number of decimal places to which the value is rounded when it is
|
||||
* changed. This also sets the number of digits shown in the displayed value
|
||||
* when using the default handler for the #GtkScale::format-value signal.
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_DIGITS,
|
||||
g_param_spec_int ("digits",
|
||||
P_("Digits"),
|
||||
P_("The number of decimal places to which the value is rounded"),
|
||||
P_("The number of decimal places that are displayed in the value"),
|
||||
-1,
|
||||
MAX_DIGITS,
|
||||
1,
|
||||
@@ -600,11 +593,12 @@ gtk_scale_new_with_range (GtkOrientation orientation,
|
||||
/**
|
||||
* gtk_scale_set_digits:
|
||||
* @scale: a #GtkScale
|
||||
* @digits: the number of decimal places to which the value will be rounded
|
||||
*
|
||||
* Sets the number of decimal places to which the value is rounded when it is
|
||||
* changed. This also sets the number of digits shown in the displayed value
|
||||
* when using the default handler for the #GtkScale::format-value signal.
|
||||
* @digits: the number of decimal places to display,
|
||||
* e.g. use 1 to display 1.0, 2 to display 1.00, etc
|
||||
*
|
||||
* Sets the number of decimal places that are displayed in the value.
|
||||
* Also causes the value of the adjustment to be rounded off to this
|
||||
* number of digits, so the retrieved value matches the value the user saw.
|
||||
*/
|
||||
void
|
||||
gtk_scale_set_digits (GtkScale *scale,
|
||||
@@ -621,8 +615,9 @@ gtk_scale_set_digits (GtkScale *scale,
|
||||
if (scale->digits != digits)
|
||||
{
|
||||
scale->digits = digits;
|
||||
range->round_digits = digits;
|
||||
|
||||
if (scale->draw_value)
|
||||
range->round_digits = digits;
|
||||
|
||||
_gtk_scale_clear_layout (scale);
|
||||
gtk_widget_queue_resize (GTK_WIDGET (scale));
|
||||
|
||||
@@ -634,10 +629,9 @@ gtk_scale_set_digits (GtkScale *scale,
|
||||
* gtk_scale_get_digits:
|
||||
* @scale: a #GtkScale
|
||||
*
|
||||
* Gets the number of decimal places to which the value is rounded on change.
|
||||
* This number is also used by the default #GtkScale::format-value handler.
|
||||
* Gets the number of decimal places that are displayed in the value.
|
||||
*
|
||||
* Returns: the number of decimal places
|
||||
* Returns: the number of decimal places that are displayed
|
||||
*/
|
||||
gint
|
||||
gtk_scale_get_digits (GtkScale *scale)
|
||||
@@ -666,6 +660,10 @@ gtk_scale_set_draw_value (GtkScale *scale,
|
||||
if (scale->draw_value != draw_value)
|
||||
{
|
||||
scale->draw_value = draw_value;
|
||||
if (draw_value)
|
||||
GTK_RANGE (scale)->round_digits = scale->digits;
|
||||
else
|
||||
GTK_RANGE (scale)->round_digits = -1;
|
||||
|
||||
_gtk_scale_clear_layout (scale);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user