Commit 6401e240 authored by Cosimo Cecchi's avatar Cosimo Cecchi

range: use new GtkBoxGadget API instead of removing/inserting

parent 06776d3d
......@@ -662,24 +662,17 @@ gtk_range_sync_orientation (GtkRange *range)
{
GtkRangePrivate *priv = range->priv;
GtkOrientation orientation;
int trough_pos = 0;
orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (range));
_gtk_orientable_set_style_classes (GTK_ORIENTABLE (range));
gtk_box_gadget_set_orientation (GTK_BOX_GADGET (priv->gadget), orientation);
gtk_box_gadget_remove_gadget (GTK_BOX_GADGET (priv->gadget), priv->trough_gadget);
if (priv->stepper_a_gadget)
trough_pos++;
if (priv->stepper_b_gadget)
trough_pos++;
if (orientation == GTK_ORIENTATION_VERTICAL)
gtk_box_gadget_insert_gadget (GTK_BOX_GADGET (priv->gadget), trough_pos,
priv->trough_gadget, FALSE, TRUE, GTK_ALIGN_CENTER);
gtk_box_gadget_set_gadget_expand (GTK_BOX_GADGET (priv->gadget),
priv->trough_gadget, FALSE, TRUE);
else
gtk_box_gadget_insert_gadget (GTK_BOX_GADGET (priv->gadget), trough_pos,
priv->trough_gadget, TRUE, FALSE, GTK_ALIGN_CENTER);
gtk_box_gadget_set_gadget_expand (GTK_BOX_GADGET (priv->gadget),
priv->trough_gadget, TRUE, FALSE);
}
static void
......@@ -807,6 +800,8 @@ gtk_range_init (GtkRange *range)
priv->fill_level = G_MAXDOUBLE;
priv->timer = NULL;
_gtk_orientable_set_style_classes (GTK_ORIENTABLE (range));
widget_node = gtk_widget_get_css_node (GTK_WIDGET (range));
priv->gadget = gtk_box_gadget_new_for_node (widget_node, GTK_WIDGET (range));
......@@ -819,7 +814,8 @@ gtk_range_init (GtkRange *range)
NULL, NULL);
gtk_css_gadget_set_state (priv->trough_gadget,
gtk_css_node_get_state (widget_node));
gtk_range_sync_orientation (range);
gtk_box_gadget_insert_gadget (GTK_BOX_GADGET (priv->gadget), -1, priv->trough_gadget,
TRUE, FALSE, GTK_ALIGN_CENTER);
priv->slider_gadget = gtk_builtin_icon_new ("slider",
GTK_WIDGET (range),
......
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