mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-11 07:30:54 +00:00
libsysprof-gtk: bind expression to normalized series
This commit is contained in:
@ -36,6 +36,8 @@ struct _SysprofTimeSpanLayer
|
|||||||
SysprofNormalizedSeries *normal_x;
|
SysprofNormalizedSeries *normal_x;
|
||||||
SysprofNormalizedSeries *normal_x2;
|
SysprofNormalizedSeries *normal_x2;
|
||||||
|
|
||||||
|
GBindingGroup *series_bindings;
|
||||||
|
|
||||||
GdkRGBA color;
|
GdkRGBA color;
|
||||||
GdkRGBA event_color;
|
GdkRGBA event_color;
|
||||||
|
|
||||||
@ -297,6 +299,7 @@ sysprof_time_span_layer_finalize (GObject *object)
|
|||||||
{
|
{
|
||||||
SysprofTimeSpanLayer *self = (SysprofTimeSpanLayer *)object;
|
SysprofTimeSpanLayer *self = (SysprofTimeSpanLayer *)object;
|
||||||
|
|
||||||
|
g_clear_object (&self->series_bindings);
|
||||||
g_clear_object (&self->axis);
|
g_clear_object (&self->axis);
|
||||||
g_clear_object (&self->series);
|
g_clear_object (&self->series);
|
||||||
g_clear_object (&self->normal_x);
|
g_clear_object (&self->normal_x);
|
||||||
@ -408,18 +411,8 @@ sysprof_time_span_layer_class_init (SysprofTimeSpanLayerClass *klass)
|
|||||||
static void
|
static void
|
||||||
sysprof_time_span_layer_init (SysprofTimeSpanLayer *self)
|
sysprof_time_span_layer_init (SysprofTimeSpanLayer *self)
|
||||||
{
|
{
|
||||||
g_autoptr(GtkExpression) begin_expression = NULL;
|
self->normal_x = g_object_new (SYSPROF_TYPE_NORMALIZED_SERIES, NULL);
|
||||||
g_autoptr(GtkExpression) end_expression = NULL;
|
self->normal_x2 = g_object_new (SYSPROF_TYPE_NORMALIZED_SERIES, NULL);
|
||||||
|
|
||||||
begin_expression = gtk_property_expression_new (SYSPROF_TYPE_TIME_SERIES_ITEM, NULL, "time");
|
|
||||||
end_expression = gtk_property_expression_new (SYSPROF_TYPE_TIME_SERIES_ITEM, NULL, "end-time");
|
|
||||||
|
|
||||||
self->normal_x = g_object_new (SYSPROF_TYPE_NORMALIZED_SERIES,
|
|
||||||
"expression", begin_expression,
|
|
||||||
NULL);
|
|
||||||
self->normal_x2 = g_object_new (SYSPROF_TYPE_NORMALIZED_SERIES,
|
|
||||||
"expression", end_expression,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
g_signal_connect_object (self->normal_x,
|
g_signal_connect_object (self->normal_x,
|
||||||
"items-changed",
|
"items-changed",
|
||||||
@ -431,6 +424,14 @@ sysprof_time_span_layer_init (SysprofTimeSpanLayer *self)
|
|||||||
G_CALLBACK (gtk_widget_queue_draw),
|
G_CALLBACK (gtk_widget_queue_draw),
|
||||||
self,
|
self,
|
||||||
G_CONNECT_SWAPPED);
|
G_CONNECT_SWAPPED);
|
||||||
|
|
||||||
|
self->series_bindings = g_binding_group_new ();
|
||||||
|
g_binding_group_bind (self->series_bindings, "time-expression",
|
||||||
|
self->normal_x, "expression",
|
||||||
|
G_BINDING_SYNC_CREATE);
|
||||||
|
g_binding_group_bind (self->series_bindings, "duration-expression",
|
||||||
|
self->normal_x2, "expression",
|
||||||
|
G_BINDING_SYNC_CREATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
const GdkRGBA *
|
const GdkRGBA *
|
||||||
@ -512,6 +513,8 @@ sysprof_time_span_layer_set_series (SysprofTimeSpanLayer *self,
|
|||||||
if (!g_set_object (&self->series, series))
|
if (!g_set_object (&self->series, series))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
g_binding_group_set_source (self->series_bindings, series);
|
||||||
|
|
||||||
sysprof_normalized_series_set_series (self->normal_x, SYSPROF_SERIES (series));
|
sysprof_normalized_series_set_series (self->normal_x, SYSPROF_SERIES (series));
|
||||||
sysprof_normalized_series_set_series (self->normal_x2, SYSPROF_SERIES (series));
|
sysprof_normalized_series_set_series (self->normal_x2, SYSPROF_SERIES (series));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user