mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-12 16:10:54 +00:00
libsysprof-ui: fix initial rendering of zeros
This commit is contained in:
@ -92,6 +92,7 @@ sysprof_cell_renderer_percent_class_init (SysprofCellRendererPercentClass *klass
|
|||||||
0.0,
|
0.0,
|
||||||
100.0,
|
100.0,
|
||||||
0.0,
|
0.0,
|
||||||
|
/* Doesn't notify to avoid signal emission */
|
||||||
(G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));
|
(G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
g_object_class_install_properties (object_class, N_PROPS, properties);
|
g_object_class_install_properties (object_class, N_PROPS, properties);
|
||||||
@ -118,25 +119,19 @@ sysprof_cell_renderer_percent_set_percent (SysprofCellRendererPercent *self,
|
|||||||
gdouble percent)
|
gdouble percent)
|
||||||
{
|
{
|
||||||
SysprofCellRendererPercentPrivate *priv = sysprof_cell_renderer_percent_get_instance_private (self);
|
SysprofCellRendererPercentPrivate *priv = sysprof_cell_renderer_percent_get_instance_private (self);
|
||||||
|
gchar text[8];
|
||||||
|
|
||||||
g_return_if_fail (SYSPROF_IS_CELL_RENDERER_PERCENT (self));
|
g_return_if_fail (SYSPROF_IS_CELL_RENDERER_PERCENT (self));
|
||||||
g_return_if_fail (percent >= 0.0);
|
g_return_if_fail (percent >= 0.0);
|
||||||
g_return_if_fail (percent <= 100.0);
|
g_return_if_fail (percent <= 100.0);
|
||||||
|
|
||||||
if (percent != priv->percent)
|
priv->percent = percent;
|
||||||
{
|
|
||||||
gchar text[8];
|
|
||||||
|
|
||||||
priv->percent = percent;
|
g_snprintf (text, sizeof text, "%.2lf%%", percent);
|
||||||
|
text [sizeof text - 1] = '\0';
|
||||||
|
|
||||||
g_snprintf (text, sizeof text, "%.2lf%%", percent);
|
g_object_set (self,
|
||||||
text [sizeof text - 1] = '\0';
|
"value", (guint)percent,
|
||||||
|
"text", text,
|
||||||
g_object_set (self,
|
NULL);
|
||||||
"value", (guint)percent,
|
|
||||||
"text", text,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_PERCENT]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user