mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-12 16:10:54 +00:00
sysprof: add helper to get category color
This commit is contained in:
@ -168,3 +168,17 @@ sysprof_category_icon_set_category (SysprofCategoryIcon *self,
|
|||||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_CATEGORY]);
|
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_CATEGORY]);
|
||||||
gtk_widget_queue_draw (GTK_WIDGET (self));
|
gtk_widget_queue_draw (GTK_WIDGET (self));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const GdkRGBA *
|
||||||
|
sysprof_callgraph_category_get_color (SysprofCallgraphCategory category)
|
||||||
|
{
|
||||||
|
static GdkRGBA gray;
|
||||||
|
|
||||||
|
if (category < G_N_ELEMENTS (category_colors) && category_colors[category].alpha > 0)
|
||||||
|
return &category_colors[category];
|
||||||
|
|
||||||
|
if (gray.alpha == 0)
|
||||||
|
gdk_rgba_parse (&gray, "#77767b");
|
||||||
|
|
||||||
|
return &gray;
|
||||||
|
}
|
||||||
|
|||||||
@ -34,4 +34,6 @@ SysprofCallgraphCategory sysprof_category_icon_get_category (SysprofCategoryIcon
|
|||||||
void sysprof_category_icon_set_category (SysprofCategoryIcon *self,
|
void sysprof_category_icon_set_category (SysprofCategoryIcon *self,
|
||||||
SysprofCallgraphCategory category);
|
SysprofCallgraphCategory category);
|
||||||
|
|
||||||
|
const GdkRGBA *sysprof_callgraph_category_get_color (SysprofCallgraphCategory category);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|||||||
Reference in New Issue
Block a user