mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-11 07:30:54 +00:00
libsysprof-ui: wire up more recording state
This commit is contained in:
@ -52,6 +52,7 @@ G_DEFINE_TYPE_WITH_PRIVATE (SysprofDisplay, sysprof_display, GTK_TYPE_BIN)
|
|||||||
|
|
||||||
enum {
|
enum {
|
||||||
PROP_0,
|
PROP_0,
|
||||||
|
PROP_RECORDING,
|
||||||
PROP_TITLE,
|
PROP_TITLE,
|
||||||
N_PROPS
|
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));
|
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]);
|
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));
|
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]);
|
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);
|
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]);
|
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 (priv->profiler != NULL)
|
||||||
{
|
{
|
||||||
if (sysprof_profiler_get_is_running (priv->profiler))
|
if (sysprof_profiler_get_is_running (priv->profiler))
|
||||||
return g_strdup (_("⏺ Recording…"));
|
return g_strdup (_("Recording…"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->file != NULL)
|
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]);
|
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
|
static void
|
||||||
sysprof_display_parent_set (GtkWidget *widget,
|
sysprof_display_parent_set (GtkWidget *widget,
|
||||||
GtkWidget *old_parent)
|
GtkWidget *old_parent)
|
||||||
@ -229,6 +243,10 @@ sysprof_display_get_property (GObject *object,
|
|||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
|
case PROP_RECORDING:
|
||||||
|
g_value_set_boolean (value, sysprof_display_get_is_recording (self));
|
||||||
|
break;
|
||||||
|
|
||||||
case PROP_TITLE:
|
case PROP_TITLE:
|
||||||
g_value_take_string (value, sysprof_display_dup_title (self));
|
g_value_take_string (value, sysprof_display_dup_title (self));
|
||||||
break;
|
break;
|
||||||
@ -263,6 +281,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_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] =
|
properties [PROP_TITLE] =
|
||||||
g_param_spec_string ("title",
|
g_param_spec_string ("title",
|
||||||
"Title",
|
"Title",
|
||||||
|
|||||||
@ -32,6 +32,7 @@ struct _SysprofTab
|
|||||||
|
|
||||||
GtkButton *close_button;
|
GtkButton *close_button;
|
||||||
GtkLabel *title;
|
GtkLabel *title;
|
||||||
|
GtkImage *recording;
|
||||||
|
|
||||||
SysprofDisplay *display;
|
SysprofDisplay *display;
|
||||||
};
|
};
|
||||||
@ -106,9 +107,8 @@ sysprof_tab_set_property (GObject *object,
|
|||||||
{
|
{
|
||||||
case PROP_DISPLAY:
|
case PROP_DISPLAY:
|
||||||
g_set_weak_pointer (&self->display, g_value_get_object (value));
|
g_set_weak_pointer (&self->display, g_value_get_object (value));
|
||||||
g_object_bind_property (self->display, "title",
|
g_object_bind_property (self->display, "title", self->title, "label", G_BINDING_SYNC_CREATE);
|
||||||
self->title, "label",
|
g_object_bind_property (self->display, "recording", self->recording, "visible", G_BINDING_SYNC_CREATE);
|
||||||
G_BINDING_SYNC_CREATE);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
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_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, close_button);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, SysprofTab, recording);
|
||||||
gtk_widget_class_bind_template_child (widget_class, SysprofTab, title);
|
gtk_widget_class_bind_template_child (widget_class, SysprofTab, title);
|
||||||
|
|
||||||
properties [PROP_DISPLAY] =
|
properties [PROP_DISPLAY] =
|
||||||
|
|||||||
@ -7,15 +7,29 @@
|
|||||||
<property name="hexpand">True</property>
|
<property name="hexpand">True</property>
|
||||||
<property name="spacing">6</property>
|
<property name="spacing">6</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel" id="title">
|
<object class="GtkImage" id="recording">
|
||||||
<property name="visible">True</property>
|
<property name="visible">false</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="icon-name">media-record-symbolic</property>
|
||||||
<property name="hexpand">True</property>
|
<property name="pixel-size">16</property>
|
||||||
|
<property name="hexpand">true</property>
|
||||||
|
<property name="halign">end</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">True</property>
|
<property name="expand">True</property>
|
||||||
<property name="fill">True</property>
|
<property name="fill">True</property>
|
||||||
<property name="position">0</property>
|
<property name="position">0</property>
|
||||||
|
<property name="pack-type">start</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child type="center">
|
||||||
|
<object class="GtkLabel" id="title">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
@ -36,6 +50,7 @@
|
|||||||
</style>
|
</style>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
|
<property name="pack-type">end</property>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">True</property>
|
<property name="fill">True</property>
|
||||||
<property name="position">1</property>
|
<property name="position">1</property>
|
||||||
|
|||||||
Reference in New Issue
Block a user