Commit ea4cff1e authored by Matthias Clasen's avatar Matthias Clasen

Use convenience API that was introduced recently

Use gtk_css_gadget_set_state in all the places where we previously
were getting a node from a gadget, just to call gtk_css_node_set_state.
parent 64b499be
......@@ -156,10 +156,11 @@ gtk_check_button_update_node_state (GtkWidget *widget)
else
image_type = GTK_IS_RADIO_BUTTON (widget) ? GTK_CSS_IMAGE_BUILTIN_OPTION : GTK_CSS_IMAGE_BUILTIN_CHECK;
gtk_builtin_icon_set_image (GTK_BUILTIN_ICON (priv->indicator_gadget), image_type);
gtk_css_node_set_state (gtk_css_gadget_get_node (priv->indicator_gadget), state);
gtk_css_gadget_set_state (priv->indicator_gadget, state);
}
static void
gtk_check_button_state_flags_changed (GtkWidget *widget,
GtkStateFlags previous_state_flags)
......
......@@ -486,8 +486,7 @@ update_node_state (GtkCheckMenuItem *check_menu_item)
if (priv->active)
state |= GTK_STATE_FLAG_CHECKED;
gtk_css_node_set_state (gtk_css_gadget_get_node (priv->indicator_gadget),
state);
gtk_css_gadget_set_state (priv->indicator_gadget, state);
}
/**
......
......@@ -578,8 +578,8 @@ swatch_state_flags_changed (GtkWidget *widget,
{
GtkColorSwatch *swatch = GTK_COLOR_SWATCH (widget);
gtk_css_node_set_state (gtk_css_gadget_get_node (swatch->priv->gadget), gtk_widget_get_state_flags (widget));
gtk_css_node_set_state (gtk_css_gadget_get_node (swatch->priv->overlay_gadget), gtk_widget_get_state_flags (widget));
gtk_css_gadget_set_state (swatch->priv->gadget, gtk_widget_get_state_flags (widget));
gtk_css_gadget_set_state (swatch->priv->overlay_gadget, gtk_widget_get_state_flags (widget));
update_icon (swatch);
......
......@@ -3194,7 +3194,7 @@ update_icon_state (GtkWidget *widget,
else if (icon_info->prelight)
state |= GTK_STATE_FLAG_PRELIGHT;
gtk_css_node_set_state (gtk_css_gadget_get_node (icon_info->gadget), state);
gtk_css_gadget_set_state (icon_info->gadget, state);
}
static void
......
......@@ -957,14 +957,14 @@ update_node_state (GtkExpander *expander)
else
state &= ~GTK_STATE_FLAG_PRELIGHT;
gtk_css_node_set_state (gtk_css_gadget_get_node (priv->title_gadget), state);
gtk_css_gadget_set_state (priv->title_gadget, state);
if (priv->expanded)
state |= GTK_STATE_FLAG_CHECKED;
else
state &= ~GTK_STATE_FLAG_CHECKED;
gtk_css_node_set_state (gtk_css_gadget_get_node (priv->arrow_gadget), state);
gtk_css_gadget_set_state (priv->arrow_gadget, state);
}
static void
......
......@@ -1023,10 +1023,7 @@ static void
gtk_frame_state_flags_changed (GtkWidget *widget,
GtkStateFlags previous_state)
{
GtkCssNode *border_node;
border_node = gtk_css_gadget_get_node (GTK_FRAME (widget)->priv->border_gadget);
gtk_css_node_set_state (border_node, gtk_widget_get_state_flags (widget));
gtk_css_gadget_set_state (GTK_FRAME (widget)->priv->border_gadget, gtk_widget_get_state_flags (widget));
GTK_WIDGET_CLASS (gtk_frame_parent_class)->state_flags_changed (widget, previous_state);
}
......@@ -579,8 +579,7 @@ update_block_nodes (GtkLevelBar *self)
NULL,
NULL, NULL, NULL,
NULL, NULL);
gtk_css_node_set_state (gtk_css_gadget_get_node (priv->block_gadget[i]),
gtk_css_node_get_state (trough_node));
gtk_css_gadget_set_state (priv->block_gadget[i], gtk_css_node_get_state (trough_node));
}
priv->n_blocks = n_blocks;
}
......@@ -616,9 +615,9 @@ gtk_level_bar_state_flags_changed (GtkWidget *widget,
state = gtk_widget_get_state_flags (widget);
gtk_css_node_set_state (gtk_css_gadget_get_node (priv->trough_gadget), state);
gtk_css_gadget_set_state (priv->trough_gadget, state);
for (i = 0; i < priv->n_blocks; i++)
gtk_css_node_set_state (gtk_css_gadget_get_node (priv->block_gadget[i]), state);
gtk_css_gadget_set_state (priv->block_gadget[i], state);
GTK_WIDGET_CLASS (gtk_level_bar_parent_class)->state_flags_changed (widget, previous_state);
}
......
......@@ -3695,8 +3695,7 @@ gtk_menu_handle_scrolling (GtkMenu *menu,
if (arrow_state != priv->upper_arrow_state)
{
priv->upper_arrow_state = arrow_state;
gtk_css_node_set_state (gtk_css_gadget_get_node (priv->top_arrow_gadget),
arrow_state);
gtk_css_gadget_set_state (priv->top_arrow_gadget, arrow_state);
gdk_window_invalidate_rect (gtk_widget_get_window (GTK_WIDGET (menu)),
&rect, FALSE);
......@@ -3770,8 +3769,7 @@ gtk_menu_handle_scrolling (GtkMenu *menu,
if (arrow_state != priv->lower_arrow_state)
{
priv->lower_arrow_state = arrow_state;
gtk_css_node_set_state (gtk_css_gadget_get_node (priv->bottom_arrow_gadget),
arrow_state);
gtk_css_gadget_set_state (priv->bottom_arrow_gadget, arrow_state);
gdk_window_invalidate_rect (gtk_widget_get_window (GTK_WIDGET (menu)),
&rect, FALSE);
......
......@@ -201,7 +201,7 @@ gtk_model_button_update_state (GtkModelButton *button)
state = gtk_widget_get_state_flags (GTK_WIDGET (button));
gtk_css_node_set_state (gtk_css_gadget_get_node (button->gadget), state);
gtk_css_gadget_set_state (button->gadget, state);
if (button->role == GTK_BUTTON_ROLE_CHECK)
{
......@@ -239,7 +239,7 @@ gtk_model_button_update_state (GtkModelButton *button)
}
gtk_builtin_icon_set_image (GTK_BUILTIN_ICON (button->indicator_gadget), image_type);
gtk_css_node_set_state (gtk_css_gadget_get_node (button->indicator_gadget), state);
gtk_css_gadget_set_state (button->indicator_gadget, state);
}
static void
......
......@@ -505,11 +505,11 @@ update_node_state (GtkProgressBar *pbar)
state = gtk_widget_get_state_flags (GTK_WIDGET (pbar));
gtk_css_node_set_state (gtk_css_gadget_get_node (priv->gadget), state);
gtk_css_node_set_state (gtk_css_gadget_get_node (priv->trough_gadget), state);
gtk_css_node_set_state (gtk_css_gadget_get_node (priv->progress_gadget), state);
gtk_css_gadget_set_state (priv->gadget, state);
gtk_css_gadget_set_state (priv->trough_gadget, state);
gtk_css_gadget_set_state (priv->progress_gadget, state);
if (priv->text_gadget)
gtk_css_node_set_state (gtk_css_gadget_get_node (priv->text_gadget), state);
gtk_css_gadget_set_state (priv->text_gadget, state);
}
static void
......
......@@ -956,10 +956,8 @@ update_node_state (GtkSpinButton *spin_button)
{
GtkSpinButtonPrivate *priv = spin_button->priv;
gtk_css_node_set_state (gtk_css_gadget_get_node (priv->up_button),
gtk_spin_button_panel_get_state (spin_button, UP_PANEL));
gtk_css_node_set_state (gtk_css_gadget_get_node (priv->down_button),
gtk_spin_button_panel_get_state (spin_button, DOWN_PANEL));
gtk_css_gadget_set_state (priv->up_button, gtk_spin_button_panel_get_state (spin_button, UP_PANEL));
gtk_css_gadget_set_state (priv->down_button, gtk_spin_button_panel_get_state (spin_button, DOWN_PANEL));
}
static void
......
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