[gnome-usage] Graph-Stack-Switcher: Set correct button active on scroll
- From: Petr Štětka <pstetka src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-usage] Graph-Stack-Switcher: Set correct button active on scroll
- Date: Mon, 25 Mar 2019 10:52:01 +0000 (UTC)
commit a946602121d83264fb54af483da16598584da1bd
Author: Yash Yadav <yashdimpu gmail com>
Date: Mon Mar 18 19:37:12 2019 +0530
Graph-Stack-Switcher: Set correct button active on scroll
Presently a page scroll can only update between the top two buttons as active in the switcher. Which gets
ineffectual with addition of more sub_views. This fix opens gate to add more relevant sub_views
(Disks/Network/GPU under performance).
src/graph-stack-switcher.vala | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/graph-stack-switcher.vala b/src/graph-stack-switcher.vala
index 5319918..d0ced06 100644
--- a/src/graph-stack-switcher.vala
+++ b/src/graph-stack-switcher.vala
@@ -82,8 +82,14 @@ namespace Usage
{
Gtk.Allocation alloc;
- this.sub_views[1].get_allocation(out alloc);
- var button_number = (y < alloc.y) ? 0 : 1;
+ var button_number = 0;
+ for(int i = 1; i < buttons.length; i++)
+ {
+ this.sub_views[i].get_allocation(out alloc);
+ if(y < alloc.y)
+ break;
+ button_number = i;
+ }
buttons[button_number].set_active(true);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]