From 7fbe8ee3a8339cc2247a6d1dc2250bf95820c3a7 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Mon, 13 May 2019 22:19:32 -0700 Subject: [PATCH] libsysprof-ui: hook up zoom-manager to visualizers --- src/libsysprof-ui/sysprof-capture-view.c | 25 ++++++- src/libsysprof-ui/sysprof-capture-view.h | 26 ++++--- src/libsysprof-ui/ui/sysprof-capture-view.ui | 72 ++++++++++++++++++-- 3 files changed, 104 insertions(+), 19 deletions(-) diff --git a/src/libsysprof-ui/sysprof-capture-view.c b/src/libsysprof-ui/sysprof-capture-view.c index 6239086a..85d86295 100644 --- a/src/libsysprof-ui/sysprof-capture-view.c +++ b/src/libsysprof-ui/sysprof-capture-view.c @@ -26,7 +26,6 @@ #include "sysprof-capture-view.h" #include "sysprof-marks-view.h" #include "sysprof-visualizer-view.h" -#include "sysprof-zoom-manager.h" typedef struct { @@ -516,7 +515,13 @@ sysprof_capture_view_class_init (SysprofCaptureViewClass *klass) static void sysprof_capture_view_init (SysprofCaptureView *self) { + SysprofCaptureViewPrivate *priv = sysprof_capture_view_get_instance_private (self); + gtk_widget_init_template (GTK_WIDGET (self)); + + gtk_widget_insert_action_group (GTK_WIDGET (self), + "zoom", + G_ACTION_GROUP (priv->zoom_manager)); } /** @@ -585,3 +590,21 @@ sysprof_capture_view_reset (SysprofCaptureView *self) /* TODO: reset */ } + +/** + * sysprof_capture_view_get_zoom_manager: + * @self: a #SysprofCaptureView + * + * Returns: (transfer none): a #SysprofZoomManager + * + * Since: 3.34 + */ +SysprofZoomManager * +sysprof_capture_view_get_zoom_manager (SysprofCaptureView *self) +{ + SysprofCaptureViewPrivate *priv = sysprof_capture_view_get_instance_private (self); + + g_return_val_if_fail (SYSPROF_IS_CAPTURE_VIEW (self), NULL); + + return priv->zoom_manager; +} diff --git a/src/libsysprof-ui/sysprof-capture-view.h b/src/libsysprof-ui/sysprof-capture-view.h index 49c34c52..82358a4e 100644 --- a/src/libsysprof-ui/sysprof-capture-view.h +++ b/src/libsysprof-ui/sysprof-capture-view.h @@ -23,6 +23,8 @@ #include #include +#include "sysprof-zoom-manager.h" + G_BEGIN_DECLS #define SYSPROF_TYPE_CAPTURE_VIEW (sysprof_capture_view_get_type()) @@ -48,20 +50,22 @@ struct _SysprofCaptureViewClass }; SYSPROF_AVAILABLE_IN_ALL -GtkWidget *sysprof_capture_view_new (void); +GtkWidget *sysprof_capture_view_new (void); SYSPROF_AVAILABLE_IN_ALL -SysprofCaptureReader *sysprof_capture_view_get_reader (SysprofCaptureView *self); +SysprofZoomManager *sysprof_capture_view_get_zoom_manager (SysprofCaptureView *self); SYSPROF_AVAILABLE_IN_ALL -void sysprof_capture_view_load_async (SysprofCaptureView *self, - SysprofCaptureReader *reader, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); +SysprofCaptureReader *sysprof_capture_view_get_reader (SysprofCaptureView *self); SYSPROF_AVAILABLE_IN_ALL -gboolean sysprof_capture_view_load_finish (SysprofCaptureView *self, - GAsyncResult *result, - GError **error); +void sysprof_capture_view_load_async (SysprofCaptureView *self, + SysprofCaptureReader *reader, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); SYSPROF_AVAILABLE_IN_ALL -gboolean sysprof_capture_view_get_busy (SysprofCaptureView *self); +gboolean sysprof_capture_view_load_finish (SysprofCaptureView *self, + GAsyncResult *result, + GError **error); +SYSPROF_AVAILABLE_IN_ALL +gboolean sysprof_capture_view_get_busy (SysprofCaptureView *self); G_END_DECLS diff --git a/src/libsysprof-ui/ui/sysprof-capture-view.ui b/src/libsysprof-ui/ui/sysprof-capture-view.ui index 6becc13c..d2f33c8b 100644 --- a/src/libsysprof-ui/ui/sysprof-capture-view.ui +++ b/src/libsysprof-ui/ui/sysprof-capture-view.ui @@ -6,12 +6,70 @@ vertical true - - sections_stack - center + + horizontal true - 6 - 6 + + + 12 + 12 + horizontal + center + true + + + zoom.zoom-out + false + true + + + + zoom-out-symbolic + true + + + + + + + zoom.zoom-one + false + + true + + + + + + zoom.zoom-in + false + true + + + + zoom-in-symbolic + true + + + + + + + + + sections_stack + center + true + 6 + 6 + + @@ -28,6 +86,7 @@ true + zoom_manager true @@ -66,6 +125,5 @@ - - +