diff --git a/src/libsysprof-ui/sysprof-display.c b/src/libsysprof-ui/sysprof-display.c index d3fa8724..57ed97ba 100644 --- a/src/libsysprof-ui/sysprof-display.c +++ b/src/libsysprof-ui/sysprof-display.c @@ -52,6 +52,7 @@ G_DEFINE_TYPE_WITH_PRIVATE (SysprofDisplay, sysprof_display, GTK_TYPE_BIN) enum { PROP_0, + PROP_RECORDING, PROP_TITLE, N_PROPS }; @@ -92,6 +93,7 @@ sysprof_display_profiler_failed_cb (SysprofDisplay *self, gtk_stack_set_visible_child (priv->stack, GTK_WIDGET (priv->failed_view)); + g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_RECORDING]); g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_TITLE]); } @@ -106,6 +108,7 @@ sysprof_display_profiler_stopped_cb (SysprofDisplay *self, gtk_stack_set_visible_child (priv->stack, GTK_WIDGET (priv->capture_view)); + g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_RECORDING]); g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_TITLE]); } @@ -141,6 +144,7 @@ sysprof_display_start_recording_cb (SysprofDisplay *self, sysprof_profiler_start (priv->profiler); } + g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_RECORDING]); g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_TITLE]); } @@ -158,7 +162,7 @@ sysprof_display_dup_title (SysprofDisplay *self) if (priv->profiler != NULL) { if (sysprof_profiler_get_is_running (priv->profiler)) - return g_strdup (_("⏺ Recording…")); + return g_strdup (_("Recording…")); } if (priv->file != NULL) @@ -194,6 +198,16 @@ update_title_child_property (SysprofDisplay *self) g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_TITLE]); } +static gboolean +sysprof_display_get_is_recording (SysprofDisplay *self) +{ + SysprofDisplayPrivate *priv = sysprof_display_get_instance_private (self); + + g_assert (SYSPROF_IS_DISPLAY (self)); + + return GTK_WIDGET (priv->recording_view) == gtk_stack_get_visible_child (priv->stack); +} + static void sysprof_display_parent_set (GtkWidget *widget, GtkWidget *old_parent) @@ -229,6 +243,10 @@ sysprof_display_get_property (GObject *object, switch (prop_id) { + case PROP_RECORDING: + g_value_set_boolean (value, sysprof_display_get_is_recording (self)); + break; + case PROP_TITLE: g_value_take_string (value, sysprof_display_dup_title (self)); break; @@ -263,6 +281,13 @@ sysprof_display_class_init (SysprofDisplayClass *klass) widget_class->parent_set = sysprof_display_parent_set; + properties [PROP_RECORDING] = + g_param_spec_boolean ("recording", + "Recording", + "If the display is in recording state", + FALSE, + (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); + properties [PROP_TITLE] = g_param_spec_string ("title", "Title", diff --git a/src/libsysprof-ui/sysprof-tab.c b/src/libsysprof-ui/sysprof-tab.c index 5c3e7b5a..864aba27 100644 --- a/src/libsysprof-ui/sysprof-tab.c +++ b/src/libsysprof-ui/sysprof-tab.c @@ -32,6 +32,7 @@ struct _SysprofTab GtkButton *close_button; GtkLabel *title; + GtkImage *recording; SysprofDisplay *display; }; @@ -106,9 +107,8 @@ sysprof_tab_set_property (GObject *object, { case PROP_DISPLAY: g_set_weak_pointer (&self->display, g_value_get_object (value)); - g_object_bind_property (self->display, "title", - self->title, "label", - G_BINDING_SYNC_CREATE); + g_object_bind_property (self->display, "title", self->title, "label", G_BINDING_SYNC_CREATE); + g_object_bind_property (self->display, "recording", self->recording, "visible", G_BINDING_SYNC_CREATE); break; default: @@ -128,6 +128,7 @@ sysprof_tab_class_init (SysprofTabClass *klass) gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/sysprof/ui/sysprof-tab.ui"); gtk_widget_class_bind_template_child (widget_class, SysprofTab, close_button); + gtk_widget_class_bind_template_child (widget_class, SysprofTab, recording); gtk_widget_class_bind_template_child (widget_class, SysprofTab, title); properties [PROP_DISPLAY] = diff --git a/src/libsysprof-ui/ui/sysprof-tab.ui b/src/libsysprof-ui/ui/sysprof-tab.ui index 1bf77db9..883cd25c 100644 --- a/src/libsysprof-ui/ui/sysprof-tab.ui +++ b/src/libsysprof-ui/ui/sysprof-tab.ui @@ -7,15 +7,29 @@ True 6 - - True - False - True + + false + media-record-symbolic + 16 + true + end True True 0 + start + + + + + True + False + + + False + True + 0 @@ -36,6 +50,7 @@ + end False True 1