[gtk+] level bar: Fix offset behavior
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] level bar: Fix offset behavior
- Date: Sat, 6 Feb 2016 15:44:16 +0000 (UTC)
commit ccd8c76ff2d73215e0785db8568ec500ed7a238d
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Feb 6 16:42:25 2016 +0100
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
gtk/gtklevelbar.c | 20 +++++++++++---------
1 files changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtklevelbar.c b/gtk/gtklevelbar.c
index 6cffd98..aed5920 100644
--- a/gtk/gtklevelbar.c
+++ b/gtk/gtklevelbar.c
@@ -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)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]