Commit ccd8c76f authored by Matthias Clasen's avatar Matthias Clasen

level bar: Fix offset behavior

We had some odd special-casing for the lowest and highest offset
that did not quite work. The new rule is simple: If the value
is between offset n-1 and n, it gets the style for offset n.

https://bugzilla.gnome.org/show_bug.cgi?id=761416
parent 1a71579b
......@@ -652,16 +652,18 @@ update_level_style_classes (GtkLevelBar *self)
offset = l->data;
/* find the right offset for our style class */
if ((l->prev == NULL && value <= offset->value) ||
(l->next == NULL && value >= offset->value))
if (value <= offset->value)
{
value_class = offset->name;
}
else if (l->prev != NULL)
{
prev_offset = l->prev->data;
if (prev_offset->value <= value && value < offset->value)
value_class = offset->name;
if (l->prev == NULL)
{
value_class = offset->name;
}
else
{
prev_offset = l->prev->data;
if (prev_offset->value < value)
value_class = offset->name;
}
}
if (value_class)
......
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