libsysprof-ui: hook up zoom-manager to visualizers

This commit is contained in:
Christian Hergert
2019-05-13 22:19:32 -07:00
parent 0b4510c027
commit 7fbe8ee3a8
3 changed files with 104 additions and 19 deletions

View File

@ -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;
}

View File

@ -23,6 +23,8 @@
#include <gtk/gtk.h>
#include <sysprof-capture.h>
#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

View File

@ -6,12 +6,70 @@
<property name="orientation">vertical</property>
<property name="visible">true</property>
<child>
<object class="GtkStackSwitcher">
<property name="stack">sections_stack</property>
<property name="halign">center</property>
<object class="GtkBox">
<property name="orientation">horizontal</property>
<property name="visible">true</property>
<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
<child>
<object class="GtkBox">
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<property name="orientation">horizontal</property>
<property name="valign">center</property>
<property name="visible">true</property>
<child>
<object class="GtkButton">
<property name="action-name">zoom.zoom-out</property>
<property name="focus-on-click">false</property>
<property name="visible">true</property>
<style>
<class name="flat"/>
</style>
<child>
<object class="GtkImage">
<property name="icon-name">zoom-out-symbolic</property>
<property name="visible">true</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkButton">
<property name="action-name">zoom.zoom-one</property>
<property name="focus-on-click">false</property>
<property name="label" bind-source="zoom_manager" bind-property="zoom-label" bind-flags="sync-create"/>
<property name="visible">true</property>
<style>
<class name="flat"/>
</style>
</object>
</child>
<child>
<object class="GtkButton">
<property name="action-name">zoom.zoom-in</property>
<property name="focus-on-click">false</property>
<property name="visible">true</property>
<style>
<class name="flat"/>
</style>
<child>
<object class="GtkImage">
<property name="icon-name">zoom-in-symbolic</property>
<property name="visible">true</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child type="center">
<object class="GtkStackSwitcher">
<property name="stack">sections_stack</property>
<property name="halign">center</property>
<property name="visible">true</property>
<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
</object>
</child>
</object>
</child>
<child>
@ -28,6 +86,7 @@
<property name="visible">true</property>
<child>
<object class="SysprofVisualizerView" id="visualizer_view">
<property name="zoom-manager">zoom_manager</property>
<property name="visible">true</property>
</object>
</child>
@ -66,6 +125,5 @@
</object>
</child>
</template>
<object class="SysprofZoomManager" id="zoom_manager">
</object>
<object class="SysprofZoomManager" id="zoom_manager"/>
</interface>