libsysprof-ui: link up horizontal scrolling

This commit is contained in:
Christian Hergert
2019-05-15 18:26:42 -07:00
parent eda7b34062
commit aa2772ef87
5 changed files with 72 additions and 24 deletions

View File

@ -26,6 +26,7 @@
#include "sysprof-capture-view.h"
#include "sysprof-details-view.h"
#include "sysprof-marks-view.h"
#include "sysprof-ui-private.h"
#include "sysprof-visualizer-view.h"
typedef struct
@ -45,6 +46,7 @@ typedef struct
SysprofCaptureFeatures features;
/* Template Objects */
GtkAdjustment *time_adj;
GtkStack *stack;
SysprofCallgraphView *callgraph_view;
SysprofDetailsView *details_view;
@ -597,19 +599,6 @@ sysprof_capture_view_get_property (GObject *object,
}
}
static void
sysprof_capture_view_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
switch (prop_id)
{
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
static void
sysprof_capture_view_class_init (SysprofCaptureViewClass *klass)
{
@ -618,7 +607,6 @@ sysprof_capture_view_class_init (SysprofCaptureViewClass *klass)
object_class->finalize = sysprof_capture_view_finalize;
object_class->get_property = sysprof_capture_view_get_property;
object_class->set_property = sysprof_capture_view_set_property;
klass->load_async = sysprof_capture_view_real_load_async;
klass->load_finish = sysprof_capture_view_real_load_finish;
@ -629,6 +617,7 @@ sysprof_capture_view_class_init (SysprofCaptureViewClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, SysprofCaptureView, marks_view);
gtk_widget_class_bind_template_child_private (widget_class, SysprofCaptureView, stack);
gtk_widget_class_bind_template_child_private (widget_class, SysprofCaptureView, stack_switcher);
gtk_widget_class_bind_template_child_private (widget_class, SysprofCaptureView, time_adj);
gtk_widget_class_bind_template_child_private (widget_class, SysprofCaptureView, visualizer_view);
gtk_widget_class_bind_template_child_private (widget_class, SysprofCaptureView, zoom_manager);
@ -679,6 +668,9 @@ sysprof_capture_view_init (SysprofCaptureView *self)
gtk_widget_insert_action_group (GTK_WIDGET (self),
"capture-view",
G_ACTION_GROUP (group));
_sysprof_marks_view_set_hadjustment (priv->marks_view, priv->time_adj);
_sysprof_visualizer_view_set_hadjustment (priv->visualizer_view, priv->time_adj);
}
/**

View File

@ -32,6 +32,7 @@ typedef struct
SysprofZoomManager *zoom_manager;
/* Template objects */
GtkScrolledWindow *scroller;
GtkTreeView *tree_view;
GtkTreeViewColumn *duration_column;
SysprofCellRendererDuration *duration_cell;
@ -120,6 +121,7 @@ sysprof_marks_view_class_init (SysprofMarksViewClass *klass)
object_class->set_property = sysprof_marks_view_set_property;
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/sysprof/ui/sysprof-marks-view.ui");
gtk_widget_class_bind_template_child_private (widget_class, SysprofMarksView, scroller);
gtk_widget_class_bind_template_child_private (widget_class, SysprofMarksView, tree_view);
gtk_widget_class_bind_template_child_private (widget_class, SysprofMarksView, duration_cell);
gtk_widget_class_bind_template_child_private (widget_class, SysprofMarksView, duration_column);
@ -227,3 +229,15 @@ sysprof_marks_view_load_finish (SysprofMarksView *self,
return g_task_propagate_boolean (G_TASK (result), error);
}
void
_sysprof_marks_view_set_hadjustment (SysprofMarksView *self,
GtkAdjustment *hadjustment)
{
SysprofMarksViewPrivate *priv = sysprof_marks_view_get_instance_private (self);
g_return_if_fail (SYSPROF_IS_MARKS_VIEW (self));
g_return_if_fail (GTK_IS_ADJUSTMENT (hadjustment));
gtk_scrolled_window_set_hadjustment (priv->scroller, hadjustment);
}

View File

@ -0,0 +1,34 @@
/* sysprof-ui-private.h
*
* Copyright 2019 Christian Hergert <chergert@redhat.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#pragma once
#include "sysprof-marks-view.h"
#include "sysprof-visualizer-view.h"
G_BEGIN_DECLS
void _sysprof_marks_view_set_hadjustment (SysprofMarksView *self,
GtkAdjustment *hadjustment);
void _sysprof_visualizer_view_set_hadjustment (SysprofVisualizerView *self,
GtkAdjustment *hadjustment);
G_END_DECLS

View File

@ -748,3 +748,15 @@ sysprof_visualizer_view_get_selection (SysprofVisualizerView *self)
return priv->selection;
}
void
_sysprof_visualizer_view_set_hadjustment (SysprofVisualizerView *self,
GtkAdjustment *hadjustment)
{
SysprofVisualizerViewPrivate *priv = sysprof_visualizer_view_get_instance_private (self);
g_return_if_fail (SYSPROF_IS_VISUALIZER_VIEW (self));
g_return_if_fail (GTK_IS_ADJUSTMENT (hadjustment));
gtk_scrolled_window_set_hadjustment (priv->scroller, hadjustment);
}

View File

@ -79,11 +79,6 @@
</child>
</object>
</child>
<child>
<object class="GtkSeparator">
<property name="visible">true</property>
</object>
</child>
<child>
<object class="SysprofMultiPaned">
<property name="visible">true</property>
@ -97,11 +92,11 @@
<property name="visible">true</property>
</object>
</child>
<child>
<object class="GtkSeparator">
<property name="visible">true</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkSeparator">
<property name="visible">true</property>
</object>
</child>
<child>
@ -149,4 +144,5 @@
</child>
</template>
<object class="SysprofZoomManager" id="zoom_manager"/>
<object class="GtkAdjustment" id="time_adj"/>
</interface>