mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-07 03:10:07 +00:00
levelbar: split out a function
This commit is contained in:
parent
feb741babf
commit
971f1a9b31
@ -305,6 +305,16 @@ gtk_level_bar_get_num_blocks (GtkLevelBar *self)
|
|||||||
return 0;
|
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
|
static void
|
||||||
gtk_level_bar_get_borders (GtkLevelBar *self,
|
gtk_level_bar_get_borders (GtkLevelBar *self,
|
||||||
GtkBorder *borders_out)
|
GtkBorder *borders_out)
|
||||||
@ -342,14 +352,8 @@ gtk_level_bar_draw_fill_continuous (GtkLevelBar *self,
|
|||||||
gdouble fill_percentage;
|
gdouble fill_percentage;
|
||||||
gboolean inverted;
|
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);
|
context = gtk_widget_get_style_context (widget);
|
||||||
|
inverted = gtk_level_bar_get_real_inverted (self);
|
||||||
|
|
||||||
/* render the empty (unfilled) part */
|
/* render the empty (unfilled) part */
|
||||||
gtk_style_context_save_to_node (context, self->priv->block_node[inverted ? 0 : 1]);
|
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;
|
gint num_filled, num_blocks, i;
|
||||||
gboolean inverted;
|
gboolean inverted;
|
||||||
|
|
||||||
inverted = priv->inverted;
|
inverted = gtk_level_bar_get_real_inverted (self);
|
||||||
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL &&
|
|
||||||
gtk_widget_get_direction (GTK_WIDGET (self)) == GTK_TEXT_DIR_RTL)
|
|
||||||
inverted = !inverted;
|
|
||||||
|
|
||||||
if (priv->bar_mode == GTK_LEVEL_BAR_MODE_CONTINUOUS)
|
if (priv->bar_mode == GTK_LEVEL_BAR_MODE_CONTINUOUS)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user