[sysprof/wip/chergert/sysprof-3] libsysprof-ui: wire up display for re-recording
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof/wip/chergert/sysprof-3] libsysprof-ui: wire up display for re-recording
- Date: Fri, 24 May 2019 00:21:03 +0000 (UTC)
commit e9aaf3719c46dc6e01a2e70a272108578989b04f
Author: Christian Hergert <chergert redhat com>
Date: Thu May 23 17:20:45 2019 -0700
libsysprof-ui: wire up display for re-recording
src/libsysprof-ui/sysprof-display.c | 31 +++++++++++++++++++++++++++++--
src/libsysprof-ui/sysprof-notebook.c | 4 ++++
2 files changed, 33 insertions(+), 2 deletions(-)
---
diff --git a/src/libsysprof-ui/sysprof-display.c b/src/libsysprof-ui/sysprof-display.c
index 328d6ff..23bae02 100644
--- a/src/libsysprof-ui/sysprof-display.c
+++ b/src/libsysprof-ui/sysprof-display.c
@@ -165,7 +165,7 @@ sysprof_display_start_recording_cb (SysprofDisplay *self,
g_assert (SYSPROF_IS_DISPLAY (self));
g_assert (SYSPROF_IS_PROFILER (profiler));
- g_assert (SYSPROF_IS_PROFILER_ASSISTANT (assistant));
+ g_assert (!assistant || SYSPROF_IS_PROFILER_ASSISTANT (assistant));
g_assert (sysprof_display_is_empty (self));
if (g_set_object (&priv->profiler, profiler))
@@ -619,10 +619,37 @@ sysprof_display_get_can_replay (SysprofDisplay *self)
sysprof_capture_view_get_can_replay (priv->capture_view);
}
+/**
+ * sysprof_display_replay:
+ * @self: a #SysprofDisplay
+ *
+ * Gets a new display that will re-run the previous recording that is being
+ * viewed. This requires a capture file which contains enough information to
+ * replay the operation.
+ *
+ * Returns: (nullable) (transfer full): a #SysprofDisplay or %NULL
+ *
+ * Since: 3.34
+ */
SysprofDisplay *
sysprof_display_replay (SysprofDisplay *self)
{
+ SysprofDisplayPrivate *priv = sysprof_display_get_instance_private (self);
+ g_autoptr(SysprofProfiler) profiler = NULL;
+ SysprofCaptureReader *reader;
+ SysprofDisplay *copy;
+
g_return_val_if_fail (SYSPROF_IS_DISPLAY (self), NULL);
- return NULL;
+ reader = sysprof_capture_view_get_reader (priv->capture_view);
+ g_return_val_if_fail (reader != NULL, NULL);
+
+ profiler = sysprof_local_profiler_new_replay (reader);
+ g_return_val_if_fail (profiler != NULL, NULL);
+ g_return_val_if_fail (SYSPROF_IS_LOCAL_PROFILER (profiler), NULL);
+
+ copy = g_object_new (SYSPROF_TYPE_DISPLAY, NULL);
+ sysprof_display_start_recording_cb (copy, profiler, NULL);
+
+ return g_steal_pointer (©);
}
diff --git a/src/libsysprof-ui/sysprof-notebook.c b/src/libsysprof-ui/sysprof-notebook.c
index 038bd3c..f11e3ff 100644
--- a/src/libsysprof-ui/sysprof-notebook.c
+++ b/src/libsysprof-ui/sysprof-notebook.c
@@ -344,6 +344,7 @@ sysprof_notebook_replay (SysprofNotebook *self)
{
SysprofDisplay *display;
SysprofDisplay *replay;
+ gint page;
g_return_if_fail (SYSPROF_IS_NOTEBOOK (self));
@@ -354,5 +355,8 @@ sysprof_notebook_replay (SysprofNotebook *self)
g_return_if_fail (SYSPROF_IS_DISPLAY (replay));
+ gtk_widget_show (GTK_WIDGET (replay));
gtk_container_add (GTK_CONTAINER (self), GTK_WIDGET (replay));
+ page = gtk_notebook_page_num (GTK_NOTEBOOK (self), GTK_WIDGET (replay));
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (self), page);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]