mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-12 16:10:54 +00:00
replay: add stubs and plumbing to implement a re-record
The goal here is to be able to do a duplicate recording to the previous with a quick key-combination like Ctrl+R. We still need to extract the metadata from the capture file and setup a new profiler, but this gets the mechanics in place.
This commit is contained in:
@ -41,6 +41,7 @@ typedef struct
|
|||||||
guint has_samples : 1;
|
guint has_samples : 1;
|
||||||
guint has_counters : 1;
|
guint has_counters : 1;
|
||||||
guint has_marks : 1;
|
guint has_marks : 1;
|
||||||
|
guint can_replay : 1;
|
||||||
} SysprofCaptureFeatures;
|
} SysprofCaptureFeatures;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@ -64,6 +65,7 @@ typedef struct
|
|||||||
|
|
||||||
guint busy;
|
guint busy;
|
||||||
|
|
||||||
|
guint can_replay : 1;
|
||||||
guint needs_fit : 1;
|
guint needs_fit : 1;
|
||||||
} SysprofCaptureViewPrivate;
|
} SysprofCaptureViewPrivate;
|
||||||
|
|
||||||
@ -318,7 +320,17 @@ sysprof_capture_view_scan_worker (GTask *task,
|
|||||||
|
|
||||||
st_buf.frame_count[frame.type]++;
|
st_buf.frame_count[frame.type]++;
|
||||||
|
|
||||||
if (frame.type == SYSPROF_CAPTURE_FRAME_MARK)
|
if (frame.type == SYSPROF_CAPTURE_FRAME_METADATA)
|
||||||
|
{
|
||||||
|
const SysprofCaptureMetadata *meta;
|
||||||
|
|
||||||
|
if ((meta = sysprof_capture_reader_read_metadata (reader)))
|
||||||
|
{
|
||||||
|
if (g_strcmp0 (meta->id, "local-profiler") == 0)
|
||||||
|
features.can_replay = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (frame.type == SYSPROF_CAPTURE_FRAME_MARK)
|
||||||
{
|
{
|
||||||
const SysprofCaptureMark *mark;
|
const SysprofCaptureMark *mark;
|
||||||
|
|
||||||
@ -997,3 +1009,13 @@ sysprof_capture_view_get_reader (SysprofCaptureView *self)
|
|||||||
|
|
||||||
return priv->reader;
|
return priv->reader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
sysprof_capture_view_get_can_replay (SysprofCaptureView *self)
|
||||||
|
{
|
||||||
|
SysprofCaptureViewPrivate *priv = sysprof_capture_view_get_instance_private (self);
|
||||||
|
|
||||||
|
g_return_val_if_fail (SYSPROF_IS_CAPTURE_VIEW (self), FALSE);
|
||||||
|
|
||||||
|
return priv->features.can_replay;
|
||||||
|
}
|
||||||
|
|||||||
@ -69,5 +69,7 @@ SYSPROF_AVAILABLE_IN_ALL
|
|||||||
gboolean sysprof_capture_view_get_busy (SysprofCaptureView *self);
|
gboolean sysprof_capture_view_get_busy (SysprofCaptureView *self);
|
||||||
SYSPROF_AVAILABLE_IN_ALL
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
void sysprof_capture_view_fit_to_width (SysprofCaptureView *self);
|
void sysprof_capture_view_fit_to_width (SysprofCaptureView *self);
|
||||||
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
|
gboolean sysprof_capture_view_get_can_replay (SysprofCaptureView *self);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|||||||
@ -53,6 +53,7 @@ G_DEFINE_TYPE_WITH_PRIVATE (SysprofDisplay, sysprof_display, GTK_TYPE_BIN)
|
|||||||
|
|
||||||
enum {
|
enum {
|
||||||
PROP_0,
|
PROP_0,
|
||||||
|
PROP_CAN_REPLAY,
|
||||||
PROP_CAN_SAVE,
|
PROP_CAN_SAVE,
|
||||||
PROP_RECORDING,
|
PROP_RECORDING,
|
||||||
PROP_TITLE,
|
PROP_TITLE,
|
||||||
@ -91,6 +92,7 @@ sysprof_display_load_cb (SysprofCaptureView *view,
|
|||||||
if (!sysprof_capture_view_load_finish (view, result, &error))
|
if (!sysprof_capture_view_load_finish (view, result, &error))
|
||||||
g_warning ("Failed to load capture: %s", error->message);
|
g_warning ("Failed to load capture: %s", error->message);
|
||||||
|
|
||||||
|
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_CAN_REPLAY]);
|
||||||
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_CAN_SAVE]);
|
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_CAN_SAVE]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,6 +150,7 @@ sysprof_display_profiler_stopped_cb (SysprofDisplay *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
notify:
|
notify:
|
||||||
|
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_CAN_REPLAY]);
|
||||||
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_CAN_SAVE]);
|
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_CAN_SAVE]);
|
||||||
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_RECORDING]);
|
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_RECORDING]);
|
||||||
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_TITLE]);
|
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_TITLE]);
|
||||||
@ -297,6 +300,10 @@ sysprof_display_get_property (GObject *object,
|
|||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
|
case PROP_CAN_REPLAY:
|
||||||
|
g_value_set_boolean (value, sysprof_display_get_can_replay (self));
|
||||||
|
break;
|
||||||
|
|
||||||
case PROP_CAN_SAVE:
|
case PROP_CAN_SAVE:
|
||||||
g_value_set_boolean (value, sysprof_display_get_can_save (self));
|
g_value_set_boolean (value, sysprof_display_get_can_save (self));
|
||||||
break;
|
break;
|
||||||
@ -325,6 +332,13 @@ sysprof_display_class_init (SysprofDisplayClass *klass)
|
|||||||
|
|
||||||
widget_class->parent_set = sysprof_display_parent_set;
|
widget_class->parent_set = sysprof_display_parent_set;
|
||||||
|
|
||||||
|
properties [PROP_CAN_REPLAY] =
|
||||||
|
g_param_spec_boolean ("can-replay",
|
||||||
|
"Can Replay",
|
||||||
|
"If the capture contains enough information to re-run the recording",
|
||||||
|
FALSE,
|
||||||
|
(G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
properties [PROP_CAN_SAVE] =
|
properties [PROP_CAN_SAVE] =
|
||||||
g_param_spec_boolean ("can-save",
|
g_param_spec_boolean ("can-save",
|
||||||
"Can Save",
|
"Can Save",
|
||||||
@ -593,3 +607,22 @@ _sysprof_display_focus_record (SysprofDisplay *self)
|
|||||||
|
|
||||||
_sysprof_profiler_assistant_focus_record (priv->assistant);
|
_sysprof_profiler_assistant_focus_record (priv->assistant);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
sysprof_display_get_can_replay (SysprofDisplay *self)
|
||||||
|
{
|
||||||
|
SysprofDisplayPrivate *priv = sysprof_display_get_instance_private (self);
|
||||||
|
|
||||||
|
g_return_val_if_fail (SYSPROF_IS_DISPLAY (self), FALSE);
|
||||||
|
|
||||||
|
return !sysprof_display_is_empty (self) &&
|
||||||
|
sysprof_capture_view_get_can_replay (priv->capture_view);
|
||||||
|
}
|
||||||
|
|
||||||
|
SysprofDisplay *
|
||||||
|
sysprof_display_replay (SysprofDisplay *self)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (SYSPROF_IS_DISPLAY (self), NULL);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|||||||
@ -57,5 +57,9 @@ SYSPROF_AVAILABLE_IN_ALL
|
|||||||
gboolean sysprof_display_get_can_save (SysprofDisplay *self);
|
gboolean sysprof_display_get_can_save (SysprofDisplay *self);
|
||||||
SYSPROF_AVAILABLE_IN_ALL
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
void sysprof_display_stop_recording (SysprofDisplay *self);
|
void sysprof_display_stop_recording (SysprofDisplay *self);
|
||||||
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
|
gboolean sysprof_display_get_can_replay (SysprofDisplay *self);
|
||||||
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
|
SysprofDisplay *sysprof_display_replay (SysprofDisplay *self);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|||||||
@ -31,6 +31,7 @@ G_DEFINE_TYPE (SysprofNotebook, sysprof_notebook, GTK_TYPE_NOTEBOOK)
|
|||||||
|
|
||||||
enum {
|
enum {
|
||||||
PROP_0,
|
PROP_0,
|
||||||
|
PROP_CAN_REPLAY,
|
||||||
PROP_CAN_SAVE,
|
PROP_CAN_SAVE,
|
||||||
PROP_CURRENT,
|
PROP_CURRENT,
|
||||||
N_PROPS
|
N_PROPS
|
||||||
@ -64,6 +65,17 @@ sysprof_notebook_notify_can_save_cb (SysprofNotebook *self,
|
|||||||
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_CAN_SAVE]);
|
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_CAN_SAVE]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
sysprof_notebook_notify_can_replay_cb (SysprofNotebook *self,
|
||||||
|
GParamSpec *pspec,
|
||||||
|
SysprofDisplay *display)
|
||||||
|
{
|
||||||
|
g_assert (SYSPROF_IS_NOTEBOOK (self));
|
||||||
|
g_assert (SYSPROF_IS_DISPLAY (display));
|
||||||
|
|
||||||
|
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_CAN_REPLAY]);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sysprof_notebook_page_added (GtkNotebook *notebook,
|
sysprof_notebook_page_added (GtkNotebook *notebook,
|
||||||
GtkWidget *child,
|
GtkWidget *child,
|
||||||
@ -82,12 +94,19 @@ sysprof_notebook_page_added (GtkNotebook *notebook,
|
|||||||
gtk_notebook_set_tab_label (notebook, child, tab);
|
gtk_notebook_set_tab_label (notebook, child, tab);
|
||||||
gtk_notebook_set_tab_reorderable (notebook, child, TRUE);
|
gtk_notebook_set_tab_reorderable (notebook, child, TRUE);
|
||||||
|
|
||||||
|
g_signal_connect_object (child,
|
||||||
|
"notify::can-replay",
|
||||||
|
G_CALLBACK (sysprof_notebook_notify_can_replay_cb),
|
||||||
|
notebook,
|
||||||
|
G_CONNECT_SWAPPED);
|
||||||
|
|
||||||
g_signal_connect_object (child,
|
g_signal_connect_object (child,
|
||||||
"notify::can-save",
|
"notify::can-save",
|
||||||
G_CALLBACK (sysprof_notebook_notify_can_save_cb),
|
G_CALLBACK (sysprof_notebook_notify_can_save_cb),
|
||||||
notebook,
|
notebook,
|
||||||
G_CONNECT_SWAPPED);
|
G_CONNECT_SWAPPED);
|
||||||
|
|
||||||
|
g_object_notify_by_pspec (G_OBJECT (notebook), properties [PROP_CAN_REPLAY]);
|
||||||
g_object_notify_by_pspec (G_OBJECT (notebook), properties [PROP_CAN_SAVE]);
|
g_object_notify_by_pspec (G_OBJECT (notebook), properties [PROP_CAN_SAVE]);
|
||||||
g_object_notify_by_pspec (G_OBJECT (notebook), properties [PROP_CURRENT]);
|
g_object_notify_by_pspec (G_OBJECT (notebook), properties [PROP_CURRENT]);
|
||||||
|
|
||||||
@ -116,6 +135,7 @@ sysprof_notebook_page_removed (GtkNotebook *notebook,
|
|||||||
G_CALLBACK (sysprof_notebook_notify_can_save_cb),
|
G_CALLBACK (sysprof_notebook_notify_can_save_cb),
|
||||||
notebook);
|
notebook);
|
||||||
|
|
||||||
|
g_object_notify_by_pspec (G_OBJECT (notebook), properties [PROP_CAN_REPLAY]);
|
||||||
g_object_notify_by_pspec (G_OBJECT (notebook), properties [PROP_CAN_SAVE]);
|
g_object_notify_by_pspec (G_OBJECT (notebook), properties [PROP_CAN_SAVE]);
|
||||||
g_object_notify_by_pspec (G_OBJECT (notebook), properties [PROP_CURRENT]);
|
g_object_notify_by_pspec (G_OBJECT (notebook), properties [PROP_CURRENT]);
|
||||||
}
|
}
|
||||||
@ -134,6 +154,7 @@ sysprof_notebook_switch_page (GtkNotebook *notebook,
|
|||||||
|
|
||||||
GTK_NOTEBOOK_CLASS (sysprof_notebook_parent_class)->switch_page (notebook, widget, page);
|
GTK_NOTEBOOK_CLASS (sysprof_notebook_parent_class)->switch_page (notebook, widget, page);
|
||||||
|
|
||||||
|
g_object_notify_by_pspec (G_OBJECT (notebook), properties [PROP_CAN_REPLAY]);
|
||||||
g_object_notify_by_pspec (G_OBJECT (notebook), properties [PROP_CAN_SAVE]);
|
g_object_notify_by_pspec (G_OBJECT (notebook), properties [PROP_CAN_SAVE]);
|
||||||
g_object_notify_by_pspec (G_OBJECT (notebook), properties [PROP_CURRENT]);
|
g_object_notify_by_pspec (G_OBJECT (notebook), properties [PROP_CURRENT]);
|
||||||
}
|
}
|
||||||
@ -148,6 +169,10 @@ sysprof_notebook_get_property (GObject *object,
|
|||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
|
case PROP_CAN_REPLAY:
|
||||||
|
g_value_set_boolean (value, sysprof_notebook_get_can_replay (self));
|
||||||
|
break;
|
||||||
|
|
||||||
case PROP_CAN_SAVE:
|
case PROP_CAN_SAVE:
|
||||||
g_value_set_boolean (value, sysprof_notebook_get_can_save (self));
|
g_value_set_boolean (value, sysprof_notebook_get_can_save (self));
|
||||||
break;
|
break;
|
||||||
@ -173,6 +198,13 @@ sysprof_notebook_class_init (SysprofNotebookClass *klass)
|
|||||||
notebook_class->page_removed = sysprof_notebook_page_removed;
|
notebook_class->page_removed = sysprof_notebook_page_removed;
|
||||||
notebook_class->switch_page = sysprof_notebook_switch_page;
|
notebook_class->switch_page = sysprof_notebook_switch_page;
|
||||||
|
|
||||||
|
properties [PROP_CAN_REPLAY] =
|
||||||
|
g_param_spec_boolean ("can-replay",
|
||||||
|
"Can Replay",
|
||||||
|
"If the current display can replay a recording",
|
||||||
|
FALSE,
|
||||||
|
(G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
properties [PROP_CAN_SAVE] =
|
properties [PROP_CAN_SAVE] =
|
||||||
g_param_spec_boolean ("can-save",
|
g_param_spec_boolean ("can-save",
|
||||||
"Can Save",
|
"Can Save",
|
||||||
@ -293,3 +325,34 @@ sysprof_notebook_get_can_save (SysprofNotebook *self)
|
|||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
sysprof_notebook_get_can_replay (SysprofNotebook *self)
|
||||||
|
{
|
||||||
|
SysprofDisplay *display;
|
||||||
|
|
||||||
|
g_return_val_if_fail (SYSPROF_IS_NOTEBOOK (self), FALSE);
|
||||||
|
|
||||||
|
if ((display = sysprof_notebook_get_current (self)))
|
||||||
|
return sysprof_display_get_can_replay (display);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
sysprof_notebook_replay (SysprofNotebook *self)
|
||||||
|
{
|
||||||
|
SysprofDisplay *display;
|
||||||
|
SysprofDisplay *replay;
|
||||||
|
|
||||||
|
g_return_if_fail (SYSPROF_IS_NOTEBOOK (self));
|
||||||
|
|
||||||
|
if (!(display = sysprof_notebook_get_current (self)) ||
|
||||||
|
!sysprof_display_get_can_replay (display) ||
|
||||||
|
!(replay = sysprof_display_replay (display)))
|
||||||
|
return;
|
||||||
|
|
||||||
|
g_return_if_fail (SYSPROF_IS_DISPLAY (replay));
|
||||||
|
|
||||||
|
gtk_container_add (GTK_CONTAINER (self), GTK_WIDGET (replay));
|
||||||
|
}
|
||||||
|
|||||||
@ -41,17 +41,21 @@ struct _SysprofNotebookClass
|
|||||||
};
|
};
|
||||||
|
|
||||||
SYSPROF_AVAILABLE_IN_ALL
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
GtkWidget *sysprof_notebook_new (void);
|
GtkWidget *sysprof_notebook_new (void);
|
||||||
SYSPROF_AVAILABLE_IN_ALL
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
SysprofDisplay *sysprof_notebook_get_current (SysprofNotebook *self);
|
SysprofDisplay *sysprof_notebook_get_current (SysprofNotebook *self);
|
||||||
SYSPROF_AVAILABLE_IN_ALL
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
void sysprof_notebook_close_current (SysprofNotebook *self);
|
void sysprof_notebook_close_current (SysprofNotebook *self);
|
||||||
SYSPROF_AVAILABLE_IN_ALL
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
void sysprof_notebook_open (SysprofNotebook *self,
|
void sysprof_notebook_open (SysprofNotebook *self,
|
||||||
GFile *file);
|
GFile *file);
|
||||||
SYSPROF_AVAILABLE_IN_ALL
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
void sysprof_notebook_save (SysprofNotebook *self);
|
void sysprof_notebook_save (SysprofNotebook *self);
|
||||||
SYSPROF_AVAILABLE_IN_ALL
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
gboolean sysprof_notebook_get_can_save (SysprofNotebook *self);
|
gboolean sysprof_notebook_get_can_save (SysprofNotebook *self);
|
||||||
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
|
void sysprof_notebook_replay (SysprofNotebook *self);
|
||||||
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
|
gboolean sysprof_notebook_get_can_replay (SysprofNotebook *self);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|||||||
@ -25,6 +25,13 @@
|
|||||||
<attribute name="accel"><primary>s</attribute>
|
<attribute name="accel"><primary>s</attribute>
|
||||||
</item>
|
</item>
|
||||||
</section>
|
</section>
|
||||||
|
<section id="win-menu-replay">
|
||||||
|
<item>
|
||||||
|
<attribute name="label" translatable="yes">Record Again</attribute>
|
||||||
|
<attribute name="action">win.replay-capture</attribute>
|
||||||
|
<attribute name="accel"><primary>r</attribute>
|
||||||
|
</item>
|
||||||
|
</section>
|
||||||
<section id="win-menu-close">
|
<section id="win-menu-close">
|
||||||
<item>
|
<item>
|
||||||
<attribute name="label" translatable="yes">Close</attribute>
|
<attribute name="label" translatable="yes">Close</attribute>
|
||||||
|
|||||||
@ -44,6 +44,7 @@ struct {
|
|||||||
{ "zoom.zoom-one", { "<Primary>0", "<Primary>KP_0", NULL } },
|
{ "zoom.zoom-one", { "<Primary>0", "<Primary>KP_0", NULL } },
|
||||||
{ "win.new-tab", { "<Primary>t", NULL } },
|
{ "win.new-tab", { "<Primary>t", NULL } },
|
||||||
{ "win.close-tab", { "<Primary>w", NULL } },
|
{ "win.close-tab", { "<Primary>w", NULL } },
|
||||||
|
{ "win.replay-capture", { "<Primary>r", NULL } },
|
||||||
{ "win.save-capture", { "<Primary>s", NULL } },
|
{ "win.save-capture", { "<Primary>s", NULL } },
|
||||||
{ "win.switch-tab(1)", { "<Alt>1", NULL } },
|
{ "win.switch-tab(1)", { "<Alt>1", NULL } },
|
||||||
{ "win.switch-tab(2)", { "<Alt>2", NULL } },
|
{ "win.switch-tab(2)", { "<Alt>2", NULL } },
|
||||||
|
|||||||
@ -54,6 +54,19 @@ sysprof_window_new (SysprofApplication *application)
|
|||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
sysprof_window_notify_can_replay_cb (SysprofWindow *self,
|
||||||
|
GParamSpec *pspec,
|
||||||
|
SysprofNotebook *notebook)
|
||||||
|
{
|
||||||
|
g_assert (SYSPROF_IS_WINDOW (self));
|
||||||
|
g_assert (SYSPROF_IS_NOTEBOOK (notebook));
|
||||||
|
|
||||||
|
dzl_gtk_widget_action_set (GTK_WIDGET (self), "win", "replay-capture",
|
||||||
|
"enabled", sysprof_notebook_get_can_replay (notebook),
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sysprof_window_notify_can_save_cb (SysprofWindow *self,
|
sysprof_window_notify_can_save_cb (SysprofWindow *self,
|
||||||
GParamSpec *pspec,
|
GParamSpec *pspec,
|
||||||
@ -121,15 +134,23 @@ close_tab_cb (GSimpleAction *action,
|
|||||||
sysprof_notebook_close_current (self->notebook);
|
sysprof_notebook_close_current (self->notebook);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
replay_capture_cb (GSimpleAction *action,
|
||||||
|
GVariant *param,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
SysprofWindow *self = user_data;
|
||||||
|
g_return_if_fail (SYSPROF_IS_WINDOW (self));
|
||||||
|
sysprof_notebook_replay (self->notebook);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
save_capture_cb (GSimpleAction *action,
|
save_capture_cb (GSimpleAction *action,
|
||||||
GVariant *param,
|
GVariant *param,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
SysprofWindow *self = user_data;
|
SysprofWindow *self = user_data;
|
||||||
|
|
||||||
g_return_if_fail (SYSPROF_IS_WINDOW (self));
|
g_return_if_fail (SYSPROF_IS_WINDOW (self));
|
||||||
|
|
||||||
sysprof_notebook_save (self->notebook);
|
sysprof_notebook_save (self->notebook);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,6 +205,7 @@ sysprof_window_init (SysprofWindow *self)
|
|||||||
{ "close-tab", close_tab_cb },
|
{ "close-tab", close_tab_cb },
|
||||||
{ "new-tab", new_tab_cb },
|
{ "new-tab", new_tab_cb },
|
||||||
{ "switch-tab", switch_tab_cb, "i" },
|
{ "switch-tab", switch_tab_cb, "i" },
|
||||||
|
{ "replay-capture", replay_capture_cb },
|
||||||
{ "save-capture", save_capture_cb },
|
{ "save-capture", save_capture_cb },
|
||||||
{ "stop-recording", stop_recording_cb },
|
{ "stop-recording", stop_recording_cb },
|
||||||
};
|
};
|
||||||
@ -195,6 +217,12 @@ sysprof_window_init (SysprofWindow *self)
|
|||||||
G_N_ELEMENTS (actions),
|
G_N_ELEMENTS (actions),
|
||||||
self);
|
self);
|
||||||
|
|
||||||
|
g_signal_connect_object (self->notebook,
|
||||||
|
"notify::can-replay",
|
||||||
|
G_CALLBACK (sysprof_window_notify_can_replay_cb),
|
||||||
|
self,
|
||||||
|
G_CONNECT_SWAPPED);
|
||||||
|
|
||||||
g_signal_connect_object (self->notebook,
|
g_signal_connect_object (self->notebook,
|
||||||
"notify::can-save",
|
"notify::can-save",
|
||||||
G_CALLBACK (sysprof_window_notify_can_save_cb),
|
G_CALLBACK (sysprof_window_notify_can_save_cb),
|
||||||
@ -216,6 +244,9 @@ sysprof_window_init (SysprofWindow *self)
|
|||||||
dzl_gtk_widget_action_set (GTK_WIDGET (self), "win", "save-capture",
|
dzl_gtk_widget_action_set (GTK_WIDGET (self), "win", "save-capture",
|
||||||
"enabled", FALSE,
|
"enabled", FALSE,
|
||||||
NULL);
|
NULL);
|
||||||
|
dzl_gtk_widget_action_set (GTK_WIDGET (self), "win", "replay-capture",
|
||||||
|
"enabled", FALSE,
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
Reference in New Issue
Block a user