mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
line-visualizer-row: add color parameter for counter
Allow specifying a color for a counter that is added to the visualizer.
This commit is contained in:
@ -584,7 +584,8 @@ sp_line_visualizer_row_init (SpLineVisualizerRow *self)
|
||||
|
||||
void
|
||||
sp_line_visualizer_row_add_counter (SpLineVisualizerRow *self,
|
||||
guint counter_id)
|
||||
guint counter_id,
|
||||
const GdkRGBA *color)
|
||||
{
|
||||
SpLineVisualizerRowPrivate *priv = sp_line_visualizer_row_get_instance_private (self);
|
||||
LineInfo line_info = { 0 };
|
||||
@ -593,9 +594,18 @@ sp_line_visualizer_row_add_counter (SpLineVisualizerRow *self,
|
||||
g_assert (priv->lines != NULL);
|
||||
|
||||
line_info.id = counter_id;
|
||||
line_info.use_default_style = TRUE;
|
||||
line_info.line_width = 1.0;
|
||||
|
||||
if (color != NULL)
|
||||
{
|
||||
line_info.foreground = *color;
|
||||
line_info.use_default_style = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
line_info.use_default_style = TRUE;
|
||||
}
|
||||
|
||||
g_array_append_val (priv->lines, line_info);
|
||||
|
||||
if (SP_LINE_VISUALIZER_ROW_GET_CLASS (self)->counter_added)
|
||||
|
||||
@ -55,7 +55,8 @@ struct _SpLineVisualizerRowClass
|
||||
GtkWidget *sp_line_visualizer_row_new (void);
|
||||
void sp_line_visualizer_row_clear (SpLineVisualizerRow *self);
|
||||
void sp_line_visualizer_row_add_counter (SpLineVisualizerRow *self,
|
||||
guint counter_id);
|
||||
guint counter_id,
|
||||
const GdkRGBA *color);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
Reference in New Issue
Block a user