Commit 971f1a9b authored by Cosimo Cecchi's avatar Cosimo Cecchi

levelbar: split out a function

parent feb741ba
......@@ -305,6 +305,16 @@ gtk_level_bar_get_num_blocks (GtkLevelBar *self)
return 0;
}
static gboolean
gtk_level_bar_get_real_inverted (GtkLevelBar *self)
{
if (gtk_widget_get_direction (GTK_WIDGET (self)) == GTK_TEXT_DIR_RTL &&
self->priv->orientation == GTK_ORIENTATION_HORIZONTAL)
return !self->priv->inverted;
return self->priv->inverted;
}
static void
gtk_level_bar_get_borders (GtkLevelBar *self,
GtkBorder *borders_out)
......@@ -342,14 +352,8 @@ gtk_level_bar_draw_fill_continuous (GtkLevelBar *self,
gdouble fill_percentage;
gboolean inverted;
inverted = self->priv->inverted;
if (gtk_widget_get_direction (GTK_WIDGET (self)) == GTK_TEXT_DIR_RTL)
{
if (self->priv->orientation == GTK_ORIENTATION_HORIZONTAL)
inverted = !inverted;
}
context = gtk_widget_get_style_context (widget);
inverted = gtk_level_bar_get_real_inverted (self);
/* render the empty (unfilled) part */
gtk_style_context_save_to_node (context, self->priv->block_node[inverted ? 0 : 1]);
......@@ -696,10 +700,7 @@ update_level_style_classes (GtkLevelBar *self)
gint num_filled, num_blocks, i;
gboolean inverted;
inverted = priv->inverted;
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL &&
gtk_widget_get_direction (GTK_WIDGET (self)) == GTK_TEXT_DIR_RTL)
inverted = !inverted;
inverted = gtk_level_bar_get_real_inverted (self);
if (priv->bar_mode == GTK_LEVEL_BAR_MODE_CONTINUOUS)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment