[sysprof/wip/visualizers] visualizer-view: dynamically toggle scrollbar visibility
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof/wip/visualizers] visualizer-view: dynamically toggle scrollbar visibility
- Date: Fri, 30 Sep 2016 00:50:50 +0000 (UTC)
commit 75332678a6d4954f6f14ff8e3d8e0b678d369a21
Author: Christian Hergert <chergert redhat com>
Date: Thu Sep 29 17:49:53 2016 -0700
visualizer-view: dynamically toggle scrollbar visibility
Generally we want this thing hidden, so only show it if we have
zoomed in enough to cause it to be useful.
We need to also find a way for the container to be able to
handle the change in size request and adjust the GtkPaned
to be non-ugly.
lib/sp-visualizer-view.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/lib/sp-visualizer-view.c b/lib/sp-visualizer-view.c
index cb046db..26df366 100644
--- a/lib/sp-visualizer-view.c
+++ b/lib/sp-visualizer-view.c
@@ -33,6 +33,7 @@ typedef struct
SpVisualizerList *list;
GtkAdjustment *scroll_adjustment;
+ GtkScrollbar *scrollbar;
SpVisualizerTicks *ticks;
} SpVisualizerViewPrivate;
@@ -142,6 +143,17 @@ sp_visualizer_view_notify_zoom (SpVisualizerView *self,
sp_visualizer_view_set_time_range (self, begin_time, end_time);
gtk_adjustment_set_page_size (priv->scroll_adjustment, end_time - begin_time);
+
+ if (priv->reader != NULL)
+ {
+ gint64 real_range;
+ gboolean visible;
+
+ real_range = sp_capture_reader_get_end_time (priv->reader)
+ - sp_capture_reader_get_start_time (priv->reader);
+ visible = (gtk_adjustment_get_page_size (priv->scroll_adjustment) < real_range);
+ gtk_widget_set_visible (GTK_WIDGET (priv->scrollbar), visible);
+ }
}
static void
@@ -247,6 +259,7 @@ sp_visualizer_view_class_init (SpVisualizerViewClass *klass)
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/sysprof/ui/sp-visualizer-view.ui");
gtk_widget_class_bind_template_child_private (widget_class, SpVisualizerView, list);
gtk_widget_class_bind_template_child_private (widget_class, SpVisualizerView, scroll_adjustment);
+ gtk_widget_class_bind_template_child_private (widget_class, SpVisualizerView, scrollbar);
gtk_widget_class_bind_template_child_private (widget_class, SpVisualizerView, ticks);
gtk_widget_class_set_css_name (widget_class, "visualizers");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]