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
This commit is contained in:
Matthias Clasen
2016-02-06 16:42:25 +01:00
parent 1a71579b61
commit ccd8c76ff2

View File

@ -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)