mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-12 16:10:54 +00:00
cellrendererduration: port to GTK 4
This commit is contained in:
@ -104,37 +104,38 @@ rounded_rectangle (cairo_t *cr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sysprof_cell_renderer_duration_render (GtkCellRenderer *renderer,
|
sysprof_cell_renderer_duration_snapshot (GtkCellRenderer *renderer,
|
||||||
cairo_t *cr,
|
GtkSnapshot *snapshot,
|
||||||
GtkWidget *widget,
|
GtkWidget *widget,
|
||||||
const GdkRectangle *bg_area,
|
const GdkRectangle *bg_area,
|
||||||
const GdkRectangle *cell_area,
|
const GdkRectangle *cell_area,
|
||||||
GtkCellRendererState state)
|
GtkCellRendererState state)
|
||||||
{
|
{
|
||||||
SysprofCellRendererDuration *self = (SysprofCellRendererDuration *)renderer;
|
SysprofCellRendererDuration *self = (SysprofCellRendererDuration *)renderer;
|
||||||
SysprofCellRendererDurationPrivate *priv = sysprof_cell_renderer_duration_get_instance_private (self);
|
SysprofCellRendererDurationPrivate *priv = sysprof_cell_renderer_duration_get_instance_private (self);
|
||||||
g_autoptr(GString) str = NULL;
|
g_autoptr(GString) str = NULL;
|
||||||
GtkStyleContext *style_context;
|
GtkStyleContext *style_context;
|
||||||
|
cairo_t *cr;
|
||||||
gdouble x1, x2;
|
gdouble x1, x2;
|
||||||
GdkRGBA rgba;
|
GdkRGBA rgba;
|
||||||
GdkRectangle r;
|
GdkRectangle r;
|
||||||
gint64 duration;
|
gint64 duration;
|
||||||
|
|
||||||
g_assert (SYSPROF_IS_CELL_RENDERER_DURATION (self));
|
g_assert (SYSPROF_IS_CELL_RENDERER_DURATION (self));
|
||||||
g_assert (cr != NULL);
|
g_assert (snapshot != NULL);
|
||||||
g_assert (GTK_IS_WIDGET (widget));
|
g_assert (GTK_IS_WIDGET (widget));
|
||||||
|
|
||||||
if (priv->zoom_manager == NULL)
|
if (priv->zoom_manager == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
cr = gtk_snapshot_append_cairo (snapshot, &GRAPHENE_RECT_INIT (cell_area->x, cell_area->y, cell_area->width, cell_area->height));
|
||||||
|
|
||||||
style_context = gtk_widget_get_style_context (widget);
|
style_context = gtk_widget_get_style_context (widget);
|
||||||
|
|
||||||
if (priv->color_set)
|
if (priv->color_set)
|
||||||
rgba = priv->color;
|
rgba = priv->color;
|
||||||
else
|
else
|
||||||
gtk_style_context_get_color (style_context,
|
gtk_style_context_get_color (style_context, &rgba);
|
||||||
gtk_style_context_get_state (style_context),
|
|
||||||
&rgba);
|
|
||||||
|
|
||||||
duration = sysprof_zoom_manager_get_duration_for_width (priv->zoom_manager, bg_area->width);
|
duration = sysprof_zoom_manager_get_duration_for_width (priv->zoom_manager, bg_area->width);
|
||||||
|
|
||||||
@ -214,6 +215,8 @@ sysprof_cell_renderer_duration_render (GtkCellRenderer *renderer,
|
|||||||
|
|
||||||
g_object_unref (layout);
|
g_object_unref (layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cairo_destroy (cr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GtkSizeRequestMode
|
static GtkSizeRequestMode
|
||||||
@ -390,7 +393,7 @@ sysprof_cell_renderer_duration_class_init (SysprofCellRendererDurationClass *kla
|
|||||||
cell_class->get_preferred_height_for_width = sysprof_cell_renderer_duration_get_preferred_height_for_width;
|
cell_class->get_preferred_height_for_width = sysprof_cell_renderer_duration_get_preferred_height_for_width;
|
||||||
cell_class->get_preferred_width = sysprof_cell_renderer_duration_get_preferred_width;
|
cell_class->get_preferred_width = sysprof_cell_renderer_duration_get_preferred_width;
|
||||||
cell_class->get_request_mode = sysprof_cell_renderer_duration_get_request_mode;
|
cell_class->get_request_mode = sysprof_cell_renderer_duration_get_request_mode;
|
||||||
cell_class->render = sysprof_cell_renderer_duration_render;
|
cell_class->snapshot = sysprof_cell_renderer_duration_snapshot;
|
||||||
|
|
||||||
/* Note we do not emit ::notify() for these properties */
|
/* Note we do not emit ::notify() for these properties */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user