mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof-gtk: add new SysprofTimeSeries
This is to replace what is in libsysprof-analyze currently, so we can do charting in a more flexible manner.
This commit is contained in:
@ -13,8 +13,11 @@ libsysprof_gtk_public_sources = [
|
||||
'sysprof-session.c',
|
||||
'sysprof-split-layer.c',
|
||||
'sysprof-time-span-layer.c',
|
||||
'sysprof-time-series.c',
|
||||
'sysprof-time-series-item.c',
|
||||
'sysprof-weighted-callgraph-view.c',
|
||||
'sysprof-xy-series.c',
|
||||
'sysprof-xy-series-item.c',
|
||||
]
|
||||
|
||||
libsysprof_gtk_public_headers = [
|
||||
@ -33,9 +36,12 @@ libsysprof_gtk_public_headers = [
|
||||
'sysprof-series.h',
|
||||
'sysprof-session.h',
|
||||
'sysprof-split-layer.h',
|
||||
'sysprof-time-series.h',
|
||||
'sysprof-time-series-item.h',
|
||||
'sysprof-time-span-layer.h',
|
||||
'sysprof-weighted-callgraph-view.h',
|
||||
'sysprof-xy-series.h',
|
||||
'sysprof-xy-series-item.h',
|
||||
]
|
||||
|
||||
libsysprof_gtk_private_sources = [
|
||||
|
||||
33
src/libsysprof-gtk/sysprof-time-series-item-private.h
Normal file
33
src/libsysprof-gtk/sysprof-time-series-item-private.h
Normal file
@ -0,0 +1,33 @@
|
||||
/* sysprof-time-series-item-private.h
|
||||
*
|
||||
* Copyright 2023 Christian Hergert <chergert@redhat.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "sysprof-time-series-item.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
SysprofTimeSeriesItem *_sysprof_time_series_item_new (GObject *item,
|
||||
GtkExpression *x_expression,
|
||||
GtkExpression *y_expression);
|
||||
|
||||
G_END_DECLS
|
||||
142
src/libsysprof-gtk/sysprof-time-series-item.c
Normal file
142
src/libsysprof-gtk/sysprof-time-series-item.c
Normal file
@ -0,0 +1,142 @@
|
||||
/* sysprof-time-series-item.c
|
||||
*
|
||||
* Copyright 2023 Christian Hergert <chergert@redhat.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "sysprof-time-series-item-private.h"
|
||||
|
||||
struct _SysprofTimeSeriesItem
|
||||
{
|
||||
GObject parent_instance;
|
||||
GtkExpression *time_expression;
|
||||
GtkExpression *duration_expression;
|
||||
GObject *item;
|
||||
};
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_ITEM,
|
||||
N_PROPS
|
||||
};
|
||||
|
||||
G_DEFINE_FINAL_TYPE (SysprofTimeSeriesItem, sysprof_time_series_item, G_TYPE_OBJECT)
|
||||
|
||||
static GParamSpec *properties [N_PROPS];
|
||||
|
||||
static void
|
||||
sysprof_time_series_item_finalize (GObject *object)
|
||||
{
|
||||
SysprofTimeSeriesItem *self = (SysprofTimeSeriesItem *)object;
|
||||
|
||||
g_clear_object (&self->item);
|
||||
g_clear_pointer (&self->time_expression, gtk_expression_unref);
|
||||
g_clear_pointer (&self->duration_expression, gtk_expression_unref);
|
||||
|
||||
G_OBJECT_CLASS (sysprof_time_series_item_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
sysprof_time_series_item_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
SysprofTimeSeriesItem *self = SYSPROF_TIME_SERIES_ITEM (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_ITEM:
|
||||
g_value_set_object (value, self->item);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
sysprof_time_series_item_class_init (SysprofTimeSeriesItemClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->finalize = sysprof_time_series_item_finalize;
|
||||
object_class->get_property = sysprof_time_series_item_get_property;
|
||||
|
||||
properties [PROP_ITEM] =
|
||||
g_param_spec_object ("item", NULL, NULL,
|
||||
G_TYPE_OBJECT,
|
||||
(G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_object_class_install_properties (object_class, N_PROPS, properties);
|
||||
}
|
||||
|
||||
static void
|
||||
sysprof_time_series_item_init (SysprofTimeSeriesItem *self)
|
||||
{
|
||||
}
|
||||
|
||||
SysprofTimeSeriesItem *
|
||||
_sysprof_time_series_item_new (GObject *item,
|
||||
GtkExpression *time_expression,
|
||||
GtkExpression *duration_expression)
|
||||
{
|
||||
SysprofTimeSeriesItem *self;
|
||||
|
||||
self = g_object_new (SYSPROF_TYPE_TIME_SERIES_ITEM, NULL);
|
||||
self->item = item;
|
||||
self->time_expression = time_expression;
|
||||
self->duration_expression = duration_expression;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
/**
|
||||
* sysprof_time_series_item_get_item:
|
||||
* @self: a #SysprofTimeSeriesItem
|
||||
*
|
||||
* Gets the item used to generate X/Y values.
|
||||
*
|
||||
* Returns: (transfer none): a #GObject
|
||||
*/
|
||||
gpointer
|
||||
sysprof_time_series_item_get_item (SysprofTimeSeriesItem *self)
|
||||
{
|
||||
g_return_val_if_fail (SYSPROF_IS_TIME_SERIES_ITEM (self), NULL);
|
||||
|
||||
return self->item;
|
||||
}
|
||||
|
||||
void
|
||||
sysprof_time_series_item_get_time_value (SysprofTimeSeriesItem *self,
|
||||
GValue *time_value)
|
||||
{
|
||||
g_return_if_fail (SYSPROF_IS_TIME_SERIES_ITEM (self));
|
||||
|
||||
gtk_expression_evaluate (self->time_expression, self->item, time_value);
|
||||
}
|
||||
|
||||
void
|
||||
sysprof_time_series_item_get_duration_value (SysprofTimeSeriesItem *self,
|
||||
GValue *duration_value)
|
||||
{
|
||||
g_return_if_fail (SYSPROF_IS_TIME_SERIES_ITEM (self));
|
||||
|
||||
gtk_expression_evaluate (self->duration_expression, self->item, duration_value);
|
||||
}
|
||||
43
src/libsysprof-gtk/sysprof-time-series-item.h
Normal file
43
src/libsysprof-gtk/sysprof-time-series-item.h
Normal file
@ -0,0 +1,43 @@
|
||||
/* sysprof-time-series-item.h
|
||||
*
|
||||
* Copyright 2023 Christian Hergert <chergert@redhat.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include <sysprof-capture.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define SYSPROF_TYPE_TIME_SERIES_ITEM (sysprof_time_series_item_get_type())
|
||||
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
G_DECLARE_FINAL_TYPE (SysprofTimeSeriesItem, sysprof_time_series_item, SYSPROF, TIME_SERIES_ITEM, GObject)
|
||||
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_time_series_item_get_time_value (SysprofTimeSeriesItem *self,
|
||||
GValue *time_value);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_time_series_item_get_duration_value (SysprofTimeSeriesItem *self,
|
||||
GValue *duration_value);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
gpointer sysprof_time_series_item_get_item (SysprofTimeSeriesItem *self);
|
||||
|
||||
G_END_DECLS
|
||||
255
src/libsysprof-gtk/sysprof-time-series.c
Normal file
255
src/libsysprof-gtk/sysprof-time-series.c
Normal file
@ -0,0 +1,255 @@
|
||||
/* sysprof-time-series.c
|
||||
*
|
||||
* Copyright 2023 Christian Hergert <chergert@redhat.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "sysprof-series-private.h"
|
||||
#include "sysprof-time-series.h"
|
||||
#include "sysprof-time-series-item-private.h"
|
||||
|
||||
struct _SysprofTimeSeries
|
||||
{
|
||||
SysprofSeries parent_instance;
|
||||
GtkExpression *time_expression;
|
||||
GtkExpression *duration_expression;
|
||||
};
|
||||
|
||||
struct _SysprofTimeSeriesClass
|
||||
{
|
||||
SysprofSeriesClass parent_instance;
|
||||
};
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_TIME_EXPRESSION,
|
||||
PROP_DURATION_EXPRESSION,
|
||||
N_PROPS
|
||||
};
|
||||
|
||||
G_DEFINE_FINAL_TYPE (SysprofTimeSeries, sysprof_time_series, SYSPROF_TYPE_SERIES)
|
||||
|
||||
static GParamSpec *properties [N_PROPS];
|
||||
|
||||
static gpointer
|
||||
sysprof_time_series_get_series_item (SysprofSeries *series,
|
||||
guint position,
|
||||
gpointer item)
|
||||
{
|
||||
SysprofTimeSeries *self = SYSPROF_TIME_SERIES (series);
|
||||
|
||||
return _sysprof_time_series_item_new (item,
|
||||
gtk_expression_ref (self->time_expression),
|
||||
gtk_expression_ref (self->duration_expression));
|
||||
}
|
||||
|
||||
static void
|
||||
sysprof_time_series_finalize (GObject *object)
|
||||
{
|
||||
SysprofTimeSeries *self = (SysprofTimeSeries *)object;
|
||||
|
||||
g_clear_pointer (&self->time_expression, gtk_expression_unref);
|
||||
g_clear_pointer (&self->duration_expression, gtk_expression_unref);
|
||||
|
||||
G_OBJECT_CLASS (sysprof_time_series_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
sysprof_time_series_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
SysprofTimeSeries *self = SYSPROF_TIME_SERIES (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_TIME_EXPRESSION:
|
||||
gtk_value_set_expression (value, self->time_expression);
|
||||
break;
|
||||
|
||||
case PROP_DURATION_EXPRESSION:
|
||||
gtk_value_set_expression (value, self->duration_expression);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
sysprof_time_series_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
SysprofTimeSeries *self = SYSPROF_TIME_SERIES (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_TIME_EXPRESSION:
|
||||
sysprof_time_series_set_time_expression (self, gtk_value_get_expression (value));
|
||||
break;
|
||||
|
||||
case PROP_DURATION_EXPRESSION:
|
||||
sysprof_time_series_set_duration_expression (self, gtk_value_get_expression (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
sysprof_time_series_class_init (SysprofTimeSeriesClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
SysprofSeriesClass *series_class = SYSPROF_SERIES_CLASS (klass);
|
||||
|
||||
object_class->finalize = sysprof_time_series_finalize;
|
||||
object_class->get_property = sysprof_time_series_get_property;
|
||||
object_class->set_property = sysprof_time_series_set_property;
|
||||
|
||||
series_class->series_item_type = SYSPROF_TYPE_TIME_SERIES_ITEM;
|
||||
series_class->get_series_item = sysprof_time_series_get_series_item;
|
||||
|
||||
properties [PROP_TIME_EXPRESSION] =
|
||||
gtk_param_spec_expression ("x-expression", NULL, NULL,
|
||||
(G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
properties [PROP_DURATION_EXPRESSION] =
|
||||
gtk_param_spec_expression ("y-expression", NULL, NULL,
|
||||
(G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_object_class_install_properties (object_class, N_PROPS, properties);
|
||||
}
|
||||
|
||||
static void
|
||||
sysprof_time_series_init (SysprofTimeSeries *self)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* sysprof_time_series_new:
|
||||
* @title: (nullable): a title for the series
|
||||
* @model: (transfer full) (nullable): a #GListModel for the series
|
||||
* @time_expression: (transfer full) (nullable): a #GtkExpression for
|
||||
* extracting the time value from @model items.
|
||||
* @duration_expression: (transfer full) (nullable): a #GtkExpression for
|
||||
* extracting the duration value from @model items.
|
||||
*
|
||||
* A #SysprofSeries which contains Time,Duration pairs.
|
||||
*
|
||||
* Returns: (transfer full): a #SysprofSeries
|
||||
*/
|
||||
SysprofSeries *
|
||||
sysprof_time_series_new (const char *title,
|
||||
GListModel *model,
|
||||
GtkExpression *time_expression,
|
||||
GtkExpression *duration_expression)
|
||||
{
|
||||
SysprofTimeSeries *xy;
|
||||
|
||||
xy = g_object_new (SYSPROF_TYPE_TIME_SERIES,
|
||||
"title", title,
|
||||
"model", model,
|
||||
"x-expression", time_expression,
|
||||
"y-expression", duration_expression,
|
||||
NULL);
|
||||
|
||||
g_clear_pointer (&time_expression, gtk_expression_unref);
|
||||
g_clear_pointer (&duration_expression, gtk_expression_unref);
|
||||
g_clear_object (&model);
|
||||
|
||||
return SYSPROF_SERIES (xy);
|
||||
}
|
||||
|
||||
/**
|
||||
* sysprof_time_series_get_time_expression:
|
||||
* @self: a #SysprofTimeSeries
|
||||
*
|
||||
* Gets the #SysprofTimeSeries:x-expression property.
|
||||
*
|
||||
* This is used to extract the X coordinate from items in the #GListModel.
|
||||
*
|
||||
* Returns: (transfer none) (nullable): a #GtkExpression or %NULL
|
||||
*/
|
||||
GtkExpression *
|
||||
sysprof_time_series_get_time_expression (SysprofTimeSeries *self)
|
||||
{
|
||||
g_return_val_if_fail (SYSPROF_IS_TIME_SERIES (self), NULL);
|
||||
|
||||
return self->time_expression;
|
||||
}
|
||||
|
||||
void
|
||||
sysprof_time_series_set_time_expression (SysprofTimeSeries *self,
|
||||
GtkExpression *time_expression)
|
||||
{
|
||||
g_return_if_fail (SYSPROF_IS_TIME_SERIES (self));
|
||||
|
||||
if (self->time_expression == time_expression)
|
||||
return;
|
||||
|
||||
if (time_expression)
|
||||
gtk_expression_ref (time_expression);
|
||||
|
||||
g_clear_pointer (&self->time_expression, gtk_expression_unref);
|
||||
|
||||
self->time_expression = time_expression;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_TIME_EXPRESSION]);
|
||||
}
|
||||
|
||||
/**
|
||||
* sysprof_time_series_get_duration_expression:
|
||||
* @self: a #SysprofTimeSeries
|
||||
*
|
||||
* Gets the #SysprofTimeSeries:y-expression property.
|
||||
*
|
||||
* This is used to extract the Y coordinate from items in the #GListModel.
|
||||
*
|
||||
* Returns: (transfer none) (nullable): a #GtkExpression or %NULL
|
||||
*/
|
||||
GtkExpression *
|
||||
sysprof_time_series_get_duration_expression (SysprofTimeSeries *self)
|
||||
{
|
||||
g_return_val_if_fail (SYSPROF_IS_TIME_SERIES (self), NULL);
|
||||
|
||||
return self->duration_expression;
|
||||
}
|
||||
|
||||
void
|
||||
sysprof_time_series_set_duration_expression (SysprofTimeSeries *self,
|
||||
GtkExpression *duration_expression)
|
||||
{
|
||||
g_return_if_fail (SYSPROF_IS_TIME_SERIES (self));
|
||||
|
||||
if (self->duration_expression == duration_expression)
|
||||
return;
|
||||
|
||||
if (duration_expression)
|
||||
gtk_expression_ref (duration_expression);
|
||||
|
||||
g_clear_pointer (&self->duration_expression, gtk_expression_unref);
|
||||
|
||||
self->duration_expression = duration_expression;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_DURATION_EXPRESSION]);
|
||||
}
|
||||
55
src/libsysprof-gtk/sysprof-time-series.h
Normal file
55
src/libsysprof-gtk/sysprof-time-series.h
Normal file
@ -0,0 +1,55 @@
|
||||
/* sysprof-time-series.h
|
||||
*
|
||||
* Copyright 2023 Christian Hergert <chergert@redhat.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "sysprof-series.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define SYSPROF_TYPE_TIME_SERIES (sysprof_time_series_get_type())
|
||||
#define SYSPROF_IS_TIME_SERIES(obj) (G_TYPE_CHECK_INSTANCE_TYPE(obj, SYSPROF_TYPE_TIME_SERIES))
|
||||
#define SYSPROF_TIME_SERIES(obj) (G_TYPE_CHECK_INSTANCE_CAST(obj, SYSPROF_TYPE_TIME_SERIES, SysprofTimeSeries))
|
||||
#define SYSPROF_TIME_SERIES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST(klass, SYSPROF_TYPE_TIME_SERIES, SysprofTimeSeriesClass))
|
||||
|
||||
typedef struct _SysprofTimeSeries SysprofTimeSeries;
|
||||
typedef struct _SysprofTimeSeriesClass SysprofTimeSeriesClass;
|
||||
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
GType sysprof_time_series_get_type (void) G_GNUC_CONST;
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
SysprofSeries *sysprof_time_series_new (const char *title,
|
||||
GListModel *model,
|
||||
GtkExpression *time_expression,
|
||||
GtkExpression *duration_expression);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
GtkExpression *sysprof_time_series_get_time_expression (SysprofTimeSeries *self);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_time_series_set_time_expression (SysprofTimeSeries *self,
|
||||
GtkExpression *x_expression);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
GtkExpression *sysprof_time_series_get_duration_expression (SysprofTimeSeries *self);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_time_series_set_duration_expression (SysprofTimeSeries *self,
|
||||
GtkExpression *y_expression);
|
||||
|
||||
G_END_DECLS
|
||||
@ -237,19 +237,19 @@ sysprof_xy_series_get_y_expression (SysprofXYSeries *self)
|
||||
|
||||
void
|
||||
sysprof_xy_series_set_y_expression (SysprofXYSeries *self,
|
||||
GtkExpression *x_expression)
|
||||
GtkExpression *y_expression)
|
||||
{
|
||||
g_return_if_fail (SYSPROF_IS_XY_SERIES (self));
|
||||
|
||||
if (self->x_expression == x_expression)
|
||||
if (self->y_expression == y_expression)
|
||||
return;
|
||||
|
||||
if (x_expression)
|
||||
gtk_expression_ref (x_expression);
|
||||
if (y_expression)
|
||||
gtk_expression_ref (y_expression);
|
||||
|
||||
g_clear_pointer (&self->x_expression, gtk_expression_unref);
|
||||
g_clear_pointer (&self->y_expression, gtk_expression_unref);
|
||||
|
||||
self->x_expression = x_expression;
|
||||
self->y_expression = y_expression;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_X_EXPRESSION]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user