[gtk/wip/baedert/for-master: 11/38] Start using GtkWidget's new style class API
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/baedert/for-master: 11/38] Start using GtkWidget's new style class API
- Date: Thu, 6 Feb 2020 16:05:01 +0000 (UTC)
commit ef5050c24d5ad7eab942fb8996a65694a2c2cd03
Author: Timm Bäder <mail baedert org>
Date: Wed Jan 29 12:11:39 2020 +0100
Start using GtkWidget's new style class API
gtk/gtkappchooserdialog.c | 4 +--
gtk/gtkbutton.c | 26 +++++----------
gtk/gtkcalendar.c | 7 ++--
gtk/gtkcheckbutton.c | 3 +-
gtk/gtkcolorbutton.c | 4 +--
gtk/gtkcolorchooserwidget.c | 14 ++++----
gtk/gtkcoloreditor.c | 8 ++---
gtk/gtkcolorscale.c | 4 +--
gtk/gtkcolorswatch.c | 14 ++++----
gtk/gtkcombobox.c | 10 ++----
gtk/gtkdialog.c | 7 ++--
gtk/gtkemojichooser.c | 2 +-
gtk/gtkentry.c | 21 ++++--------
gtk/gtkentrycompletion.c | 2 +-
gtk/gtkexpander.c | 3 +-
gtk/gtkfontbutton.c | 4 +--
gtk/gtkframe.c | 6 ++--
gtk/gtkheaderbar.c | 51 ++++++++++++-----------------
gtk/gtkiconview.c | 3 +-
gtk/gtkinfobar.c | 13 +++-----
gtk/gtklabel.c | 15 ++++++---
gtk/gtklevelbar.c | 23 ++++---------
gtk/gtklinkbutton.c | 4 +--
gtk/gtklistbox.c | 13 +++-----
gtk/gtklockbutton.c | 4 +--
gtk/gtkmenubutton.c | 4 +--
gtk/gtkmenusectionbox.c | 14 ++++----
gtk/gtkmessagedialog.c | 2 +-
gtk/gtkmodelbutton.c | 79 +++++++++++++++++++--------------------------
gtk/gtknotebook.c | 35 ++++++++------------
gtk/gtkorientable.c | 10 +++---
gtk/gtkoverlaylayout.c | 31 +++++++++---------
gtk/gtkpaned.c | 9 ++----
gtk/gtkpasswordentry.c | 4 +--
gtk/gtkpathbar.c | 15 +++------
gtk/gtkplacessidebar.c | 16 +++------
gtk/gtkplacesview.c | 10 +++---
gtk/gtkpopovermenu.c | 5 +--
gtk/gtkprogressbar.c | 37 +++++++++------------
gtk/gtkrange.c | 39 +++++++---------------
gtk/gtkscale.c | 39 +++++++++-------------
gtk/gtkscalebutton.c | 4 +--
gtk/gtkscrolledwindow.c | 42 +++++++++---------------
gtk/gtksearchbar.c | 2 +-
gtk/gtksearchentry.c | 2 +-
gtk/gtkseparatortoolitem.c | 12 ++-----
gtk/gtkshortcutlabel.c | 4 +--
gtk/gtkshortcutssection.c | 7 ++--
gtk/gtkshortcutswindow.c | 10 +++---
gtk/gtksidebarrow.c | 4 +--
gtk/gtkspinbutton.c | 4 +--
gtk/gtkstacksidebar.c | 10 ++----
gtk/gtkstackswitcher.c | 20 ++++--------
gtk/gtktext.c | 15 ++++-----
gtk/gtktextview.c | 29 ++++++-----------
gtk/gtktogglebutton.c | 4 +--
gtk/gtktoolbutton.c | 17 +++++-----
gtk/gtktreepopover.c | 10 +++---
gtk/gtktreeview.c | 3 +-
gtk/gtkviewport.c | 16 +++------
gtk/gtkwidget.c | 12 ++-----
gtk/gtkwindow.c | 55 ++++++++++++-------------------
62 files changed, 340 insertions(+), 556 deletions(-)
---
diff --git a/gtk/gtkappchooserdialog.c b/gtk/gtkappchooserdialog.c
index cc512bdbeb..99186df153 100644
--- a/gtk/gtkappchooserdialog.c
+++ b/gtk/gtkappchooserdialog.c
@@ -452,8 +452,8 @@ setup_search (GtkAppChooserDialog *self)
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
image = gtk_image_new_from_icon_name ("edit-find-symbolic");
gtk_container_add (GTK_CONTAINER (button), image);
- gtk_style_context_add_class (gtk_widget_get_style_context (button), "image-button");
- gtk_style_context_remove_class (gtk_widget_get_style_context (button), "text-button");
+ gtk_widget_add_style_class (button, "image-button");
+ gtk_widget_remove_style_class (button, "text-button");
header = gtk_dialog_get_header_bar (GTK_DIALOG (self));
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index 6fcc605b08..756e40ea02 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -654,9 +654,8 @@ gtk_button_new_with_mnemonic (const gchar *label)
*/
void
gtk_button_set_relief (GtkButton *button,
- GtkReliefStyle relief)
+ GtkReliefStyle relief)
{
- GtkStyleContext *context;
GtkReliefStyle old_relief;
g_return_if_fail (GTK_IS_BUTTON (button));
@@ -664,11 +663,10 @@ gtk_button_set_relief (GtkButton *button,
old_relief = gtk_button_get_relief (button);
if (old_relief != relief)
{
- context = gtk_widget_get_style_context (GTK_WIDGET (button));
if (relief == GTK_RELIEF_NONE)
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_FLAT);
+ gtk_widget_add_style_class (GTK_WIDGET (button), GTK_STYLE_CLASS_FLAT);
else
- gtk_style_context_remove_class (context, GTK_STYLE_CLASS_FLAT);
+ gtk_widget_remove_style_class (GTK_WIDGET (button), GTK_STYLE_CLASS_FLAT);
g_object_notify_by_pspec (G_OBJECT (button), props[PROP_RELIEF]);
}
@@ -685,12 +683,9 @@ gtk_button_set_relief (GtkButton *button,
GtkReliefStyle
gtk_button_get_relief (GtkButton *button)
{
- GtkStyleContext *context;
-
g_return_val_if_fail (GTK_IS_BUTTON (button), GTK_RELIEF_NORMAL);
- context = gtk_widget_get_style_context (GTK_WIDGET (button));
- if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_FLAT))
+ if (gtk_widget_has_style_class (GTK_WIDGET (button), GTK_STYLE_CLASS_FLAT))
return GTK_RELIEF_NONE;
else
return GTK_RELIEF_NORMAL;
@@ -787,12 +782,9 @@ gtk_button_set_label (GtkButton *button,
{
GtkButtonPrivate *priv = gtk_button_get_instance_private (button);
GtkWidget *child;
- GtkStyleContext *context;
g_return_if_fail (GTK_IS_BUTTON (button));
- context = gtk_widget_get_style_context (GTK_WIDGET (button));
-
child = gtk_bin_get_child (GTK_BIN (button));
if (priv->child_type != LABEL_CHILD || child == NULL)
@@ -811,8 +803,8 @@ gtk_button_set_label (GtkButton *button,
gtk_label_set_xalign (GTK_LABEL (child), 0.0);
}
gtk_container_add (GTK_CONTAINER (button), child);
- gtk_style_context_remove_class (context, "image-button");
- gtk_style_context_add_class (context, "text-button");
+ gtk_widget_remove_style_class (GTK_WIDGET (button), "image-button");
+ gtk_widget_add_style_class (GTK_WIDGET (button), "text-button");
}
gtk_label_set_label (GTK_LABEL (child), label);
@@ -944,13 +936,11 @@ gtk_button_set_icon_name (GtkButton *button,
{
GtkButtonPrivate *priv = gtk_button_get_instance_private (button);
GtkWidget *child;
- GtkStyleContext *context;
g_return_if_fail (GTK_IS_BUTTON (button));
g_return_if_fail (icon_name != NULL);
child = gtk_bin_get_child (GTK_BIN (button));
- context = gtk_widget_get_style_context (GTK_WIDGET (button));
if (priv->child_type != ICON_CHILD || child == NULL)
{
@@ -959,8 +949,8 @@ gtk_button_set_icon_name (GtkButton *button,
child = gtk_image_new_from_icon_name (icon_name);
gtk_container_add (GTK_CONTAINER (button), child);
- gtk_style_context_remove_class (context, "text-button");
- gtk_style_context_add_class (context, "image-button");
+ gtk_widget_remove_style_class (GTK_WIDGET (button), "text-button");
+ gtk_widget_add_style_class (GTK_WIDGET (button), "image-button");
}
else
{
diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c
index d59e606ee9..d7e72535d2 100644
--- a/gtk/gtkcalendar.c
+++ b/gtk/gtkcalendar.c
@@ -743,16 +743,15 @@ gtk_calendar_init (GtkCalendar *calendar)
gtk_widget_set_can_focus (widget, TRUE);
- gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (calendar)),
- GTK_STYLE_CLASS_VIEW);
+ gtk_widget_add_style_class (GTK_WIDGET (calendar), GTK_STYLE_CLASS_VIEW);
priv->header_box = g_object_new (GTK_TYPE_BOX,
"css-name", "header",
NULL);
priv->year_label = gtk_label_new ("");
- gtk_style_context_add_class (gtk_widget_get_style_context (priv->year_label), "year");
+ gtk_widget_add_style_class (priv->year_label, "year");
priv->month_name_stack = gtk_stack_new ();
- gtk_style_context_add_class (gtk_widget_get_style_context (priv->month_name_stack), "month");
+ gtk_widget_add_style_class (priv->month_name_stack, "month");
priv->arrow_widgets[0] = gtk_button_new_from_icon_name ("pan-start-symbolic");
g_signal_connect_swapped (priv->arrow_widgets[0], "clicked", G_CALLBACK (calendar_set_month_prev),
calendar);
priv->arrow_widgets[1] = gtk_button_new_from_icon_name ("pan-end-symbolic");
diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c
index ac3d8c9e6f..a6790ca1af 100644
--- a/gtk/gtkcheckbutton.c
+++ b/gtk/gtkcheckbutton.c
@@ -393,10 +393,9 @@ gtk_check_button_init (GtkCheckButton *check_button)
{
GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (check_button);
-
gtk_widget_set_receives_default (GTK_WIDGET (check_button), FALSE);
- gtk_style_context_remove_class (gtk_widget_get_style_context (GTK_WIDGET (check_button)), "toggle");
+ gtk_widget_remove_style_class (GTK_WIDGET (check_button), "toggle");
priv->draw_indicator = TRUE;
draw_indicator_changed (check_button);
diff --git a/gtk/gtkcolorbutton.c b/gtk/gtkcolorbutton.c
index 19759ff8e4..13908fc957 100644
--- a/gtk/gtkcolorbutton.c
+++ b/gtk/gtkcolorbutton.c
@@ -299,7 +299,6 @@ gtk_color_button_init (GtkColorButton *button)
GtkColorButtonPrivate *priv = gtk_color_button_get_instance_private (button);
PangoLayout *layout;
PangoRectangle rect;
- GtkStyleContext *context;
GdkContentFormats *targets;
GdkContentProvider *content;
GtkDragSource *source;
@@ -340,8 +339,7 @@ gtk_color_button_init (GtkColorButton *button)
g_signal_connect (source, "drag-begin", G_CALLBACK (gtk_color_button_drag_begin), button);
gtk_widget_add_controller (priv->button, GTK_EVENT_CONTROLLER (source));
- context = gtk_widget_get_style_context (GTK_WIDGET (priv->button));
- gtk_style_context_add_class (context, "color");
+ gtk_widget_add_style_class (priv->button, "color");
}
static void
diff --git a/gtk/gtkcolorchooserwidget.c b/gtk/gtkcolorchooserwidget.c
index a9c4f12962..689cc150e5 100644
--- a/gtk/gtkcolorchooserwidget.c
+++ b/gtk/gtkcolorchooserwidget.c
@@ -376,19 +376,19 @@ add_palette (GtkColorChooserWidget *cc,
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
- if (pos == left)
- gtk_style_context_add_class (gtk_widget_get_style_context (p), GTK_STYLE_CLASS_LEFT);
- else if (pos == right)
- gtk_style_context_add_class (gtk_widget_get_style_context (p), GTK_STYLE_CLASS_RIGHT);
+ if (pos == left)
+ gtk_widget_add_style_class (p, GTK_STYLE_CLASS_LEFT);
+ else if (pos == right)
+ gtk_widget_add_style_class (p, GTK_STYLE_CLASS_RIGHT);
- gtk_grid_attach (GTK_GRID (grid), p, pos, line, 1, 1);
+ gtk_grid_attach (GTK_GRID (grid), p, pos, line, 1, 1);
}
else
{
if (pos == 0)
- gtk_style_context_add_class (gtk_widget_get_style_context (p), GTK_STYLE_CLASS_TOP);
+ gtk_widget_add_style_class (p, GTK_STYLE_CLASS_TOP);
else if (pos == colors_per_line - 1)
- gtk_style_context_add_class (gtk_widget_get_style_context (p), GTK_STYLE_CLASS_BOTTOM);
+ gtk_widget_add_style_class (p, GTK_STYLE_CLASS_BOTTOM);
gtk_grid_attach (GTK_GRID (grid), p, line, pos, 1, 1);
}
diff --git a/gtk/gtkcoloreditor.c b/gtk/gtkcoloreditor.c
index d9665a7c52..0b21551c48 100644
--- a/gtk/gtkcoloreditor.c
+++ b/gtk/gtkcoloreditor.c
@@ -386,11 +386,9 @@ gtk_color_editor_init (GtkColorEditor *editor)
gtk_widget_init_template (GTK_WIDGET (editor));
if (gtk_widget_get_direction (editor->priv->h_slider) == GTK_TEXT_DIR_RTL)
- gtk_style_context_add_class (gtk_widget_get_style_context (editor->priv->h_slider),
- "marks-before");
+ gtk_widget_add_style_class (editor->priv->h_slider, "marks-before");
else
- gtk_style_context_add_class (gtk_widget_get_style_context (editor->priv->h_slider),
- "marks-after");
+ gtk_widget_add_style_class (editor->priv->h_slider, "marks-after");
/* Create the scaled popup adjustments manually here because connecting user data is not
* supported by template GtkBuilder xml (it would be possible to set this up in the xml
@@ -419,7 +417,7 @@ gtk_color_editor_init (GtkColorEditor *editor)
g_signal_connect (controller, "key-pressed", G_CALLBACK (popup_key_pressed), editor);
gtk_widget_add_controller (editor->priv->a_entry, controller);
- gtk_style_context_remove_class (gtk_widget_get_style_context (editor->priv->swatch), "activatable");
+ gtk_widget_remove_style_class (editor->priv->swatch, "activatable");
editor->priv->picker = gtk_color_picker_new ();
if (editor->priv->picker == NULL)
diff --git a/gtk/gtkcolorscale.c b/gtk/gtkcolorscale.c
index efead89d8d..2e54959a8d 100644
--- a/gtk/gtkcolorscale.c
+++ b/gtk/gtkcolorscale.c
@@ -148,7 +148,6 @@ gtk_color_scale_snapshot_trough (GtkColorScale *scale,
static void
gtk_color_scale_init (GtkColorScale *scale)
{
- GtkStyleContext *context;
GtkGesture *gesture;
gesture = gtk_gesture_long_press_new ();
@@ -158,8 +157,7 @@ gtk_color_scale_init (GtkColorScale *scale)
GTK_PHASE_TARGET);
gtk_widget_add_controller (GTK_WIDGET (scale), GTK_EVENT_CONTROLLER (gesture));
- context = gtk_widget_get_style_context (GTK_WIDGET (scale));
- gtk_style_context_add_class (context, "color");
+ gtk_widget_add_style_class (GTK_WIDGET (scale), "color");
}
static void
diff --git a/gtk/gtkcolorswatch.c b/gtk/gtkcolorswatch.c
index af7dcbd6b5..44edf1e005 100644
--- a/gtk/gtkcolorswatch.c
+++ b/gtk/gtkcolorswatch.c
@@ -558,7 +558,7 @@ gtk_color_swatch_init (GtkColorSwatch *swatch)
G_CALLBACK (key_controller_key_pressed), swatch);
gtk_widget_add_controller (GTK_WIDGET (swatch), controller);
- gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (swatch)), "activatable");
+ gtk_widget_add_style_class (GTK_WIDGET (swatch), "activatable");
priv->overlay_widget = g_object_new (GTK_TYPE_IMAGE,
"css-name", "overlay",
@@ -591,9 +591,6 @@ gtk_color_swatch_set_rgba (GtkColorSwatch *swatch,
const GdkRGBA *color)
{
GtkColorSwatchPrivate *priv = gtk_color_swatch_get_instance_private (swatch);
- GtkStyleContext *context;
-
- context = gtk_widget_get_style_context (GTK_WIDGET (swatch));
if (!priv->has_color)
{
@@ -614,13 +611,14 @@ gtk_color_swatch_set_rgba (GtkColorSwatch *swatch,
if (INTENSITY (priv->color.red, priv->color.green, priv->color.blue) > 0.5)
{
- gtk_style_context_add_class (context, "light");
- gtk_style_context_remove_class (context, "dark");
+ gtk_widget_add_style_class (GTK_WIDGET (swatch), "light");
+ gtk_widget_remove_style_class (GTK_WIDGET (swatch), "dark");
}
else
{
- gtk_style_context_add_class (context, "dark");
- gtk_style_context_remove_class (context, "light");
+ gtk_widget_add_style_class (GTK_WIDGET (swatch), "dark");
+ gtk_widget_remove_style_class (GTK_WIDGET (swatch), "light");
+
}
gtk_widget_queue_draw (GTK_WIDGET (swatch));
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c
index b9c6bbee8a..1313ea444b 100644
--- a/gtk/gtkcombobox.c
+++ b/gtk/gtkcombobox.c
@@ -825,7 +825,6 @@ static void
gtk_combo_box_init (GtkComboBox *combo_box)
{
GtkComboBoxPrivate *priv = gtk_combo_box_get_instance_private (combo_box);
- GtkStyleContext *context;
GtkEventController *controller;
priv->active = -1;
@@ -848,9 +847,8 @@ gtk_combo_box_init (GtkComboBox *combo_box)
g_type_ensure (GTK_TYPE_TREE_POPOVER);
gtk_widget_init_template (GTK_WIDGET (combo_box));
- context = gtk_widget_get_style_context (priv->button);
- gtk_style_context_remove_class (context, "toggle");
- gtk_style_context_add_class (context, "combo");
+ gtk_widget_remove_style_class (priv->button, "toggle");
+ gtk_widget_add_style_class (priv->button, "combo");
gtk_tree_popover_set_row_separator_func (GTK_TREE_POPOVER (priv->popup_widget),
(GtkTreeViewRowSeparatorFunc)gtk_combo_box_row_separator_func,
@@ -1029,13 +1027,11 @@ gtk_combo_box_create_child (GtkComboBox *combo_box)
if (priv->has_entry)
{
GtkWidget *entry;
- GtkStyleContext *context;
entry = gtk_entry_new ();
gtk_container_add (GTK_CONTAINER (combo_box), entry);
- context = gtk_widget_get_style_context (GTK_WIDGET (entry));
- gtk_style_context_add_class (context, "combo");
+ gtk_widget_add_style_class (GTK_WIDGET (entry), "combo");
g_signal_connect (combo_box, "changed",
G_CALLBACK (gtk_combo_box_entry_active_changed), NULL);
diff --git a/gtk/gtkdialog.c b/gtk/gtkdialog.c
index 2aea42bd3e..598c54b24a 100644
--- a/gtk/gtkdialog.c
+++ b/gtk/gtkdialog.c
@@ -398,12 +398,11 @@ update_suggested_action (GtkDialog *dialog)
for (l = children; l != NULL; l = l->next)
{
GtkWidget *child = l->data;
- GtkStyleContext *context = gtk_widget_get_style_context (child);
- if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_DEFAULT))
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_SUGGESTED_ACTION);
+ if (gtk_widget_has_style_class (child, GTK_STYLE_CLASS_DEFAULT))
+ gtk_widget_add_style_class (child, GTK_STYLE_CLASS_SUGGESTED_ACTION);
else
- gtk_style_context_remove_class (context, GTK_STYLE_CLASS_SUGGESTED_ACTION);
+ gtk_widget_remove_style_class (child, GTK_STYLE_CLASS_SUGGESTED_ACTION);
}
g_list_free (children);
}
diff --git a/gtk/gtkemojichooser.c b/gtk/gtkemojichooser.c
index 8d1695a3e1..95a1715acf 100644
--- a/gtk/gtkemojichooser.c
+++ b/gtk/gtkemojichooser.c
@@ -290,7 +290,7 @@ show_variations (GtkEmojiChooser *chooser,
parent_popover = gtk_widget_get_ancestor (child, GTK_TYPE_POPOVER);
popover = gtk_popover_new (child);
view = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_style_context_add_class (gtk_widget_get_style_context (view), "view");
+ gtk_widget_add_style_class (view, "view");
box = gtk_flow_box_new ();
gtk_flow_box_set_homogeneous (GTK_FLOW_BOX (box), TRUE);
gtk_flow_box_set_min_children_per_line (GTK_FLOW_BOX (box), 6);
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 77d2dd3bbc..9823120f4a 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -1341,7 +1341,6 @@ update_icon_style (GtkWidget *widget,
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
EntryIconInfo *icon_info = priv->icons[icon_pos];
const gchar *sides[2] = { GTK_STYLE_CLASS_LEFT, GTK_STYLE_CLASS_RIGHT };
- GtkStyleContext *context;
if (icon_info == NULL)
return;
@@ -1349,9 +1348,8 @@ update_icon_style (GtkWidget *widget,
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
icon_pos = 1 - icon_pos;
- context = gtk_widget_get_style_context (icon_info->widget);
- gtk_style_context_add_class (context, sides[icon_pos]);
- gtk_style_context_remove_class (context, sides[1 - icon_pos]);
+ gtk_widget_add_style_class (icon_info->widget, sides[icon_pos]);
+ gtk_widget_remove_style_class (icon_info->widget, sides[1 - icon_pos]);
}
static void
@@ -2200,15 +2198,13 @@ gtk_entry_get_activates_default (GtkEntry *entry)
* gtk_entry_set_has_frame:
* @entry: a #GtkEntry
* @setting: new value
- *
+ *
* Sets whether the entry has a beveled frame around it.
**/
void
gtk_entry_set_has_frame (GtkEntry *entry,
gboolean setting)
{
- GtkStyleContext *context;
-
g_return_if_fail (GTK_IS_ENTRY (entry));
setting = (setting != FALSE);
@@ -2216,11 +2212,10 @@ gtk_entry_set_has_frame (GtkEntry *entry,
if (setting == gtk_entry_get_has_frame (entry))
return;
- context = gtk_widget_get_style_context (GTK_WIDGET (entry));
if (setting)
- gtk_style_context_remove_class (context, GTK_STYLE_CLASS_FLAT);
+ gtk_widget_remove_style_class (GTK_WIDGET (entry), GTK_STYLE_CLASS_FLAT);
else
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_FLAT);
+ gtk_widget_add_style_class (GTK_WIDGET (entry), GTK_STYLE_CLASS_FLAT);
g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_HAS_FRAME]);
}
@@ -2236,13 +2231,9 @@ gtk_entry_set_has_frame (GtkEntry *entry,
gboolean
gtk_entry_get_has_frame (GtkEntry *entry)
{
- GtkStyleContext *context;
-
g_return_val_if_fail (GTK_IS_ENTRY (entry), FALSE);
- context = gtk_widget_get_style_context (GTK_WIDGET (entry));
-
- return !gtk_style_context_has_class (context, GTK_STYLE_CLASS_FLAT);
+ return !gtk_widget_has_style_class (GTK_WIDGET (entry), GTK_STYLE_CLASS_FRAME);
}
/**
diff --git a/gtk/gtkentrycompletion.c b/gtk/gtkentrycompletion.c
index 79cc3ab578..380dd5038b 100644
--- a/gtk/gtkentrycompletion.c
+++ b/gtk/gtkentrycompletion.c
@@ -585,7 +585,7 @@ gtk_entry_completion_constructed (GObject *object)
gtk_popover_set_position (GTK_POPOVER (priv->popup_window), GTK_POS_BOTTOM);
gtk_popover_set_autohide (GTK_POPOVER (priv->popup_window), FALSE);
gtk_popover_set_has_arrow (GTK_POPOVER (priv->popup_window), FALSE);
- gtk_style_context_add_class (gtk_widget_get_style_context (priv->popup_window), "entry-completion");
+ gtk_widget_add_style_class (priv->popup_window, "entry-completion");
controller = gtk_event_controller_key_new ();
g_signal_connect (controller, "key-pressed",
diff --git a/gtk/gtkexpander.c b/gtk/gtkexpander.c
index 04525612a5..63dcf42c52 100644
--- a/gtk/gtkexpander.c
+++ b/gtk/gtkexpander.c
@@ -370,8 +370,7 @@ gtk_expander_init (GtkExpander *expander)
gtk_container_add (GTK_CONTAINER (priv->box), priv->title_widget);
priv->arrow_widget = gtk_builtin_icon_new ("expander");
- gtk_style_context_add_class (gtk_widget_get_style_context (priv->arrow_widget),
- GTK_STYLE_CLASS_HORIZONTAL);
+ gtk_widget_add_style_class (priv->arrow_widget, GTK_STYLE_CLASS_HORIZONTAL);
gtk_container_add (GTK_CONTAINER (priv->title_widget), priv->arrow_widget);
formats = gdk_content_formats_new (NULL, 0);
diff --git a/gtk/gtkfontbutton.c b/gtk/gtkfontbutton.c
index 79ac0c31ed..f9ef7ad7b3 100644
--- a/gtk/gtkfontbutton.c
+++ b/gtk/gtkfontbutton.c
@@ -555,7 +555,6 @@ gtk_font_button_class_init (GtkFontButtonClass *klass)
static void
gtk_font_button_init (GtkFontButton *font_button)
{
- GtkStyleContext *context;
GtkFontButtonPrivate *priv = gtk_font_button_get_instance_private (font_button);
GtkWidget *box;
@@ -592,8 +591,7 @@ gtk_font_button_init (GtkFontButton *font_button)
gtk_font_button_take_font_desc (font_button, NULL);
- context = gtk_widget_get_style_context (GTK_WIDGET (priv->button));
- gtk_style_context_add_class (context, "font");
+ gtk_widget_add_style_class (priv->button, "font");
}
static void
diff --git a/gtk/gtkframe.c b/gtk/gtkframe.c
index 40d5bc2939..ab7ccb429c 100644
--- a/gtk/gtkframe.c
+++ b/gtk/gtkframe.c
@@ -534,11 +534,9 @@ gtk_frame_set_shadow_type (GtkFrame *frame,
priv->shadow_type = type;
if (type == GTK_SHADOW_NONE)
- gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (frame)),
- GTK_STYLE_CLASS_FLAT);
+ gtk_widget_add_style_class (GTK_WIDGET (frame), "flat");
else
- gtk_style_context_remove_class (gtk_widget_get_style_context (GTK_WIDGET (frame)),
- GTK_STYLE_CLASS_FLAT);
+ gtk_widget_remove_style_class (GTK_WIDGET (frame), "flat");
g_object_notify_by_pspec (G_OBJECT (frame), frame_props[PROP_SHADOW_TYPE]);
}
diff --git a/gtk/gtkheaderbar.c b/gtk/gtkheaderbar.c
index 0c8100872d..b00dc0b6cd 100644
--- a/gtk/gtkheaderbar.c
+++ b/gtk/gtkheaderbar.c
@@ -163,7 +163,6 @@ init_sizing_box (GtkHeaderBar *bar)
{
GtkHeaderBarPrivate *priv = gtk_header_bar_get_instance_private (bar);
GtkWidget *w;
- GtkStyleContext *context;
/* We use this box to always request size for the two labels (title
* and subtitle) as if they were always visible, but then allocate
@@ -174,8 +173,7 @@ init_sizing_box (GtkHeaderBar *bar)
priv->label_sizing_box = g_object_ref_sink (w);
w = gtk_label_new (NULL);
- context = gtk_widget_get_style_context (w);
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_TITLE);
+ gtk_widget_add_style_class (w, GTK_STYLE_CLASS_TITLE);
gtk_container_add (GTK_CONTAINER (priv->label_sizing_box), w);
gtk_label_set_wrap (GTK_LABEL (w), FALSE);
gtk_label_set_single_line_mode (GTK_LABEL (w), TRUE);
@@ -183,8 +181,7 @@ init_sizing_box (GtkHeaderBar *bar)
gtk_label_set_width_chars (GTK_LABEL (w), MIN_TITLE_CHARS);
w = gtk_label_new (NULL);
- context = gtk_widget_get_style_context (w);
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_SUBTITLE);
+ gtk_widget_add_style_class (w, GTK_STYLE_CLASS_SUBTITLE);
gtk_container_add (GTK_CONTAINER (priv->label_sizing_box), w);
gtk_label_set_wrap (GTK_LABEL (w), FALSE);
gtk_label_set_single_line_mode (GTK_LABEL (w), TRUE);
@@ -202,14 +199,12 @@ create_title_box (const char *title,
GtkWidget *label_box;
GtkWidget *title_label;
GtkWidget *subtitle_label;
- GtkStyleContext *context;
label_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_set_valign (label_box, GTK_ALIGN_CENTER);
title_label = gtk_label_new (title);
- context = gtk_widget_get_style_context (title_label);
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_TITLE);
+ gtk_widget_add_style_class (title_label, GTK_STYLE_CLASS_TITLE);
gtk_label_set_wrap (GTK_LABEL (title_label), FALSE);
gtk_label_set_single_line_mode (GTK_LABEL (title_label), TRUE);
gtk_label_set_ellipsize (GTK_LABEL (title_label), PANGO_ELLIPSIZE_END);
@@ -217,8 +212,7 @@ create_title_box (const char *title,
gtk_label_set_width_chars (GTK_LABEL (title_label), MIN_TITLE_CHARS);
subtitle_label = gtk_label_new (subtitle);
- context = gtk_widget_get_style_context (subtitle_label);
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_SUBTITLE);
+ gtk_widget_add_style_class (subtitle_label, GTK_STYLE_CLASS_SUBTITLE);
gtk_label_set_wrap (GTK_LABEL (subtitle_label), FALSE);
gtk_label_set_single_line_mode (GTK_LABEL (subtitle_label), TRUE);
gtk_label_set_ellipsize (GTK_LABEL (subtitle_label), PANGO_ELLIPSIZE_END);
@@ -371,7 +365,7 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
t = g_strsplit (tokens[i], ",", -1);
separator = gtk_separator_new (GTK_ORIENTATION_VERTICAL);
- gtk_style_context_add_class (gtk_widget_get_style_context (separator), "titlebutton");
+ gtk_widget_add_style_class (separator, "titlebutton");
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
@@ -387,8 +381,8 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
button = gtk_image_new ();
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
priv->titlebar_icon = button;
- gtk_style_context_add_class (gtk_widget_get_style_context (button), "titlebutton");
- gtk_style_context_add_class (gtk_widget_get_style_context (button), "icon");
+ gtk_widget_add_style_class (button, "titlebutton");
+ gtk_widget_add_style_class (button, "icon");
gtk_widget_set_size_request (button, 20, 20);
if (!_gtk_header_bar_update_window_icon (bar, window))
@@ -405,8 +399,8 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
button = gtk_menu_button_new ();
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (button), menu);
- gtk_style_context_add_class (gtk_widget_get_style_context (button), "titlebutton");
- gtk_style_context_add_class (gtk_widget_get_style_context (button), "menu");
+ gtk_widget_add_style_class (button, "titlebutton");
+ gtk_widget_add_style_class (button, "menu");
image = gtk_image_new ();
gtk_menu_button_add_child (GTK_MENU_BUTTON (button), image);
gtk_widget_set_can_focus (button, FALSE);
@@ -426,8 +420,8 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
{
button = gtk_button_new ();
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
- gtk_style_context_add_class (gtk_widget_get_style_context (button), "titlebutton");
- gtk_style_context_add_class (gtk_widget_get_style_context (button), "minimize");
+ gtk_widget_add_style_class (button, "titlebutton");
+ gtk_widget_add_style_class (button, "minimize");
image = gtk_image_new_from_icon_name ("window-minimize-symbolic");
g_object_set (image, "use-fallback", TRUE, NULL);
gtk_container_add (GTK_CONTAINER (button), image);
@@ -449,8 +443,8 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
icon_name = maximized ? "window-restore-symbolic" : "window-maximize-symbolic";
button = gtk_button_new ();
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
- gtk_style_context_add_class (gtk_widget_get_style_context (button), "titlebutton");
- gtk_style_context_add_class (gtk_widget_get_style_context (button), "maximize");
+ gtk_widget_add_style_class (button, "titlebutton");
+ gtk_widget_add_style_class (button, "maximize");
image = gtk_image_new_from_icon_name (icon_name);
g_object_set (image, "use-fallback", TRUE, NULL);
gtk_container_add (GTK_CONTAINER (button), image);
@@ -468,8 +462,8 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
button = gtk_button_new ();
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
image = gtk_image_new_from_icon_name ("window-close-symbolic");
- gtk_style_context_add_class (gtk_widget_get_style_context (button), "titlebutton");
- gtk_style_context_add_class (gtk_widget_get_style_context (button), "close");
+ gtk_widget_add_style_class (button, "titlebutton");
+ gtk_widget_add_style_class (button, "close");
g_object_set (image, "use-fallback", TRUE, NULL);
gtk_container_add (GTK_CONTAINER (button), image);
gtk_widget_set_can_focus (button, FALSE);
@@ -503,9 +497,9 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
gtk_box_reorder_child_after (GTK_BOX (box), separator, NULL);
if (i == 0)
- gtk_style_context_add_class (gtk_widget_get_style_context (box), GTK_STYLE_CLASS_LEFT);
+ gtk_widget_add_style_class (box, GTK_STYLE_CLASS_LEFT);
else
- gtk_style_context_add_class (gtk_widget_get_style_context (box), GTK_STYLE_CLASS_RIGHT);
+ gtk_widget_add_style_class (box, GTK_STYLE_CLASS_RIGHT);
if (i == 0)
{
@@ -540,7 +534,6 @@ update_default_decoration (GtkHeaderBar *bar)
{
GtkHeaderBarPrivate *priv = gtk_header_bar_get_instance_private (bar);
GtkLayoutManager *layout = gtk_widget_get_layout_manager (GTK_WIDGET (bar));
- GtkStyleContext *context;
gboolean have_children = FALSE;
/* Check whether we have any child widgets that we didn't add ourselves */
@@ -576,12 +569,10 @@ update_default_decoration (GtkHeaderBar *bar)
}
}
- context = gtk_widget_get_style_context (GTK_WIDGET (bar));
-
if (have_children || priv->custom_title != NULL)
- gtk_style_context_remove_class (context, "default-decoration");
+ gtk_widget_remove_style_class (GTK_WIDGET (bar), "default-decoration");
else
- gtk_style_context_add_class (context, "default-decoration");
+ gtk_widget_add_style_class (GTK_WIDGET (bar), "default-decoration");
}
void
@@ -1242,11 +1233,11 @@ gtk_header_bar_init (GtkHeaderBar *bar)
layout = gtk_widget_get_layout_manager (GTK_WIDGET (bar));
priv->start_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_style_context_add_class (gtk_widget_get_style_context (priv->start_box), "start");
+ gtk_widget_add_style_class (priv->start_box, "start");
gtk_widget_set_parent (priv->start_box, GTK_WIDGET (bar));
gtk_center_layout_set_start_widget (GTK_CENTER_LAYOUT (layout), priv->start_box);
priv->end_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_style_context_add_class (gtk_widget_get_style_context (priv->end_box), "end");
+ gtk_widget_add_style_class (priv->end_box, "end");
gtk_widget_set_parent (priv->end_box, GTK_WIDGET (bar));
gtk_center_layout_set_end_widget (GTK_CENTER_LAYOUT (layout), priv->end_box);
diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c
index f34cc5fa90..8a3ee9ff6b 100644
--- a/gtk/gtkiconview.c
+++ b/gtk/gtkiconview.c
@@ -956,8 +956,7 @@ gtk_icon_view_init (GtkIconView *icon_view)
icon_view->priv->row_contexts =
g_ptr_array_new_with_free_func ((GDestroyNotify)g_object_unref);
- gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (icon_view)),
- GTK_STYLE_CLASS_VIEW);
+ gtk_widget_add_style_class (GTK_WIDGET (icon_view), GTK_STYLE_CLASS_VIEW);
gesture = gtk_gesture_click_new ();
g_signal_connect (gesture, "pressed", G_CALLBACK (gtk_icon_view_button_press),
diff --git a/gtk/gtkinfobar.c b/gtk/gtkinfobar.c
index a7b902cf17..d7c04299dd 100644
--- a/gtk/gtkinfobar.c
+++ b/gtk/gtkinfobar.c
@@ -516,7 +516,7 @@ gtk_info_bar_init (GtkInfoBar *info_bar)
priv->close_button = gtk_button_new_from_icon_name ("window-close-symbolic");
gtk_widget_hide (priv->close_button);
gtk_widget_set_valign (priv->close_button, GTK_ALIGN_CENTER);
- gtk_style_context_add_class (gtk_widget_get_style_context (priv->close_button), "close");
+ gtk_widget_add_style_class (priv->close_button, "close");
gtk_container_add (GTK_CONTAINER (main_box), priv->close_button);
g_signal_connect (priv->close_button, "clicked",
G_CALLBACK (close_button_clicked_cb), info_bar);
@@ -787,9 +787,9 @@ update_default_response (GtkInfoBar *info_bar,
priv->default_response_sensitive = sensitive;
if (response_id && sensitive)
- gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (info_bar)), "action");
+ gtk_widget_add_style_class (GTK_WIDGET (info_bar), "action");
else
- gtk_style_context_remove_class (gtk_widget_get_style_context (GTK_WIDGET (info_bar)), "action");
+ gtk_widget_remove_style_class (GTK_WIDGET (info_bar), "action");
}
/**
@@ -1137,7 +1137,6 @@ gtk_info_bar_set_message_type (GtkInfoBar *info_bar,
if (priv->message_type != message_type)
{
- GtkStyleContext *context;
AtkObject *atk_obj;
const char *type_class[] = {
GTK_STYLE_CLASS_INFO,
@@ -1147,10 +1146,8 @@ gtk_info_bar_set_message_type (GtkInfoBar *info_bar,
NULL
};
- context = gtk_widget_get_style_context (GTK_WIDGET (info_bar));
-
if (type_class[priv->message_type])
- gtk_style_context_remove_class (context, type_class[priv->message_type]);
+ gtk_widget_remove_style_class (GTK_WIDGET (info_bar), type_class[priv->message_type]);
priv->message_type = message_type;
@@ -1194,7 +1191,7 @@ gtk_info_bar_set_message_type (GtkInfoBar *info_bar,
}
if (type_class[priv->message_type])
- gtk_style_context_add_class (context, type_class[priv->message_type]);
+ gtk_widget_add_style_class (GTK_WIDGET (info_bar), type_class[priv->message_type]);
g_object_notify_by_pspec (G_OBJECT (info_bar), props[PROP_MESSAGE_TYPE]);
}
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index abcf2a2871..d2f4b51cb2 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -3315,7 +3315,6 @@ gtk_label_update_layout_attributes (GtkLabel *label)
if (priv->layout == NULL)
return;
- context = gtk_widget_get_style_context (widget);
if (priv->select_info && priv->select_info->links)
{
@@ -3323,6 +3322,7 @@ gtk_label_update_layout_attributes (GtkLabel *label)
PangoAttribute *attribute;
GList *list;
+ context = gtk_widget_get_style_context (widget);
attrs = pango_attr_list_new ();
for (list = priv->select_info->links; list; list = list->next)
@@ -3351,9 +3351,16 @@ gtk_label_update_layout_attributes (GtkLabel *label)
else
attrs = NULL;
- style_attrs = _gtk_style_context_get_pango_attributes (context);
+ if ((context = _gtk_widget_peek_style_context (widget)))
+ {
+ style_attrs = _gtk_style_context_get_pango_attributes (context);
+
+ attrs = _gtk_pango_attr_list_merge (attrs, style_attrs);
+
+ if (style_attrs)
+ pango_attr_list_unref (style_attrs);
+ }
- attrs = _gtk_pango_attr_list_merge (attrs, style_attrs);
attrs = _gtk_pango_attr_list_merge (attrs, priv->markup_attrs);
attrs = _gtk_pango_attr_list_merge (attrs, priv->attrs);
@@ -3361,8 +3368,6 @@ gtk_label_update_layout_attributes (GtkLabel *label)
if (attrs)
pango_attr_list_unref (attrs);
- if (style_attrs)
- pango_attr_list_unref (style_attrs);
}
static void
diff --git a/gtk/gtklevelbar.c b/gtk/gtklevelbar.c
index 1186bd9f5f..fc5ac8fb69 100644
--- a/gtk/gtklevelbar.c
+++ b/gtk/gtklevelbar.c
@@ -632,30 +632,21 @@ update_level_style_classes (GtkLevelBar *self)
for (i = 0; i < num_filled; i++)
{
- GtkStyleContext *context = gtk_widget_get_style_context (priv->block_widget[inverted ? num_blocks - 1
- i : i]);
- GList *classes = gtk_style_context_list_classes (context);
+ GtkCssNode *node = gtk_widget_get_css_node (priv->block_widget[inverted ? num_blocks - 1 - i : i]);
- for (l = classes; l; l = l->next)
- gtk_style_context_remove_class (context, l->data);
+ gtk_css_node_set_classes (node, NULL);
+ gtk_css_node_add_class (node, g_quark_from_static_string ("filled"));
- g_list_free (classes);
-
- gtk_style_context_add_class (context, "filled");
if (value_class)
- gtk_style_context_add_class (context, value_class);
+ gtk_css_node_add_class (node, g_quark_from_string (value_class));
}
for (; i < num_blocks; i++)
{
- GtkStyleContext *context = gtk_widget_get_style_context (priv->block_widget[inverted ? num_blocks - 1
- i : i]);
- GList *classes = gtk_style_context_list_classes (context);
-
- for (l = classes; l; l = l->next)
- gtk_style_context_remove_class (context, l->data);
-
- g_list_free (classes);
+ GtkCssNode *node = gtk_widget_get_css_node (priv->block_widget[inverted ? num_blocks - 1 - i : i]);
- gtk_style_context_add_class (context, "empty");
+ gtk_css_node_set_classes (node, NULL);
+ gtk_css_node_add_class (node, g_quark_from_static_string ("empty"));
}
}
diff --git a/gtk/gtklinkbutton.c b/gtk/gtklinkbutton.c
index 2621591a5e..be28f64613 100644
--- a/gtk/gtklinkbutton.c
+++ b/gtk/gtklinkbutton.c
@@ -320,7 +320,6 @@ gtk_link_content_init (GtkLinkContent *content)
static void
gtk_link_button_init (GtkLinkButton *link_button)
{
- GtkStyleContext *context;
GtkGesture *gesture;
GdkContentProvider *content;
GtkDragSource *source;
@@ -347,8 +346,7 @@ gtk_link_button_init (GtkLinkButton *link_button)
link_button);
gtk_widget_add_controller (GTK_WIDGET (link_button), GTK_EVENT_CONTROLLER (gesture));
- context = gtk_widget_get_style_context (GTK_WIDGET (link_button));
- gtk_style_context_add_class (context, "link");
+ gtk_widget_add_style_class (GTK_WIDGET (link_button), "link");
gtk_widget_set_cursor_from_name (GTK_WIDGET (link_button), "pointer");
}
diff --git a/gtk/gtklistbox.c b/gtk/gtklistbox.c
index 681c33f3aa..580dcf44a7 100644
--- a/gtk/gtklistbox.c
+++ b/gtk/gtklistbox.c
@@ -3157,7 +3157,6 @@ static void
gtk_list_box_update_row_style (GtkListBox *box,
GtkListBoxRow *row)
{
- GtkStyleContext *context;
gboolean can_select;
if (box && BOX_PRIV (box)->selection_mode != GTK_SELECTION_NONE)
@@ -3165,12 +3164,11 @@ gtk_list_box_update_row_style (GtkListBox *box,
else
can_select = FALSE;
- context = gtk_widget_get_style_context (GTK_WIDGET (row));
if (ROW_PRIV (row)->activatable ||
(ROW_PRIV (row)->selectable && can_select))
- gtk_style_context_add_class (context, "activatable");
+ gtk_widget_add_style_class (GTK_WIDGET (row), "activatable");
else
- gtk_style_context_remove_class (context, "activatable");
+ gtk_widget_remove_style_class (GTK_WIDGET (row), "activatable");
}
static void
@@ -3496,8 +3494,7 @@ gtk_list_box_row_init (GtkListBoxRow *row)
ROW_PRIV (row)->activatable = TRUE;
ROW_PRIV (row)->selectable = TRUE;
- gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (row)),
- "activatable");
+ gtk_widget_add_style_class (GTK_WIDGET (row), "activatable");
}
static void
@@ -3669,9 +3666,9 @@ gtk_list_box_set_show_separators (GtkListBox *box,
priv->show_separators = show_separators;
if (show_separators)
- gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (box)), "separators");
+ gtk_widget_add_style_class (GTK_WIDGET (box), "separators");
else
- gtk_style_context_remove_class (gtk_widget_get_style_context (GTK_WIDGET (box)), "separators");
+ gtk_widget_remove_style_class (GTK_WIDGET (box), "separators");
g_object_notify_by_pspec (G_OBJECT (box), properties[PROP_SHOW_SEPARATORS]);
}
diff --git a/gtk/gtklockbutton.c b/gtk/gtklockbutton.c
index f22670110a..5312b07434 100644
--- a/gtk/gtklockbutton.c
+++ b/gtk/gtklockbutton.c
@@ -241,7 +241,6 @@ gtk_lock_button_init (GtkLockButton *button)
{
GtkLockButtonPrivate *priv = gtk_lock_button_get_instance_private (button);
const char *names[3];
- GtkStyleContext *context;
gtk_widget_init_template (GTK_WIDGET (button));
@@ -257,8 +256,7 @@ gtk_lock_button_init (GtkLockButton *button)
update_state (button);
- context = gtk_widget_get_style_context (GTK_WIDGET (button));
- gtk_style_context_add_class (context, I_("lock"));
+ gtk_widget_add_style_class (GTK_WIDGET (button), I_("lock"));
}
static void
diff --git a/gtk/gtkmenubutton.c b/gtk/gtkmenubutton.c
index 3e0a31a391..15a6de1644 100644
--- a/gtk/gtkmenubutton.c
+++ b/gtk/gtkmenubutton.c
@@ -471,7 +471,6 @@ static void
gtk_menu_button_init (GtkMenuButton *menu_button)
{
GtkMenuButtonPrivate *priv = gtk_menu_button_get_instance_private (menu_button);
- GtkStyleContext *context;
priv->arrow_type = GTK_ARROW_DOWN;
@@ -482,8 +481,7 @@ gtk_menu_button_init (GtkMenuButton *menu_button)
gtk_widget_set_sensitive (priv->button, FALSE);
- context = gtk_widget_get_style_context (GTK_WIDGET (menu_button));
- gtk_style_context_add_class (context, "popup");
+ gtk_widget_add_style_class (GTK_WIDGET (menu_button), "popup");
}
/**
diff --git a/gtk/gtkmenusectionbox.c b/gtk/gtkmenusectionbox.c
index fd462230de..e2bfc99e40 100644
--- a/gtk/gtkmenusectionbox.c
+++ b/gtk/gtkmenusectionbox.c
@@ -350,13 +350,13 @@ gtk_menu_section_box_insert_func (GtkMenuTrackerItem *item,
{
g_object_bind_property (item, "verb-icon", widget, "icon", G_BINDING_SYNC_CREATE);
g_object_set (widget, "iconic", TRUE, NULL);
- gtk_style_context_add_class (gtk_widget_get_style_context (widget), "flat");
+ gtk_widget_add_style_class (widget, "flat");
}
else if (box->circular)
{
g_object_bind_property (item, "verb-icon", widget, "icon", G_BINDING_SYNC_CREATE);
g_object_set (widget, "iconic", TRUE, NULL);
- gtk_style_context_add_class (gtk_widget_get_style_context (widget), "circular");
+ gtk_widget_add_style_class (widget, "circular");
}
else
g_object_bind_property (item, "icon", widget, "icon", G_BINDING_SYNC_CREATE);
@@ -556,8 +556,8 @@ gtk_menu_section_box_new_section (GtkMenuTrackerItem *item,
{
gtk_box_set_homogeneous (box->item_box, TRUE);
gtk_orientable_set_orientation (GTK_ORIENTABLE (box->item_box), GTK_ORIENTATION_HORIZONTAL);
- gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (box->item_box)),
GTK_STYLE_CLASS_LINKED);
- gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (box->item_box)),
"horizontal-buttons");
+ gtk_widget_add_style_class (GTK_WIDGET (box->item_box), "linked");
+ gtk_widget_add_style_class (GTK_WIDGET (box->item_box), "horizontal-buttons");
box->iconic = TRUE;
if (text_direction)
@@ -580,7 +580,7 @@ gtk_menu_section_box_new_section (GtkMenuTrackerItem *item,
box->inline_buttons = TRUE;
gtk_orientable_set_orientation (GTK_ORIENTABLE (box->item_box), GTK_ORIENTATION_HORIZONTAL);
- gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (box->item_box)),
"inline-buttons");
+ gtk_widget_add_style_class (GTK_WIDGET (box->item_box), "inline-buttons");
spacer = gtk_builtin_icon_new ("none");
gtk_container_add (GTK_CONTAINER (box->item_box), spacer);
@@ -605,7 +605,7 @@ gtk_menu_section_box_new_section (GtkMenuTrackerItem *item,
{
gtk_box_set_homogeneous (box->item_box, TRUE);
gtk_orientable_set_orientation (GTK_ORIENTABLE (box->item_box), GTK_ORIENTATION_HORIZONTAL);
- gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (box->item_box)),
"circular-buttons");
+ gtk_widget_add_style_class (GTK_WIDGET (box->item_box), "circular-buttons");
box->circular = TRUE;
}
@@ -623,7 +623,7 @@ gtk_menu_section_box_new_section (GtkMenuTrackerItem *item,
title = gtk_label_new (label);
g_object_bind_property (item, "label", title, "label", G_BINDING_SYNC_CREATE);
- gtk_style_context_add_class (gtk_widget_get_style_context (title), GTK_STYLE_CLASS_SEPARATOR);
+ gtk_widget_add_style_class (title, GTK_STYLE_CLASS_SEPARATOR);
gtk_widget_set_halign (title, GTK_ALIGN_START);
gtk_container_add (GTK_CONTAINER (box->separator), title);
diff --git a/gtk/gtkmessagedialog.c b/gtk/gtkmessagedialog.c
index b7e3161092..769b3af410 100644
--- a/gtk/gtkmessagedialog.c
+++ b/gtk/gtkmessagedialog.c
@@ -366,7 +366,7 @@ gtk_message_dialog_constructed (GObject *object)
gtk_widget_set_margin_bottom (label, 6);
gtk_widget_set_halign (label, GTK_ALIGN_CENTER);
gtk_widget_set_hexpand (label, TRUE);
- gtk_style_context_add_class (gtk_widget_get_style_context (label), "title");
+ gtk_widget_add_style_class (label, "title");
gtk_container_add (GTK_CONTAINER (box), label);
g_signal_connect_object (dialog, "notify::title", G_CALLBACK (update_title), label, 0);
diff --git a/gtk/gtkmodelbutton.c b/gtk/gtkmodelbutton.c
index 3680fc15f4..b7035adf4f 100644
--- a/gtk/gtkmodelbutton.c
+++ b/gtk/gtkmodelbutton.c
@@ -287,28 +287,20 @@ gtk_model_button_actionable_iface_init (GtkActionableInterface *iface)
static void
update_node_ordering (GtkModelButton *button)
{
- GtkStyleContext *start_indicator_context = NULL;
- GtkStyleContext *end_indicator_context = NULL;
GtkWidget *child;
- if (button->start_indicator)
- start_indicator_context = gtk_widget_get_style_context (button->start_indicator);
-
- if (button->end_indicator)
- end_indicator_context = gtk_widget_get_style_context (button->end_indicator);
-
if (gtk_widget_get_direction (GTK_WIDGET (button)) == GTK_TEXT_DIR_LTR)
{
- if (start_indicator_context)
+ if (button->start_indicator)
{
- gtk_style_context_add_class (start_indicator_context, GTK_STYLE_CLASS_LEFT);
- gtk_style_context_remove_class (start_indicator_context, GTK_STYLE_CLASS_RIGHT);
+ gtk_widget_add_style_class (button->start_indicator, GTK_STYLE_CLASS_LEFT);
+ gtk_widget_remove_style_class (button->start_indicator, GTK_STYLE_CLASS_RIGHT);
}
- if (end_indicator_context)
+ if (button->end_indicator)
{
- gtk_style_context_add_class (end_indicator_context, GTK_STYLE_CLASS_RIGHT);
- gtk_style_context_remove_class (end_indicator_context, GTK_STYLE_CLASS_LEFT);
+ gtk_widget_add_style_class (button->end_indicator, GTK_STYLE_CLASS_RIGHT);
+ gtk_widget_remove_style_class (button->end_indicator, GTK_STYLE_CLASS_LEFT);
}
child = gtk_widget_get_first_child (GTK_WIDGET (button));
@@ -321,16 +313,17 @@ update_node_ordering (GtkModelButton *button)
}
else
{
- if (start_indicator_context)
+ if (button->start_indicator)
{
- gtk_style_context_add_class (start_indicator_context, GTK_STYLE_CLASS_RIGHT);
- gtk_style_context_remove_class (start_indicator_context, GTK_STYLE_CLASS_LEFT);
+ gtk_widget_add_style_class (button->start_indicator, GTK_STYLE_CLASS_RIGHT);
+ gtk_widget_remove_style_class (button->start_indicator, GTK_STYLE_CLASS_LEFT);
}
- if (end_indicator_context)
+ if (button->end_indicator)
{
- gtk_style_context_add_class (end_indicator_context, GTK_STYLE_CLASS_LEFT);
- gtk_style_context_remove_class (end_indicator_context, GTK_STYLE_CLASS_RIGHT);
+ gtk_widget_add_style_class (button->end_indicator, GTK_STYLE_CLASS_LEFT);
+ gtk_widget_remove_style_class (button->end_indicator, GTK_STYLE_CLASS_RIGHT);
+
}
child = gtk_widget_get_first_child (GTK_WIDGET (button));
@@ -347,22 +340,19 @@ static void
update_end_indicator (GtkModelButton *self)
{
const gboolean is_ltr = gtk_widget_get_direction (GTK_WIDGET (self)) == GTK_TEXT_DIR_LTR;
- GtkStyleContext *context;
if (!self->end_indicator)
return;
- context = gtk_widget_get_style_context (self->end_indicator);
-
if (is_ltr)
{
- gtk_style_context_remove_class (context, GTK_STYLE_CLASS_LEFT);
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_RIGHT);
+ gtk_widget_add_style_class (self->end_indicator, GTK_STYLE_CLASS_RIGHT);
+ gtk_widget_remove_style_class (self->end_indicator, GTK_STYLE_CLASS_LEFT);
}
else
{
- gtk_style_context_remove_class (context, GTK_STYLE_CLASS_RIGHT);
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_LEFT);
+ gtk_widget_add_style_class (self->end_indicator, GTK_STYLE_CLASS_LEFT);
+ gtk_widget_remove_style_class (self->end_indicator, GTK_STYLE_CLASS_RIGHT);
}
}
@@ -387,25 +377,23 @@ static void
update_start_indicator (GtkModelButton *self)
{
const gboolean is_ltr = gtk_widget_get_direction (GTK_WIDGET (self)) == GTK_TEXT_DIR_LTR;
- GtkStyleContext *context;
if (!self->start_indicator)
return;
gtk_widget_set_state_flags (self->start_indicator, get_start_indicator_state (self), TRUE);
- context = gtk_widget_get_style_context (self->start_indicator);
-
if (is_ltr)
{
- gtk_style_context_remove_class (context, GTK_STYLE_CLASS_RIGHT);
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_LEFT);
+ gtk_widget_add_style_class (self->start_indicator, GTK_STYLE_CLASS_LEFT);
+ gtk_widget_remove_style_class (self->start_indicator, GTK_STYLE_CLASS_RIGHT);
}
else
{
- gtk_style_context_remove_class (context, GTK_STYLE_CLASS_LEFT);
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_RIGHT);
+ gtk_widget_add_style_class (self->start_indicator, GTK_STYLE_CLASS_RIGHT);
+ gtk_widget_remove_style_class (self->start_indicator, GTK_STYLE_CLASS_LEFT);
}
+
}
static void
@@ -548,12 +536,12 @@ gtk_model_button_set_role (GtkModelButton *self,
if (role == GTK_BUTTON_ROLE_TITLE)
{
- gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (self)), "title");
+ gtk_widget_add_style_class (GTK_WIDGET (self), "title");
gtk_widget_set_halign (self->label, GTK_ALIGN_CENTER);
}
else
{
- gtk_style_context_remove_class (gtk_widget_get_style_context (GTK_WIDGET (self)), "title");
+ gtk_widget_remove_style_class (GTK_WIDGET (self), "title");
gtk_widget_set_halign (self->label, GTK_ALIGN_START);
}
@@ -661,8 +649,8 @@ static void
gtk_model_button_set_iconic (GtkModelButton *self,
gboolean iconic)
{
+ GtkWidget *widget = GTK_WIDGET (self);
GtkCssNode *widget_node;
- GtkStyleContext *context;
iconic = !!iconic;
if (self->iconic == iconic)
@@ -670,23 +658,22 @@ gtk_model_button_set_iconic (GtkModelButton *self,
self->iconic = iconic;
- widget_node = gtk_widget_get_css_node (GTK_WIDGET (self));
- context = gtk_widget_get_style_context (GTK_WIDGET (self));
+ widget_node = gtk_widget_get_css_node (widget);
if (iconic)
{
gtk_widget_hide (self->start_box);
gtk_css_node_set_name (widget_node, g_quark_from_static_string ("button"));
- gtk_style_context_add_class (context, "model");
- gtk_style_context_add_class (context, "image-button");
- gtk_style_context_remove_class (context, "flat");
+ gtk_widget_add_style_class (widget, "model");
+ gtk_widget_add_style_class (widget, "image-button");
+ gtk_widget_remove_style_class (widget, "flat");
}
else
{
gtk_widget_show (self->start_box);
gtk_css_node_set_name (widget_node, g_quark_from_static_string ("modelbutton"));
- gtk_style_context_remove_class (context, "model");
- gtk_style_context_remove_class (context, "image-button");
- gtk_style_context_add_class (context, "flat");
+ gtk_widget_remove_style_class (widget, "model");
+ gtk_widget_remove_style_class (widget, "image-button");
+ gtk_widget_add_style_class (widget, "flat");
}
self->centered = iconic;
@@ -1397,7 +1384,7 @@ gtk_model_button_init (GtkModelButton *self)
gtk_widget_insert_after (self->start_box, GTK_WIDGET (self), NULL);
update_node_ordering (self);
- gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (self)), "flat");
+ gtk_widget_add_style_class (GTK_WIDGET (self), "flat");
controller = gtk_event_controller_motion_new ();
g_signal_connect (controller, "enter", G_CALLBACK (enter_cb), self);
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 70fa1a92bc..d72baa7dac 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -1331,8 +1331,7 @@ gtk_notebook_init (GtkNotebook *notebook)
priv->header_widget = g_object_new (GTK_TYPE_BOX,
"css-name", "header",
NULL);
- gtk_style_context_add_class (gtk_widget_get_style_context (priv->header_widget),
- GTK_STYLE_CLASS_TOP);
+ gtk_widget_add_style_class (priv->header_widget, GTK_STYLE_CLASS_TOP);
gtk_widget_hide (priv->header_widget);
gtk_widget_set_parent (priv->header_widget, GTK_WIDGET (notebook));
@@ -1368,8 +1367,7 @@ gtk_notebook_init (GtkNotebook *notebook)
g_signal_connect (controller, "motion", G_CALLBACK (gtk_notebook_motion), notebook);
gtk_widget_add_controller (GTK_WIDGET (notebook), controller);
- gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (notebook)),
- GTK_STYLE_CLASS_FRAME);
+ gtk_widget_add_style_class (GTK_WIDGET (notebook), GTK_STYLE_CLASS_FRAME);
layout = gtk_widget_get_layout_manager (GTK_WIDGET (notebook));
gtk_orientable_set_orientation (GTK_ORIENTABLE (layout), GTK_ORIENTATION_VERTICAL);
@@ -2637,7 +2635,7 @@ static void
tab_drag_begin (GtkNotebook *notebook,
GtkNotebookPage *page)
{
- gtk_style_context_add_class (gtk_widget_get_style_context (page->tab_widget), GTK_STYLE_CLASS_DND);
+ gtk_widget_add_style_class (page->tab_widget, GTK_STYLE_CLASS_DND);
}
/* This function undoes the reparenting that happens both when drag_surface
@@ -2655,7 +2653,7 @@ tab_drag_end (GtkNotebook *notebook,
g_object_unref (page->tab_label);
}
- gtk_style_context_remove_class (gtk_widget_get_style_context (page->tab_widget), GTK_STYLE_CLASS_DND);
+ gtk_widget_remove_style_class (page->tab_widget, GTK_STYLE_CLASS_DND);
}
static void
@@ -3042,7 +3040,6 @@ update_arrow_nodes (GtkNotebook *notebook)
if (priv->arrow_widget[i] == NULL)
{
GtkWidget *next_widget;
- GtkStyleContext *context;
switch (i)
{
@@ -3087,16 +3084,14 @@ update_arrow_nodes (GtkNotebook *notebook)
"css-name", "arrow",
NULL);
- context = gtk_widget_get_style_context (priv->arrow_widget[i]);
-
if (i == ARROW_LEFT_BEFORE || i == ARROW_LEFT_AFTER)
{
- gtk_style_context_add_class (context, "down");
+ gtk_widget_add_style_class (priv->arrow_widget[i], "down");
gtk_widget_insert_after (priv->arrow_widget[i], priv->tabs_widget, next_widget);
}
else
{
- gtk_style_context_add_class (context, "up");
+ gtk_widget_add_style_class (priv->arrow_widget[i], "up");
gtk_widget_insert_before (priv->arrow_widget[i], priv->tabs_widget, next_widget);
}
}
@@ -6142,13 +6137,12 @@ gtk_notebook_set_show_border (GtkNotebook *notebook,
if (priv->show_border != show_border)
{
- GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (notebook));
priv->show_border = show_border;
if (show_border)
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_FRAME);
+ gtk_widget_add_style_class (GTK_WIDGET (notebook), GTK_STYLE_CLASS_FRAME);
else
- gtk_style_context_remove_class (context, GTK_STYLE_CLASS_FRAME);
+ gtk_widget_remove_style_class (GTK_WIDGET (notebook), GTK_STYLE_CLASS_FRAME);
g_object_notify_by_pspec (G_OBJECT (notebook), properties[PROP_SHOW_BORDER]);
}
@@ -6273,11 +6267,9 @@ gtk_notebook_update_tab_pos (GtkNotebook *notebook)
for (i = 0; i < G_N_ELEMENTS (tab_pos_names); i++)
{
if (tab_pos == i)
- gtk_style_context_add_class (gtk_widget_get_style_context (priv->header_widget),
- tab_pos_names[i]);
+ gtk_widget_add_style_class (priv->header_widget, tab_pos_names[i]);
else
- gtk_style_context_remove_class (gtk_widget_get_style_context (priv->header_widget),
- tab_pos_names[i]);
+ gtk_widget_remove_style_class (priv->header_widget, tab_pos_names[i]);
}
layout = gtk_widget_get_layout_manager (GTK_WIDGET (notebook));
@@ -7037,11 +7029,10 @@ gtk_notebook_set_tab_reorderable (GtkNotebook *notebook,
{
page->reorderable = reorderable;
if (reorderable)
- gtk_style_context_add_class (gtk_widget_get_style_context (page->tab_widget),
- "reorderable-page");
+ gtk_widget_add_style_class (page->tab_widget, "reorderable-page");
else
- gtk_style_context_remove_class (gtk_widget_get_style_context (page->tab_widget),
- "reorderable-page");
+ gtk_widget_remove_style_class (page->tab_widget, "reorderable-page");
+
g_object_notify (G_OBJECT (page), "reorderable");
}
}
diff --git a/gtk/gtkorientable.c b/gtk/gtkorientable.c
index 70b8e60ff7..8cdefc70c4 100644
--- a/gtk/gtkorientable.c
+++ b/gtk/gtkorientable.c
@@ -110,23 +110,21 @@ gtk_orientable_get_orientation (GtkOrientable *orientable)
void
_gtk_orientable_set_style_classes (GtkOrientable *orientable)
{
- GtkStyleContext *context;
GtkOrientation orientation;
g_return_if_fail (GTK_IS_ORIENTABLE (orientable));
g_return_if_fail (GTK_IS_WIDGET (orientable));
- context = gtk_widget_get_style_context (GTK_WIDGET (orientable));
orientation = gtk_orientable_get_orientation (orientable);
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_HORIZONTAL);
- gtk_style_context_remove_class (context, GTK_STYLE_CLASS_VERTICAL);
+ gtk_widget_add_style_class (GTK_WIDGET (orientable), GTK_STYLE_CLASS_HORIZONTAL);
+ gtk_widget_remove_style_class (GTK_WIDGET (orientable), GTK_STYLE_CLASS_VERTICAL);
}
else
{
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_VERTICAL);
- gtk_style_context_remove_class (context, GTK_STYLE_CLASS_HORIZONTAL);
+ gtk_widget_add_style_class (GTK_WIDGET (orientable), GTK_STYLE_CLASS_VERTICAL);
+ gtk_widget_remove_style_class (GTK_WIDGET (orientable), GTK_STYLE_CLASS_HORIZONTAL);
}
}
diff --git a/gtk/gtkoverlaylayout.c b/gtk/gtkoverlaylayout.c
index e0c65ba68a..7b703a22db 100644
--- a/gtk/gtkoverlaylayout.c
+++ b/gtk/gtkoverlaylayout.c
@@ -319,22 +319,21 @@ gtk_overlay_child_update_style_classes (GtkOverlay *overlay,
GtkWidget *child,
GtkAllocation *child_allocation)
{
+ GtkWidget *widget = GTK_WIDGET (overlay);
int width, height;
GtkAlign valign, halign;
gboolean is_left, is_right, is_top, is_bottom;
gboolean has_left, has_right, has_top, has_bottom;
- GtkStyleContext *context;
- context = gtk_widget_get_style_context (child);
- has_left = gtk_style_context_has_class (context, GTK_STYLE_CLASS_LEFT);
- has_right = gtk_style_context_has_class (context, GTK_STYLE_CLASS_RIGHT);
- has_top = gtk_style_context_has_class (context, GTK_STYLE_CLASS_TOP);
- has_bottom = gtk_style_context_has_class (context, GTK_STYLE_CLASS_BOTTOM);
+ has_left = gtk_widget_has_style_class (widget, GTK_STYLE_CLASS_LEFT);
+ has_right = gtk_widget_has_style_class (widget, GTK_STYLE_CLASS_RIGHT);
+ has_top = gtk_widget_has_style_class (widget, GTK_STYLE_CLASS_TOP);
+ has_bottom = gtk_widget_has_style_class (widget, GTK_STYLE_CLASS_BOTTOM);
is_left = is_right = is_top = is_bottom = FALSE;
- width = gtk_widget_get_width (GTK_WIDGET (overlay));
- height = gtk_widget_get_height (GTK_WIDGET (overlay));
+ width = gtk_widget_get_width (widget);
+ height = gtk_widget_get_height (widget);
halign = effective_align (gtk_widget_get_halign (child),
gtk_widget_get_direction (child));
@@ -352,24 +351,24 @@ gtk_overlay_child_update_style_classes (GtkOverlay *overlay,
is_bottom = (child_allocation->y + child_allocation->height == height);
if (has_left && !is_left)
- gtk_style_context_remove_class (context, GTK_STYLE_CLASS_LEFT);
+ gtk_widget_remove_style_class (widget, GTK_STYLE_CLASS_LEFT);
else if (!has_left && is_left)
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_LEFT);
+ gtk_widget_add_style_class (widget, GTK_STYLE_CLASS_LEFT);
if (has_right && !is_right)
- gtk_style_context_remove_class (context, GTK_STYLE_CLASS_RIGHT);
+ gtk_widget_remove_style_class (widget, GTK_STYLE_CLASS_RIGHT);
else if (!has_right && is_right)
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_RIGHT);
+ gtk_widget_add_style_class (widget, GTK_STYLE_CLASS_RIGHT);
if (has_top && !is_top)
- gtk_style_context_remove_class (context, GTK_STYLE_CLASS_TOP);
+ gtk_widget_remove_style_class (widget, GTK_STYLE_CLASS_TOP);
else if (!has_top && is_top)
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_TOP);
+ gtk_widget_add_style_class (widget, GTK_STYLE_CLASS_TOP);
if (has_bottom && !is_bottom)
- gtk_style_context_remove_class (context, GTK_STYLE_CLASS_BOTTOM);
+ gtk_widget_remove_style_class (widget, GTK_STYLE_CLASS_BOTTOM);
else if (!has_bottom && is_bottom)
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_BOTTOM);
+ gtk_widget_add_style_class (widget, GTK_STYLE_CLASS_BOTTOM);
}
static void
diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c
index 429c6d5e04..e46ca43912 100644
--- a/gtk/gtkpaned.c
+++ b/gtk/gtkpaned.c
@@ -2417,11 +2417,9 @@ gtk_paned_set_wide_handle (GtkPaned *paned,
if (old_wide != wide)
{
if (wide)
- gtk_style_context_add_class (gtk_widget_get_style_context (priv->handle_widget),
- GTK_STYLE_CLASS_WIDE);
+ gtk_widget_add_style_class (priv->handle_widget, GTK_STYLE_CLASS_WIDE);
else
- gtk_style_context_remove_class (gtk_widget_get_style_context (priv->handle_widget),
- GTK_STYLE_CLASS_WIDE);
+ gtk_widget_remove_style_class (priv->handle_widget, GTK_STYLE_CLASS_WIDE);
g_object_notify_by_pspec (G_OBJECT (paned), paned_props[PROP_WIDE_HANDLE]);
}
@@ -2442,6 +2440,5 @@ gtk_paned_get_wide_handle (GtkPaned *paned)
g_return_val_if_fail (GTK_IS_PANED (paned), FALSE);
- return gtk_style_context_has_class (gtk_widget_get_style_context (priv->handle_widget),
- GTK_STYLE_CLASS_WIDE);
+ return gtk_widget_has_style_class (priv->handle_widget, GTK_STYLE_CLASS_WIDE);
}
diff --git a/gtk/gtkpasswordentry.c b/gtk/gtkpasswordentry.c
index a2eeda7900..a3de52e488 100644
--- a/gtk/gtkpasswordentry.c
+++ b/gtk/gtkpasswordentry.c
@@ -149,11 +149,11 @@ gtk_password_entry_init (GtkPasswordEntry *entry)
priv->icon = gtk_image_new_from_icon_name ("caps-lock-symbolic");
gtk_widget_set_tooltip_text (priv->icon, _("Caps Lock is on"));
- gtk_style_context_add_class (gtk_widget_get_style_context (priv->icon), "caps-lock-indicator");
+ gtk_widget_add_style_class (priv->icon, "caps-lock-indicator");
gtk_widget_set_cursor (priv->icon, gtk_widget_get_cursor (priv->entry));
gtk_widget_set_parent (priv->icon, GTK_WIDGET (entry));
- gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (entry)), I_("password"));
+ gtk_widget_add_style_class (GTK_WIDGET (entry), I_("password"));
gtk_password_entry_set_extra_menu (entry, NULL);
}
diff --git a/gtk/gtkpathbar.c b/gtk/gtkpathbar.c
index f8de07c385..4972311e0d 100644
--- a/gtk/gtkpathbar.c
+++ b/gtk/gtkpathbar.c
@@ -212,7 +212,6 @@ static void
gtk_path_bar_init (GtkPathBar *path_bar)
{
GtkPathBarPrivate *priv = gtk_path_bar_get_instance_private (path_bar);
- GtkStyleContext *context;
GtkEventController *controller;
priv = gtk_path_bar_get_instance_private (path_bar);
@@ -233,8 +232,7 @@ gtk_path_bar_init (GtkPathBar *path_bar)
g_signal_connect_swapped (priv->down_slider_button, "clicked",
G_CALLBACK (gtk_path_bar_scroll_down), path_bar);
- context = gtk_widget_get_style_context (GTK_WIDGET (path_bar));
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_LINKED);
+ gtk_widget_add_style_class (GTK_WIDGET (path_bar), GTK_STYLE_CLASS_LINKED);
priv->get_info_cancellable = NULL;
priv->cancellables = NULL;
@@ -1143,25 +1141,22 @@ gtk_path_bar_update_button_appearance (GtkPathBar *path_bar,
gboolean current_dir)
{
const gchar *dir_name = get_dir_name (button_data);
- GtkStyleContext *context;
- context = gtk_widget_get_style_context (button_data->button);
-
- gtk_style_context_remove_class (context, "text-button");
- gtk_style_context_remove_class (context, "image-button");
+ gtk_widget_remove_style_class (button_data->button, "text-button");
+ gtk_widget_remove_style_class (button_data->button, "image-button");
if (button_data->label != NULL)
{
gtk_label_set_text (GTK_LABEL (button_data->label), dir_name);
if (button_data->image == NULL)
- gtk_style_context_add_class (context, "text-button");
+ gtk_widget_add_style_class (button_data->button, "text-button");
}
if (button_data->image != NULL)
{
set_button_image (path_bar, button_data);
if (button_data->label == NULL)
- gtk_style_context_add_class (context, "image-button");
+ gtk_widget_add_style_class (button_data->button, "image-button");
}
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button_data->button)) != current_dir)
diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c
index 4b9a94d375..5d8bb8caf7 100644
--- a/gtk/gtkplacessidebar.c
+++ b/gtk/gtkplacessidebar.c
@@ -1018,7 +1018,6 @@ update_places (GtkPlacesSidebar *sidebar)
CloudProvidersAccount *cloud_provider_account;
CloudProvidersProvider *cloud_provider;
#endif
- GtkStyleContext *context;
/* save original selection */
selected = gtk_list_box_get_selected_row (GTK_LIST_BOX (sidebar->list_box));
@@ -1437,8 +1436,7 @@ update_places (GtkPlacesSidebar *sidebar)
_("New bookmark"), new_bookmark_icon, NULL, NULL,
NULL, NULL, NULL, NULL, 0,
_("Add a new bookmark"));
- context = gtk_widget_get_style_context (sidebar->new_bookmark_row);
- gtk_style_context_add_class (context, "sidebar-new-bookmark-row");
+ gtk_widget_add_style_class (sidebar->new_bookmark_row, "sidebar-new-bookmark-row");
g_object_unref (new_bookmark_icon);
/* network */
@@ -2646,7 +2644,7 @@ create_rename_popover (GtkPlacesSidebar *sidebar)
gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
g_free (str);
button = gtk_button_new_with_mnemonic (_("_Rename"));
- gtk_style_context_add_class (gtk_widget_get_style_context (button), "suggested-action");
+ gtk_widget_add_style_class (button, "suggested-action");
g_signal_connect (button, "clicked", G_CALLBACK (do_rename), sidebar);
error = gtk_label_new ("");
gtk_widget_set_halign (error, GTK_ALIGN_START);
@@ -2676,18 +2674,16 @@ static void
update_popover_shadowing (GtkWidget *row,
gboolean shown)
{
- GtkStyleContext *context;
gint count;
count = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (row), "popover-count"));
count = shown ? count + 1 : count - 1;
g_object_set_data (G_OBJECT (row), "popover-count", GINT_TO_POINTER (count));
- context = gtk_widget_get_style_context (row);
if (count > 0)
- gtk_style_context_add_class (context, "has-open-popup");
+ gtk_widget_add_style_class (row, "has-open-popup");
else
- gtk_style_context_remove_class (context, "has-open-popup");
+ gtk_widget_remove_style_class (row, "has-open-popup");
}
static void
@@ -4024,7 +4020,6 @@ gtk_places_sidebar_init (GtkPlacesSidebar *sidebar)
GdkContentFormats *formats;
GtkDropTarget *dest;
gboolean show_desktop;
- GtkStyleContext *context;
GtkEventController *controller;
GtkGesture *gesture;
GdkContentFormatsBuilder *builder;
@@ -4056,8 +4051,7 @@ gtk_places_sidebar_init (GtkPlacesSidebar *sidebar)
GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sidebar->swin), GTK_SHADOW_IN);
- context = gtk_widget_get_style_context (GTK_WIDGET (sidebar));
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_SIDEBAR);
+ gtk_widget_add_style_class (GTK_WIDGET (sidebar), "sidebar");
/* list box */
sidebar->list_box = gtk_list_box_new ();
diff --git a/gtk/gtkplacesview.c b/gtk/gtkplacesview.c
index c6915d1d55..250560f300 100644
--- a/gtk/gtkplacesview.c
+++ b/gtk/gtkplacesview.c
@@ -605,7 +605,7 @@ populate_servers (GtkPlacesView *view)
gtk_widget_set_hexpand (label, TRUE);
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
- gtk_style_context_add_class (gtk_widget_get_style_context (label), "dim-label");
+ gtk_widget_add_style_class (label, "dim-label");
gtk_container_add (GTK_CONTAINER (grid), label);
/* remove button */
@@ -613,7 +613,7 @@ populate_servers (GtkPlacesView *view)
gtk_widget_set_halign (button, GTK_ALIGN_END);
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
- gtk_style_context_add_class (gtk_widget_get_style_context (button), "sidebar-button");
+ gtk_widget_add_style_class (button, "sidebar-button");
gtk_grid_attach (GTK_GRID (grid), button, 1, 0, 1, 2);
gtk_container_add (GTK_CONTAINER (row), grid);
@@ -1900,11 +1900,9 @@ on_address_entry_text_changed (GtkPlacesView *view)
out:
gtk_widget_set_sensitive (priv->connect_button, supported);
if (scheme && !supported)
- gtk_style_context_add_class (gtk_widget_get_style_context (priv->address_entry),
- GTK_STYLE_CLASS_ERROR);
+ gtk_widget_add_style_class (priv->address_entry, GTK_STYLE_CLASS_ERROR);
else
- gtk_style_context_remove_class (gtk_widget_get_style_context (priv->address_entry),
- GTK_STYLE_CLASS_ERROR);
+ gtk_widget_add_style_class (priv->address_entry, GTK_STYLE_CLASS_ERROR);
g_free (address);
g_free (scheme);
diff --git a/gtk/gtkpopovermenu.c b/gtk/gtkpopovermenu.c
index 0765c9dd3d..3bacdc53f9 100644
--- a/gtk/gtkpopovermenu.c
+++ b/gtk/gtkpopovermenu.c
@@ -201,7 +201,6 @@ static void
gtk_popover_menu_init (GtkPopoverMenu *popover)
{
GtkWidget *stack;
- GtkStyleContext *style_context;
GtkEventController *controller;
stack = gtk_stack_new ();
@@ -212,8 +211,7 @@ gtk_popover_menu_init (GtkPopoverMenu *popover)
g_signal_connect (stack, "notify::visible-child-name",
G_CALLBACK (visible_submenu_changed), popover);
- style_context = gtk_widget_get_style_context (GTK_WIDGET (popover));
- gtk_style_context_add_class (style_context, GTK_STYLE_CLASS_MENU);
+ gtk_widget_add_style_class (GTK_WIDGET (popover), "menu");
controller = gtk_event_controller_key_new ();
g_signal_connect (controller, "focus-out", G_CALLBACK (focus_out), popover);
@@ -222,7 +220,6 @@ gtk_popover_menu_init (GtkPopoverMenu *popover)
controller = gtk_event_controller_motion_new ();
g_signal_connect (controller, "leave", G_CALLBACK (leave_cb), popover);
gtk_widget_add_controller (GTK_WIDGET (popover), controller);
-
}
static void
diff --git a/gtk/gtkprogressbar.c b/gtk/gtkprogressbar.c
index c950dcfff2..d0d8786d6b 100644
--- a/gtk/gtkprogressbar.c
+++ b/gtk/gtkprogressbar.c
@@ -266,7 +266,6 @@ static void
update_fraction_classes (GtkProgressBar *pbar)
{
GtkProgressBarPrivate *priv = gtk_progress_bar_get_instance_private (pbar);
- GtkStyleContext *context;
gboolean empty = FALSE;
gboolean full = FALSE;
@@ -281,25 +280,22 @@ update_fraction_classes (GtkProgressBar *pbar)
full = TRUE;
}
- context = gtk_widget_get_style_context (priv->trough_widget);
-
if (empty)
- gtk_style_context_add_class (context, "empty");
+ gtk_widget_add_style_class (priv->trough_widget, "empty");
else
- gtk_style_context_remove_class (context, "empty");
+ gtk_widget_remove_style_class (priv->trough_widget, "empty");
if (full)
- gtk_style_context_add_class (context, "full");
+ gtk_widget_add_style_class (priv->trough_widget, "full");
else
- gtk_style_context_remove_class (context, "full");
+ gtk_widget_remove_style_class (priv->trough_widget, "full");
}
static void
update_node_classes (GtkProgressBar *pbar)
{
GtkProgressBarPrivate *priv = gtk_progress_bar_get_instance_private (pbar);
- GtkStyleContext *context;
- gboolean left = FALSE;
+ gboolean left = FALSE;
gboolean right = FALSE;
gboolean top = FALSE;
gboolean bottom = FALSE;
@@ -344,27 +340,25 @@ update_node_classes (GtkProgressBar *pbar)
}
}
- context = gtk_widget_get_style_context (priv->progress_widget);
-
if (left)
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_LEFT);
+ gtk_widget_add_style_class (priv->progress_widget, GTK_STYLE_CLASS_LEFT);
else
- gtk_style_context_remove_class (context, GTK_STYLE_CLASS_LEFT);
+ gtk_widget_remove_style_class (priv->progress_widget, GTK_STYLE_CLASS_LEFT);
if (right)
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_RIGHT);
+ gtk_widget_add_style_class (priv->progress_widget, GTK_STYLE_CLASS_RIGHT);
else
- gtk_style_context_remove_class (context, GTK_STYLE_CLASS_RIGHT);
+ gtk_widget_remove_style_class (priv->progress_widget, GTK_STYLE_CLASS_RIGHT);
if (top)
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_TOP);
+ gtk_widget_add_style_class (priv->progress_widget, GTK_STYLE_CLASS_TOP);
else
- gtk_style_context_remove_class (context, GTK_STYLE_CLASS_TOP);
+ gtk_widget_remove_style_class (priv->progress_widget, GTK_STYLE_CLASS_TOP);
if (bottom)
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_BOTTOM);
+ gtk_widget_add_style_class (priv->progress_widget, GTK_STYLE_CLASS_BOTTOM);
else
- gtk_style_context_remove_class (context, GTK_STYLE_CLASS_BOTTOM);
+ gtk_widget_remove_style_class (priv->progress_widget, GTK_STYLE_CLASS_BOTTOM);
update_fraction_classes (pbar);
}
@@ -667,7 +661,7 @@ gtk_progress_bar_act_mode_enter (GtkProgressBar *pbar)
GtkWidget *widget = GTK_WIDGET (pbar);
gboolean inverted;
- gtk_style_context_add_class (gtk_widget_get_style_context (priv->progress_widget), GTK_STYLE_CLASS_PULSE);
+ gtk_widget_add_style_class (priv->progress_widget, GTK_STYLE_CLASS_PULSE);
inverted = priv->inverted;
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
@@ -707,8 +701,7 @@ gtk_progress_bar_act_mode_leave (GtkProgressBar *pbar)
gtk_widget_remove_tick_callback (GTK_WIDGET (pbar), priv->tick_id);
priv->tick_id = 0;
- gtk_style_context_remove_class (gtk_widget_get_style_context (priv->progress_widget),
- GTK_STYLE_CLASS_PULSE);
+ gtk_widget_remove_style_class (priv->progress_widget, GTK_STYLE_CLASS_PULSE);
update_node_classes (pbar);
}
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index b2c2ae5d1d..f05069fa32 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -712,22 +712,19 @@ static void
update_highlight_position (GtkRange *range)
{
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
- GtkStyleContext *context;
if (!priv->highlight_widget)
return;
- context = gtk_widget_get_style_context (priv->highlight_widget);
-
if (should_invert (range))
{
- gtk_style_context_remove_class (context, GTK_STYLE_CLASS_TOP);
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_BOTTOM);
+ gtk_widget_add_style_class (priv->highlight_widget, GTK_STYLE_CLASS_BOTTOM);
+ gtk_widget_remove_style_class (priv->highlight_widget, GTK_STYLE_CLASS_TOP);
}
else
{
- gtk_style_context_remove_class (context, GTK_STYLE_CLASS_BOTTOM);
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_TOP);
+ gtk_widget_add_style_class (priv->highlight_widget, GTK_STYLE_CLASS_TOP);
+ gtk_widget_remove_style_class (priv->highlight_widget, GTK_STYLE_CLASS_BOTTOM);
}
}
@@ -735,22 +732,19 @@ static void
update_fill_position (GtkRange *range)
{
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
- GtkStyleContext *context;
if (!priv->fill_widget)
return;
- context = gtk_widget_get_style_context (priv->fill_widget);
-
if (should_invert (range))
{
- gtk_style_context_remove_class (context, GTK_STYLE_CLASS_TOP);
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_BOTTOM);
+ gtk_widget_add_style_class (priv->fill_widget, GTK_STYLE_CLASS_BOTTOM);
+ gtk_widget_remove_style_class (priv->fill_widget, GTK_STYLE_CLASS_TOP);
}
else
{
- gtk_style_context_remove_class (context, GTK_STYLE_CLASS_BOTTOM);
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_TOP);
+ gtk_widget_add_style_class (priv->fill_widget, GTK_STYLE_CLASS_TOP);
+ gtk_widget_remove_style_class (priv->fill_widget, GTK_STYLE_CLASS_BOTTOM);
}
}
@@ -1662,9 +1656,6 @@ range_grab_add (GtkRange *range,
GtkWidget *location)
{
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
- GtkStyleContext *context;
-
- context = gtk_widget_get_style_context (GTK_WIDGET (range));
/* Don't perform any GDK/GTK+ grab here. Since a button
* is down, there's an ongoing implicit grab on
@@ -1673,7 +1664,7 @@ range_grab_add (GtkRange *range,
*/
priv->grab_location = location;
- gtk_style_context_add_class (context, "dragging");
+ gtk_widget_add_style_class (GTK_WIDGET (range), "dragging");
}
static void
@@ -1681,14 +1672,11 @@ update_zoom_state (GtkRange *range,
gboolean enabled)
{
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
- GtkStyleContext *context;
-
- context = gtk_widget_get_style_context (GTK_WIDGET (range));
if (enabled)
- gtk_style_context_add_class (context, "fine-tune");
+ gtk_widget_add_style_class (GTK_WIDGET (range), "fine-tune");
else
- gtk_style_context_remove_class (context, "fine-tune");
+ gtk_widget_remove_style_class (GTK_WIDGET (range), "fine-tune");
priv->zoom = enabled;
}
@@ -1697,18 +1685,15 @@ static void
range_grab_remove (GtkRange *range)
{
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
- GtkStyleContext *context;
if (!priv->grab_location)
return;
- context = gtk_widget_get_style_context (GTK_WIDGET (range));
-
priv->grab_location = NULL;
update_zoom_state (range, FALSE);
- gtk_style_context_remove_class (context, "dragging");
+ gtk_widget_remove_style_class (GTK_WIDGET (range), "dragging");
}
static GtkScrollType
diff --git a/gtk/gtkscale.c b/gtk/gtkscale.c
index 918ecb3bbb..e49675934a 100644
--- a/gtk/gtkscale.c
+++ b/gtk/gtkscale.c
@@ -1042,24 +1042,21 @@ static void
update_value_position (GtkScale *scale)
{
GtkScalePrivate *priv = gtk_scale_get_instance_private (scale);
- GtkStyleContext *context;
if (!priv->value_widget)
return;
- context = gtk_widget_get_style_context (priv->value_widget);
-
- gtk_style_context_remove_class (context, GTK_STYLE_CLASS_TOP);
- gtk_style_context_remove_class (context, GTK_STYLE_CLASS_RIGHT);
- gtk_style_context_remove_class (context, GTK_STYLE_CLASS_BOTTOM);
- gtk_style_context_remove_class (context, GTK_STYLE_CLASS_LEFT);
+ gtk_widget_remove_style_class (priv->value_widget, GTK_STYLE_CLASS_TOP);
+ gtk_widget_remove_style_class (priv->value_widget, GTK_STYLE_CLASS_RIGHT);
+ gtk_widget_remove_style_class (priv->value_widget, GTK_STYLE_CLASS_BOTTOM);
+ gtk_widget_remove_style_class (priv->value_widget, GTK_STYLE_CLASS_LEFT);
switch (priv->value_pos)
{
- case GTK_POS_TOP: gtk_style_context_add_class (context, GTK_STYLE_CLASS_TOP); break;
- case GTK_POS_RIGHT: gtk_style_context_add_class (context, GTK_STYLE_CLASS_RIGHT); break;
- case GTK_POS_BOTTOM: gtk_style_context_add_class (context, GTK_STYLE_CLASS_BOTTOM); break;
- case GTK_POS_LEFT: gtk_style_context_add_class (context, GTK_STYLE_CLASS_LEFT); break;
+ case GTK_POS_TOP: gtk_widget_add_style_class (priv->value_widget, GTK_STYLE_CLASS_TOP); break;
+ case GTK_POS_RIGHT: gtk_widget_add_style_class (priv->value_widget, GTK_STYLE_CLASS_RIGHT); break;
+ case GTK_POS_BOTTOM: gtk_widget_add_style_class (priv->value_widget, GTK_STYLE_CLASS_BOTTOM); break;
+ case GTK_POS_LEFT: gtk_widget_add_style_class (priv->value_widget, GTK_STYLE_CLASS_LEFT); break;
default: g_assert_not_reached ();
}
@@ -1646,20 +1643,17 @@ void
gtk_scale_clear_marks (GtkScale *scale)
{
GtkScalePrivate *priv = gtk_scale_get_instance_private (scale);
- GtkStyleContext *context;
g_return_if_fail (GTK_IS_SCALE (scale));
g_slist_free_full (priv->marks, gtk_scale_mark_free);
priv->marks = NULL;
-
g_clear_pointer (&priv->top_marks_widget, gtk_widget_unparent);
g_clear_pointer (&priv->bottom_marks_widget, gtk_widget_unparent);
- context = gtk_widget_get_style_context (GTK_WIDGET (scale));
- gtk_style_context_remove_class (context, "marks-before");
- gtk_style_context_remove_class (context, "marks-after");
+ gtk_widget_remove_style_class (GTK_WIDGET (scale), "marks-before");
+ gtk_widget_remove_style_class (GTK_WIDGET (scale), "marks-after");
_gtk_range_set_stop_values (GTK_RANGE (scale), NULL, 0);
@@ -1700,7 +1694,6 @@ gtk_scale_add_mark (GtkScale *scale,
GSList *m;
gdouble *values;
gint n, i;
- GtkStyleContext *context;
GtkWidget *marks_widget;
g_return_if_fail (GTK_IS_SCALE (scale));
@@ -1735,8 +1728,7 @@ gtk_scale_add_mark (GtkScale *scale,
(priv->value_widget &&
(priv->value_pos == GTK_POS_TOP || priv->value_pos == GTK_POS_LEFT)) ?
priv->value_widget : NULL);
- gtk_style_context_add_class (gtk_widget_get_style_context (priv->top_marks_widget),
- GTK_STYLE_CLASS_TOP);
+ gtk_widget_add_style_class (priv->top_marks_widget, GTK_STYLE_CLASS_TOP);
}
marks_widget = priv->top_marks_widget;
}
@@ -1755,8 +1747,7 @@ gtk_scale_add_mark (GtkScale *scale,
(priv->value_widget &&
(priv->value_pos == GTK_POS_BOTTOM || priv->value_pos ==
GTK_POS_RIGHT)) ?
priv->value_widget: NULL);
- gtk_style_context_add_class (gtk_widget_get_style_context (priv->bottom_marks_widget),
- GTK_STYLE_CLASS_BOTTOM);
+ gtk_widget_add_style_class (priv->bottom_marks_widget, GTK_STYLE_CLASS_BOTTOM);
}
marks_widget = priv->bottom_marks_widget;
}
@@ -1810,11 +1801,11 @@ gtk_scale_add_mark (GtkScale *scale,
g_free (values);
- context = gtk_widget_get_style_context (GTK_WIDGET (scale));
if (priv->top_marks_widget)
- gtk_style_context_add_class (context, "marks-before");
+ gtk_widget_add_style_class (GTK_WIDGET (scale), "marks-before");
+
if (priv->bottom_marks_widget)
- gtk_style_context_add_class (context, "marks-after");
+ gtk_widget_add_style_class (GTK_WIDGET (scale), "marks-after");
gtk_widget_queue_resize (widget);
}
diff --git a/gtk/gtkscalebutton.c b/gtk/gtkscalebutton.c
index fa683db75f..8f22f01311 100644
--- a/gtk/gtkscalebutton.c
+++ b/gtk/gtkscalebutton.c
@@ -369,7 +369,6 @@ static void
gtk_scale_button_init (GtkScaleButton *button)
{
GtkScaleButtonPrivate *priv = gtk_scale_button_get_instance_private (button);
- GtkStyleContext *context;
GtkEventController *controller;
priv->click_id = 0;
@@ -384,8 +383,7 @@ gtk_scale_button_init (GtkScaleButton *button)
g_object_ref_sink (priv->adjustment);
gtk_range_set_adjustment (GTK_RANGE (priv->scale), priv->adjustment);
- context = gtk_widget_get_style_context (GTK_WIDGET (button));
- gtk_style_context_add_class (context, "scale");
+ gtk_widget_add_style_class (GTK_WIDGET (button), "scale");
controller = gtk_event_controller_scroll_new (GTK_EVENT_CONTROLLER_SCROLL_VERTICAL);
g_signal_connect (controller, "scroll",
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index 83b4c1e285..c992034499 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -462,28 +462,25 @@ static void
update_scrollbar_positions (GtkScrolledWindow *scrolled_window)
{
GtkScrolledWindowPrivate *priv = gtk_scrolled_window_get_instance_private (scrolled_window);
- GtkStyleContext *context;
gboolean is_rtl;
if (priv->hscrollbar != NULL)
{
- context = gtk_widget_get_style_context (priv->hscrollbar);
if (priv->window_placement == GTK_CORNER_TOP_LEFT ||
priv->window_placement == GTK_CORNER_TOP_RIGHT)
{
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_BOTTOM);
- gtk_style_context_remove_class (context, GTK_STYLE_CLASS_TOP);
+ gtk_widget_add_style_class (priv->hscrollbar, GTK_STYLE_CLASS_BOTTOM);
+ gtk_widget_remove_style_class (priv->hscrollbar, GTK_STYLE_CLASS_TOP);
}
else
{
- gtk_style_context_remove_class (context, GTK_STYLE_CLASS_BOTTOM);
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_TOP);
+ gtk_widget_add_style_class (priv->hscrollbar, GTK_STYLE_CLASS_TOP);
+ gtk_widget_remove_style_class (priv->hscrollbar, GTK_STYLE_CLASS_BOTTOM);
}
}
if (priv->vscrollbar != NULL)
{
- context = gtk_widget_get_style_context (priv->vscrollbar);
is_rtl = _gtk_widget_get_direction (GTK_WIDGET (scrolled_window)) == GTK_TEXT_DIR_RTL;
if ((is_rtl &&
(priv->window_placement == GTK_CORNER_TOP_RIGHT ||
@@ -492,13 +489,13 @@ update_scrollbar_positions (GtkScrolledWindow *scrolled_window)
(priv->window_placement == GTK_CORNER_TOP_LEFT ||
priv->window_placement == GTK_CORNER_BOTTOM_LEFT)))
{
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_RIGHT);
- gtk_style_context_remove_class (context, GTK_STYLE_CLASS_LEFT);
+ gtk_widget_add_style_class (priv->vscrollbar, GTK_STYLE_CLASS_RIGHT);
+ gtk_widget_remove_style_class (priv->vscrollbar, GTK_STYLE_CLASS_LEFT);
}
else
{
- gtk_style_context_remove_class (context, GTK_STYLE_CLASS_RIGHT);
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_LEFT);
+ gtk_widget_add_style_class (priv->vscrollbar, GTK_STYLE_CLASS_LEFT);
+ gtk_widget_remove_style_class (priv->vscrollbar, GTK_STYLE_CLASS_RIGHT);
}
}
}
@@ -1036,8 +1033,6 @@ static void
indicator_set_over (Indicator *indicator,
gboolean over)
{
- GtkStyleContext *context;
-
if (indicator->over_timeout_id)
{
g_source_remove (indicator->over_timeout_id);
@@ -1047,13 +1042,12 @@ indicator_set_over (Indicator *indicator,
if (indicator->over == over)
return;
- context = gtk_widget_get_style_context (indicator->scrollbar);
indicator->over = over;
if (indicator->over)
- gtk_style_context_add_class (context, "hovering");
+ gtk_widget_add_style_class (indicator->scrollbar, "hovering");
else
- gtk_style_context_remove_class (context, "hovering");
+ gtk_widget_remove_style_class (indicator->scrollbar, "hovering");
gtk_widget_queue_resize (indicator->scrollbar);
}
@@ -2439,10 +2433,9 @@ gtk_scrolled_window_unset_placement (GtkScrolledWindow *scrolled_window)
**/
void
gtk_scrolled_window_set_shadow_type (GtkScrolledWindow *scrolled_window,
- GtkShadowType type)
+ GtkShadowType type)
{
GtkScrolledWindowPrivate *priv = gtk_scrolled_window_get_instance_private (scrolled_window);
- GtkStyleContext *context;
g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window));
g_return_if_fail (type >= GTK_SHADOW_NONE && type <= GTK_SHADOW_ETCHED_OUT);
@@ -2451,11 +2444,10 @@ gtk_scrolled_window_set_shadow_type (GtkScrolledWindow *scrolled_window,
{
priv->shadow_type = type;
- context = gtk_widget_get_style_context (GTK_WIDGET (scrolled_window));
if (type != GTK_SHADOW_NONE)
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_FRAME);
+ gtk_widget_add_style_class (GTK_WIDGET (scrolled_window), GTK_STYLE_CLASS_FRAME);
else
- gtk_style_context_remove_class (context, GTK_STYLE_CLASS_FRAME);
+ gtk_widget_remove_style_class (GTK_WIDGET (scrolled_window), GTK_STYLE_CLASS_FRAME);
g_object_notify_by_pspec (G_OBJECT (scrolled_window), properties[PROP_SHADOW_TYPE]);
}
@@ -3763,18 +3755,16 @@ setup_indicator (GtkScrolledWindow *scrolled_window,
Indicator *indicator,
GtkWidget *scrollbar)
{
- GtkStyleContext *context;
GtkAdjustment *adjustment;
if (scrollbar == NULL)
return;
- context = gtk_widget_get_style_context (scrollbar);
adjustment = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (scrollbar));
indicator->scrollbar = scrollbar;
- gtk_style_context_add_class (context, "overlay-indicator");
+ gtk_widget_add_style_class (scrollbar, "overlay-indicator");
g_signal_connect (adjustment, "value-changed",
G_CALLBACK (indicator_value_changed), indicator);
@@ -3787,7 +3777,6 @@ remove_indicator (GtkScrolledWindow *scrolled_window,
Indicator *indicator)
{
GtkWidget *scrollbar;
- GtkStyleContext *context;
GtkAdjustment *adjustment;
if (indicator->scrollbar == NULL)
@@ -3796,8 +3785,7 @@ remove_indicator (GtkScrolledWindow *scrolled_window,
scrollbar = indicator->scrollbar;
indicator->scrollbar = NULL;
- context = gtk_widget_get_style_context (scrollbar);
- gtk_style_context_remove_class (context, "overlay-indicator");
+ gtk_widget_remove_style_class (scrollbar, "overlay-indicator");
adjustment = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (scrollbar));
g_signal_handlers_disconnect_by_data (adjustment, indicator);
diff --git a/gtk/gtksearchbar.c b/gtk/gtksearchbar.c
index 484e97342c..1338b3e625 100644
--- a/gtk/gtksearchbar.c
+++ b/gtk/gtksearchbar.c
@@ -351,7 +351,7 @@ gtk_search_bar_init (GtkSearchBar *bar)
gtk_widget_set_hexpand (priv->box_center, TRUE);
priv->close_button = gtk_button_new_from_icon_name ("window-close-symbolic");
- gtk_style_context_add_class (gtk_widget_get_style_context (priv->close_button), "close");
+ gtk_widget_add_style_class (priv->close_button, "close");
gtk_center_box_set_end_widget (GTK_CENTER_BOX (priv->box_center), priv->close_button);
gtk_widget_hide (priv->close_button);
diff --git a/gtk/gtksearchentry.c b/gtk/gtksearchentry.c
index f701ac21be..6baf857b80 100644
--- a/gtk/gtksearchentry.c
+++ b/gtk/gtksearchentry.c
@@ -540,7 +540,7 @@ gtk_search_entry_init (GtkSearchEntry *entry)
g_signal_connect (press, "released", G_CALLBACK (gtk_search_entry_icon_release), entry);
gtk_widget_add_controller (priv->icon, GTK_EVENT_CONTROLLER (press));
- gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (entry)), I_("search"));
+ gtk_widget_add_style_class (GTK_WIDGET (entry), I_("search"));
}
/**
diff --git a/gtk/gtkseparatortoolitem.c b/gtk/gtkseparatortoolitem.c
index 2bd71cfd90..10bb29ecc7 100644
--- a/gtk/gtkseparatortoolitem.c
+++ b/gtk/gtkseparatortoolitem.c
@@ -188,13 +188,9 @@ gtk_separator_tool_item_new (void)
gboolean
gtk_separator_tool_item_get_draw (GtkSeparatorToolItem *item)
{
- GtkStyleContext *context;
-
g_return_val_if_fail (GTK_IS_SEPARATOR_TOOL_ITEM (item), FALSE);
- context = gtk_widget_get_style_context (GTK_WIDGET (item));
-
- return !gtk_style_context_has_class (context, "invisible");
+ return !gtk_widget_has_style_class (GTK_WIDGET (item), "invisible");
}
/**
@@ -218,11 +214,9 @@ gtk_separator_tool_item_set_draw (GtkSeparatorToolItem *item,
return;
if (draw)
- gtk_style_context_remove_class (gtk_widget_get_style_context (GTK_WIDGET (item)),
- "invisible");
+ gtk_widget_remove_style_class (GTK_WIDGET (item), "invisible");
else
- gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (item)),
- "invisible");
+ gtk_widget_add_style_class (GTK_WIDGET (item), "invisible");
g_object_notify (G_OBJECT (item), "draw");
}
diff --git a/gtk/gtkshortcutlabel.c b/gtk/gtkshortcutlabel.c
index 4afa3f901f..9dc6355333 100644
--- a/gtk/gtkshortcutlabel.c
+++ b/gtk/gtkshortcutlabel.c
@@ -258,7 +258,7 @@ dim_label (const gchar *text)
GtkWidget *label;
label = gtk_label_new (text);
- gtk_style_context_add_class (gtk_widget_get_style_context (label), "dim-label");
+ gtk_widget_add_style_class (label, "dim-label");
return label;
}
@@ -284,7 +284,7 @@ display_shortcut (GtkWidget *self,
if (i < n_mods)
gtk_widget_set_size_request (disp, 50, -1);
- gtk_style_context_add_class (gtk_widget_get_style_context (disp), "keycap");
+ gtk_widget_add_style_class (disp, "keycap");
gtk_label_set_use_markup (GTK_LABEL (disp), TRUE);
gtk_widget_set_parent (disp, self);
diff --git a/gtk/gtkshortcutssection.c b/gtk/gtkshortcutssection.c
index 0bb55fee01..bf68dd678f 100644
--- a/gtk/gtkshortcutssection.c
+++ b/gtk/gtkshortcutssection.c
@@ -433,7 +433,7 @@ gtk_shortcuts_section_init (GtkShortcutsSection *self)
"visible", FALSE,
NULL);
- gtk_style_context_remove_class (gtk_widget_get_style_context (GTK_WIDGET (self->switcher)),
GTK_STYLE_CLASS_LINKED);
+ gtk_widget_remove_style_class (GTK_WIDGET (self->switcher), GTK_STYLE_CLASS_LINKED);
self->show_all = gtk_button_new_with_mnemonic (_("_Show All"));
gtk_widget_hide (self->show_all);
@@ -729,8 +729,7 @@ gtk_shortcuts_section_reflow_groups (GtkShortcutsSection *self)
{
GtkWidget *w;
- gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (self->switcher)),
- "circular");
+ gtk_widget_add_style_class (GTK_WIDGET (self->switcher), "circular");
for (w = gtk_widget_get_first_child (GTK_WIDGET (self->switcher));
w != NULL;
@@ -738,7 +737,7 @@ gtk_shortcuts_section_reflow_groups (GtkShortcutsSection *self)
{
GtkWidget *label;
- gtk_style_context_add_class (gtk_widget_get_style_context (w), "circular");
+ gtk_widget_add_style_class (w, "circular");
label = gtk_bin_get_child (GTK_BIN (w));
gtk_label_set_use_underline (GTK_LABEL (label), TRUE);
diff --git a/gtk/gtkshortcutswindow.c b/gtk/gtkshortcutswindow.c
index bea8e84122..84e7298964 100644
--- a/gtk/gtkshortcutswindow.c
+++ b/gtk/gtkshortcutswindow.c
@@ -917,18 +917,18 @@ gtk_shortcuts_window_init (GtkShortcutsWindow *self)
/* Translators: This is the window title for the shortcuts window in normal mode */
label = gtk_label_new (_("Shortcuts"));
- gtk_style_context_add_class (gtk_widget_get_style_context (label), GTK_STYLE_CLASS_TITLE);
+ gtk_widget_add_style_class (label, GTK_STYLE_CLASS_TITLE);
gtk_stack_add_named (priv->title_stack, label, "title");
/* Translators: This is the window title for the shortcuts window in search mode */
label = gtk_label_new (_("Search Results"));
- gtk_style_context_add_class (gtk_widget_get_style_context (label), GTK_STYLE_CLASS_TITLE);
+ gtk_widget_add_style_class (label, GTK_STYLE_CLASS_TITLE);
gtk_stack_add_named (priv->title_stack, label, "search");
priv->menu_button = g_object_new (GTK_TYPE_MENU_BUTTON,
"focus-on-click", FALSE,
NULL);
- gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (priv->menu_button)), "flat");
+ gtk_widget_add_style_class (GTK_WIDGET (priv->menu_button), "flat");
gtk_stack_add_named (priv->title_stack, GTK_WIDGET (priv->menu_button), "sections");
priv->popover = g_object_new (GTK_TYPE_POPOVER,
@@ -971,7 +971,7 @@ gtk_shortcuts_window_init (GtkShortcutsWindow *self)
"halign", GTK_ALIGN_CENTER,
"orientation", GTK_ORIENTATION_VERTICAL,
NULL);
- gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (box)), "shortcuts-search-results");
+ gtk_widget_add_style_class (GTK_WIDGET (box), "shortcuts-search-results");
gtk_container_add (GTK_CONTAINER (scroller), GTK_WIDGET (box));
gtk_stack_add_named (priv->stack, scroller, "internal-search");
@@ -997,7 +997,7 @@ gtk_shortcuts_window_init (GtkShortcutsWindow *self)
"halign", GTK_ALIGN_CENTER,
"valign", GTK_ALIGN_CENTER,
NULL);
- gtk_style_context_add_class (gtk_widget_get_style_context (empty), GTK_STYLE_CLASS_DIM_LABEL);
+ gtk_widget_add_style_class (empty, GTK_STYLE_CLASS_DIM_LABEL);
gtk_grid_attach (GTK_GRID (empty),
g_object_new (GTK_TYPE_IMAGE,
"icon-name", "edit-find-symbolic",
diff --git a/gtk/gtksidebarrow.c b/gtk/gtksidebarrow.c
index 9b7fedd1ae..35ce3d0534 100644
--- a/gtk/gtksidebarrow.c
+++ b/gtk/gtksidebarrow.c
@@ -212,7 +212,6 @@ gtk_sidebar_row_set_property (GObject *object,
GParamSpec *pspec)
{
GtkSidebarRow *self = GTK_SIDEBAR_ROW (object);
- GtkStyleContext *context;
switch (prop_id)
{
@@ -353,8 +352,7 @@ gtk_sidebar_row_set_property (GObject *object,
(GtkCallback) gtk_widget_destroy,
NULL);
- context = gtk_widget_get_style_context (GTK_WIDGET (self));
- gtk_style_context_add_class (context, "sidebar-placeholder-row");
+ gtk_widget_add_style_class (GTK_WIDGET (self), "sidebar-placeholder-row");
}
break;
diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c
index 93484a617f..c2e916b87b 100644
--- a/gtk/gtkspinbutton.c
+++ b/gtk/gtkspinbutton.c
@@ -965,7 +965,7 @@ gtk_spin_button_init (GtkSpinButton *spin_button)
gtk_widget_set_parent (priv->entry, GTK_WIDGET (spin_button));
priv->down_button = gtk_button_new_from_icon_name ("value-decrease-symbolic");
- gtk_style_context_add_class (gtk_widget_get_style_context (priv->down_button), "down");
+ gtk_widget_add_style_class (priv->down_button, "down");
gtk_widget_set_can_focus (priv->down_button, FALSE);
gtk_widget_set_parent (priv->down_button, GTK_WIDGET (spin_button));
@@ -980,7 +980,7 @@ gtk_spin_button_init (GtkSpinButton *spin_button)
gtk_widget_add_controller (GTK_WIDGET (priv->down_button), GTK_EVENT_CONTROLLER (gesture));
priv->up_button = gtk_button_new_from_icon_name ("value-increase-symbolic");
- gtk_style_context_add_class (gtk_widget_get_style_context (priv->up_button), "up");
+ gtk_widget_add_style_class (priv->up_button, "up");
gtk_widget_set_can_focus (priv->up_button, FALSE);
gtk_widget_set_parent (priv->up_button, GTK_WIDGET (spin_button));
diff --git a/gtk/gtkstacksidebar.c b/gtk/gtkstacksidebar.c
index 31b5025de4..82ef454312 100644
--- a/gtk/gtkstacksidebar.c
+++ b/gtk/gtkstacksidebar.c
@@ -154,7 +154,6 @@ gtk_stack_sidebar_row_selected (GtkListBox *box,
static void
gtk_stack_sidebar_init (GtkStackSidebar *self)
{
- GtkStyleContext *style;
GtkWidget *sw;
sw = gtk_scrolled_window_new (NULL, NULL);
@@ -173,8 +172,7 @@ gtk_stack_sidebar_init (GtkStackSidebar *self)
g_signal_connect (self->list, "row-selected",
G_CALLBACK (gtk_stack_sidebar_row_selected), self);
- style = gtk_widget_get_style_context (GTK_WIDGET (self));
- gtk_style_context_add_class (style, "sidebar");
+ gtk_widget_add_style_class (GTK_WIDGET (self), "sidebar");
self->rows = g_hash_table_new (NULL, NULL);
}
@@ -188,7 +186,6 @@ update_row (GtkStackSidebar *self,
gchar *title;
gboolean needs_attention;
gboolean visible;
- GtkStyleContext *context;
g_object_get (page,
"title", &title,
@@ -201,11 +198,10 @@ update_row (GtkStackSidebar *self,
gtk_widget_set_visible (row, visible && title != NULL);
- context = gtk_widget_get_style_context (row);
if (needs_attention)
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_NEEDS_ATTENTION);
+ gtk_widget_add_style_class (row, GTK_STYLE_CLASS_NEEDS_ATTENTION);
else
- gtk_style_context_remove_class (context, GTK_STYLE_CLASS_NEEDS_ATTENTION);
+ gtk_widget_remove_style_class (row, GTK_STYLE_CLASS_NEEDS_ATTENTION);
g_free (title);
}
diff --git a/gtk/gtkstackswitcher.c b/gtk/gtkstackswitcher.c
index c9d30fecf1..572c108958 100644
--- a/gtk/gtkstackswitcher.c
+++ b/gtk/gtkstackswitcher.c
@@ -111,14 +111,12 @@ static void
gtk_stack_switcher_init (GtkStackSwitcher *switcher)
{
GtkStackSwitcherPrivate *priv = gtk_stack_switcher_get_instance_private (switcher);
- GtkStyleContext *context;
GdkContentFormats *formats;
GtkDropTarget *dest;
priv->buttons = g_hash_table_new_full (g_direct_hash, g_direct_equal, g_object_unref, NULL);
- context = gtk_widget_get_style_context (GTK_WIDGET (switcher));
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_LINKED);
+ gtk_widget_add_style_class (GTK_WIDGET (switcher), "linked");
formats = gdk_content_formats_new (NULL, 0);
dest = gtk_drop_target_new (formats, 0);
@@ -157,7 +155,6 @@ rebuild_child (GtkWidget *self,
const gchar *icon_name,
const gchar *title)
{
- GtkStyleContext *context;
GtkWidget *button_child;
button_child = gtk_bin_get_child (GTK_BIN (self));
@@ -165,7 +162,6 @@ rebuild_child (GtkWidget *self,
gtk_widget_destroy (button_child);
button_child = NULL;
- context = gtk_widget_get_style_context (GTK_WIDGET (self));
if (icon_name != NULL)
{
@@ -173,8 +169,8 @@ rebuild_child (GtkWidget *self,
if (title != NULL)
gtk_widget_set_tooltip_text (GTK_WIDGET (self), title);
- gtk_style_context_remove_class (context, "text-button");
- gtk_style_context_add_class (context, "image-button");
+ gtk_widget_remove_style_class (self, "text-button");
+ gtk_widget_add_style_class (self, "image-button");
}
else if (title != NULL)
{
@@ -182,8 +178,8 @@ rebuild_child (GtkWidget *self,
gtk_widget_set_tooltip_text (GTK_WIDGET (self), NULL);
- gtk_style_context_remove_class (context, "image-button");
- gtk_style_context_add_class (context, "text-button");
+ gtk_widget_remove_style_class (self, "image-button");
+ gtk_widget_add_style_class (self, "text-button");
}
if (button_child)
@@ -202,7 +198,6 @@ update_button (GtkStackSwitcher *self,
gchar *icon_name;
gboolean needs_attention;
gboolean visible;
- GtkStyleContext *context;
g_object_get (page,
"title", &title,
@@ -215,11 +210,10 @@ update_button (GtkStackSwitcher *self,
gtk_widget_set_visible (button, visible && (title != NULL || icon_name != NULL));
- context = gtk_widget_get_style_context (button);
if (needs_attention)
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_NEEDS_ATTENTION);
+ gtk_widget_add_style_class (button, GTK_STYLE_CLASS_NEEDS_ATTENTION);
else
- gtk_style_context_remove_class (context, GTK_STYLE_CLASS_NEEDS_ATTENTION);
+ gtk_widget_remove_style_class (button, GTK_STYLE_CLASS_NEEDS_ATTENTION);
g_free (title);
g_free (icon_name);
diff --git a/gtk/gtktext.c b/gtk/gtktext.c
index a3df9f7cee..752d2de1a0 100644
--- a/gtk/gtktext.c
+++ b/gtk/gtktext.c
@@ -1899,8 +1899,7 @@ gtk_text_ensure_magnifier (GtkText *self)
gtk_widget_set_size_request (priv->magnifier, 100, 60);
_gtk_magnifier_set_magnification (GTK_MAGNIFIER (priv->magnifier), 2.0);
priv->magnifier_popover = gtk_popover_new (GTK_WIDGET (self));
- gtk_style_context_add_class (gtk_widget_get_style_context (priv->magnifier_popover),
- "magnifier");
+ gtk_widget_add_style_class (priv->magnifier_popover, "magnifier");
gtk_popover_set_autohide (GTK_POPOVER (priv->magnifier_popover), FALSE);
gtk_container_add (GTK_CONTAINER (priv->magnifier_popover),
priv->magnifier);
@@ -5324,7 +5323,6 @@ gtk_text_set_editable (GtkText *self,
gboolean is_editable)
{
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
- GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (self));
if (is_editable != priv->editable)
{
@@ -5339,11 +5337,11 @@ gtk_text_set_editable (GtkText *self,
priv->preedit_length = 0;
priv->preedit_cursor = 0;
- gtk_style_context_remove_class (context, GTK_STYLE_CLASS_READ_ONLY);
+ gtk_widget_remove_style_class (GTK_WIDGET (self), GTK_STYLE_CLASS_READ_ONLY);
}
else
{
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_READ_ONLY);
+ gtk_widget_add_style_class (GTK_WIDGET (self), GTK_STYLE_CLASS_READ_ONLY);
}
priv->editable = is_editable;
@@ -6006,7 +6004,7 @@ append_bubble_item (GtkText *self,
image = gtk_image_new_from_icon_name (icon_name);
gtk_widget_show (image);
gtk_container_add (GTK_CONTAINER (item), image);
- gtk_style_context_add_class (gtk_widget_get_style_context (item), "image-button");
+ gtk_widget_add_style_class (item, "image-button");
gtk_actionable_set_action_name (GTK_ACTIONABLE (item), action_name);
gtk_widget_show (GTK_WIDGET (item));
gtk_container_add (GTK_CONTAINER (toolbar), item);
@@ -6041,8 +6039,7 @@ gtk_text_selection_bubble_popup_show (gpointer user_data)
g_clear_pointer (&priv->selection_bubble, gtk_widget_unparent);
priv->selection_bubble = gtk_popover_new (GTK_WIDGET (self));
- gtk_style_context_add_class (gtk_widget_get_style_context (priv->selection_bubble),
- GTK_STYLE_CLASS_TOUCH_SELECTION);
+ gtk_widget_add_style_class (priv->selection_bubble, GTK_STYLE_CLASS_TOUCH_SELECTION);
gtk_popover_set_position (GTK_POPOVER (priv->selection_bubble), GTK_POS_BOTTOM);
gtk_popover_set_autohide (GTK_POPOVER (priv->selection_bubble), FALSE);
g_signal_connect (priv->selection_bubble, "notify::visible",
@@ -6052,7 +6049,7 @@ gtk_text_selection_bubble_popup_show (gpointer user_data)
g_object_set (box, "margin", 10, NULL);
gtk_widget_show (box);
toolbar = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_style_context_add_class (gtk_widget_get_style_context (toolbar), "linked");
+ gtk_widget_add_style_class (toolbar, "linked");
gtk_container_add (GTK_CONTAINER (priv->selection_bubble), box);
gtk_container_add (GTK_CONTAINER (box), toolbar);
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 76cbef77d4..ae1f75c93a 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -1615,7 +1615,6 @@ gtk_text_view_init (GtkTextView *text_view)
GdkContentFormats *formats;
GtkDropTarget *dest;
GtkTextViewPrivate *priv;
- GtkStyleContext *context;
GtkEventController *controller;
GtkGesture *gesture;
@@ -1625,8 +1624,7 @@ gtk_text_view_init (GtkTextView *text_view)
gtk_widget_set_can_focus (widget, TRUE);
gtk_widget_set_overflow (widget, GTK_OVERFLOW_HIDDEN);
- context = gtk_widget_get_style_context (GTK_WIDGET (text_view));
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_VIEW);
+ gtk_widget_add_style_class (widget, GTK_STYLE_CLASS_VIEW);
gtk_widget_set_cursor_from_name (widget, "text");
@@ -1763,8 +1761,7 @@ _gtk_text_view_ensure_magnifier (GtkTextView *text_view)
priv->magnifier = _gtk_magnifier_new (GTK_WIDGET (text_view));
_gtk_magnifier_set_magnification (GTK_MAGNIFIER (priv->magnifier), 2.0);
priv->magnifier_popover = gtk_popover_new (GTK_WIDGET (text_view));
- gtk_style_context_add_class (gtk_widget_get_style_context (priv->magnifier_popover),
- "magnifier");
+ gtk_widget_add_style_class (priv->magnifier_popover, "magnifier");
gtk_popover_set_autohide (GTK_POPOVER (priv->magnifier_popover), FALSE);
gtk_container_add (GTK_CONTAINER (priv->magnifier_popover),
priv->magnifier);
@@ -8851,7 +8848,7 @@ append_bubble_item (GtkTextView *text_view,
gtk_widget_set_focus_on_click (item, FALSE);
image = gtk_image_new_from_icon_name (icon_name);
gtk_container_add (GTK_CONTAINER (item), image);
- gtk_style_context_add_class (gtk_widget_get_style_context (item), "image-button");
+ gtk_widget_add_style_class (item, "image-button");
gtk_actionable_set_action_name (GTK_ACTIONABLE (item), action_name);
gtk_container_add (GTK_CONTAINER (toolbar), item);
@@ -8875,8 +8872,7 @@ gtk_text_view_selection_bubble_popup_show (gpointer user_data)
g_clear_pointer (&priv->selection_bubble, gtk_widget_unparent);
priv->selection_bubble = gtk_popover_new (GTK_WIDGET (text_view));
- gtk_style_context_add_class (gtk_widget_get_style_context (priv->selection_bubble),
- GTK_STYLE_CLASS_TOUCH_SELECTION);
+ gtk_widget_add_style_class (priv->selection_bubble, GTK_STYLE_CLASS_TOUCH_SELECTION);
gtk_popover_set_position (GTK_POPOVER (priv->selection_bubble), GTK_POS_BOTTOM);
gtk_popover_set_autohide (GTK_POPOVER (priv->selection_bubble), FALSE);
g_signal_connect (priv->selection_bubble, "notify::visible",
@@ -8885,7 +8881,7 @@ gtk_text_view_selection_bubble_popup_show (gpointer user_data)
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
g_object_set (box, "margin", 10, NULL);
toolbar = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_style_context_add_class (gtk_widget_get_style_context (toolbar), "linked");
+ gtk_widget_add_style_class (toolbar, "linked");
gtk_container_add (GTK_CONTAINER (priv->selection_bubble), box);
gtk_container_add (GTK_CONTAINER (box), toolbar);
@@ -9624,20 +9620,19 @@ void
gtk_text_view_set_monospace (GtkTextView *text_view,
gboolean monospace)
{
- GtkStyleContext *context;
gboolean has_monospace;
g_return_if_fail (GTK_IS_TEXT_VIEW (text_view));
- context = gtk_widget_get_style_context (GTK_WIDGET (text_view));
- has_monospace = gtk_style_context_has_class (context, GTK_STYLE_CLASS_MONOSPACE);
+ has_monospace = gtk_text_view_get_monospace (text_view);
if (has_monospace != monospace)
{
if (monospace)
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_MONOSPACE);
+ gtk_widget_add_style_class (GTK_WIDGET (text_view), GTK_STYLE_CLASS_MONOSPACE);
else
- gtk_style_context_remove_class (context, GTK_STYLE_CLASS_MONOSPACE);
+ gtk_widget_remove_style_class (GTK_WIDGET (text_view), GTK_STYLE_CLASS_MONOSPACE);
+
g_object_notify (G_OBJECT (text_view), "monospace");
}
}
@@ -9653,13 +9648,9 @@ gtk_text_view_set_monospace (GtkTextView *text_view,
gboolean
gtk_text_view_get_monospace (GtkTextView *text_view)
{
- GtkStyleContext *context;
-
g_return_val_if_fail (GTK_IS_TEXT_VIEW (text_view), FALSE);
- context = gtk_widget_get_style_context (GTK_WIDGET (text_view));
-
- return gtk_style_context_has_class (context, GTK_STYLE_CLASS_MONOSPACE);
+ return gtk_widget_has_style_class (GTK_WIDGET (text_view), GTK_STYLE_CLASS_MONOSPACE);
}
static void
diff --git a/gtk/gtktogglebutton.c b/gtk/gtktogglebutton.c
index ad70b984ab..1f2f6cc09a 100644
--- a/gtk/gtktogglebutton.c
+++ b/gtk/gtktogglebutton.c
@@ -189,12 +189,10 @@ static void
gtk_toggle_button_init (GtkToggleButton *toggle_button)
{
GtkToggleButtonPrivate *priv = gtk_toggle_button_get_instance_private (toggle_button);
- GtkStyleContext *context;
priv->active = FALSE;
- context = gtk_widget_get_style_context (GTK_WIDGET (toggle_button));
- gtk_style_context_add_class (context, "toggle");
+ gtk_widget_add_style_class (GTK_WIDGET (toggle_button), "toggle");
}
diff --git a/gtk/gtktoolbutton.c b/gtk/gtktoolbutton.c
index ed36b1878d..029b924c8f 100644
--- a/gtk/gtktoolbutton.c
+++ b/gtk/gtktoolbutton.c
@@ -493,8 +493,8 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
case GTK_TOOLBAR_ICONS:
if (icon)
gtk_container_add (GTK_CONTAINER (button->priv->button), icon);
- gtk_style_context_add_class (gtk_widget_get_style_context (button->priv->button), "image-button");
- gtk_style_context_remove_class (gtk_widget_get_style_context (button->priv->button), "text-button");
+ gtk_widget_add_style_class (button->priv->button, "image-button");
+ gtk_widget_remove_style_class (button->priv->button, "text-button");
break;
case GTK_TOOLBAR_BOTH:
@@ -508,8 +508,9 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
gtk_container_add (GTK_CONTAINER (box), label);
gtk_container_add (GTK_CONTAINER (button->priv->button), box);
- gtk_style_context_add_class (gtk_widget_get_style_context (button->priv->button), "image-button");
- gtk_style_context_add_class (gtk_widget_get_style_context (button->priv->button), "text-button");
+ gtk_widget_add_style_class (button->priv->button, "image-button");
+ gtk_widget_add_style_class (button->priv->button, "text-button");
+
break;
case GTK_TOOLBAR_BOTH_HORIZ:
@@ -538,14 +539,14 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
gtk_container_add (GTK_CONTAINER (box), label);
}
gtk_container_add (GTK_CONTAINER (button->priv->button), box);
- gtk_style_context_add_class (gtk_widget_get_style_context (button->priv->button), "image-button");
- gtk_style_context_add_class (gtk_widget_get_style_context (button->priv->button), "text-button");
+ gtk_widget_add_style_class (button->priv->button, "image-button");
+ gtk_widget_add_style_class (button->priv->button, "text-button");
break;
case GTK_TOOLBAR_TEXT:
gtk_container_add (GTK_CONTAINER (button->priv->button), label);
- gtk_style_context_add_class (gtk_widget_get_style_context (button->priv->button), "text-button");
- gtk_style_context_remove_class (gtk_widget_get_style_context (button->priv->button), "image-button");
+ gtk_widget_add_style_class (button->priv->button, "text-button");
+ gtk_widget_remove_style_class (button->priv->button, "image-button");
break;
}
diff --git a/gtk/gtktreepopover.c b/gtk/gtktreepopover.c
index f4219c2cd9..1948afa9b9 100644
--- a/gtk/gtktreepopover.c
+++ b/gtk/gtktreepopover.c
@@ -256,7 +256,6 @@ static void
gtk_tree_popover_init (GtkTreePopover *popover)
{
GtkWidget *stack;
- GtkStyleContext *style_context;
stack = gtk_stack_new ();
gtk_stack_set_vhomogeneous (GTK_STACK (stack), FALSE);
@@ -264,8 +263,7 @@ gtk_tree_popover_init (GtkTreePopover *popover)
gtk_stack_set_interpolate_size (GTK_STACK (stack), TRUE);
gtk_container_add (GTK_CONTAINER (popover), stack);
- style_context = gtk_widget_get_style_context (GTK_WIDGET (popover));
- gtk_style_context_add_class (style_context, GTK_STYLE_CLASS_MENU);
+ gtk_widget_add_style_class (GTK_WIDGET (popover), GTK_STYLE_CLASS_MENU);
}
static GtkCellArea *
@@ -682,19 +680,19 @@ gtk_tree_popover_create_item (GtkTreePopover *popover,
item = gtk_gizmo_new ("modelbutton", NULL, NULL, NULL, NULL);
gtk_widget_set_layout_manager (item, gtk_box_layout_new (GTK_ORIENTATION_HORIZONTAL));
- gtk_style_context_add_class (gtk_widget_get_style_context (item), "flat");
+ gtk_widget_add_style_class (item, "flat");
if (header_item)
{
indicator = gtk_builtin_icon_new ("arrow");
- gtk_style_context_add_class (gtk_widget_get_style_context (indicator), "left");
+ gtk_widget_add_style_class (indicator, "left");
gtk_widget_set_parent (indicator, item);
}
gtk_widget_set_parent (view, item);
indicator = gtk_builtin_icon_new (has_submenu ? "arrow" : "none");
- gtk_style_context_add_class (gtk_widget_get_style_context (indicator), "right");
+ gtk_widget_add_style_class (indicator, "right");
gtk_widget_set_parent (indicator, item);
controller = GTK_EVENT_CONTROLLER (gtk_gesture_click_new ());
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index bac22de83c..5d5eee721e 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -1781,8 +1781,7 @@ gtk_tree_view_init (GtkTreeView *tree_view)
gtk_tree_view_do_set_vadjustment (tree_view, NULL);
gtk_tree_view_do_set_hadjustment (tree_view, NULL);
- gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (tree_view)),
- GTK_STYLE_CLASS_VIEW);
+ gtk_widget_add_style_class (GTK_WIDGET (tree_view), GTK_STYLE_CLASS_VIEW);
widget_node = gtk_widget_get_css_node (GTK_WIDGET (tree_view));
tree_view->header_node = gtk_css_node_new ();
diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c
index 1a6d17deb4..337e33aed2 100644
--- a/gtk/gtkviewport.c
+++ b/gtk/gtkviewport.c
@@ -354,8 +354,7 @@ gtk_viewport_init (GtkViewport *viewport)
priv->hadjustment = NULL;
priv->vadjustment = NULL;
- gtk_style_context_add_class (gtk_widget_get_style_context (widget),
- GTK_STYLE_CLASS_FRAME);
+ gtk_widget_add_style_class (widget, GTK_STYLE_CLASS_FRAME);
viewport_set_adjustment (viewport, GTK_ORIENTATION_HORIZONTAL, NULL);
viewport_set_adjustment (viewport, GTK_ORIENTATION_VERTICAL, NULL);
}
@@ -451,27 +450,20 @@ viewport_set_adjustment (GtkViewport *viewport,
**/
void
gtk_viewport_set_shadow_type (GtkViewport *viewport,
- GtkShadowType type)
+ GtkShadowType type)
{
GtkViewportPrivate *priv = gtk_viewport_get_instance_private (viewport);
- GtkWidget *widget;
- GtkStyleContext *context;
g_return_if_fail (GTK_IS_VIEWPORT (viewport));
- widget = GTK_WIDGET (viewport);
-
if ((GtkShadowType) priv->shadow_type != type)
{
priv->shadow_type = type;
- context = gtk_widget_get_style_context (widget);
if (type != GTK_SHADOW_NONE)
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_FRAME);
+ gtk_widget_add_style_class (GTK_WIDGET (viewport), GTK_STYLE_CLASS_FRAME);
else
- gtk_style_context_remove_class (context, GTK_STYLE_CLASS_FRAME);
-
- gtk_widget_queue_resize (widget);
+ gtk_widget_remove_style_class (GTK_WIDGET (viewport), GTK_STYLE_CLASS_FRAME);
g_object_notify (G_OBJECT (viewport), "shadow-type");
}
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 14fd2e8612..e87d66a0dd 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -5454,16 +5454,13 @@ _gtk_widget_set_has_default (GtkWidget *widget,
gboolean has_default)
{
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
- GtkStyleContext *context;
priv->has_default = has_default;
- context = _gtk_widget_get_style_context (widget);
-
if (has_default)
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_DEFAULT);
+ gtk_widget_add_style_class (widget, GTK_STYLE_CLASS_DEFAULT);
else
- gtk_style_context_remove_class (context, GTK_STYLE_CLASS_DEFAULT);
+ gtk_widget_remove_style_class (widget, GTK_STYLE_CLASS_DEFAULT);
}
/**
@@ -9728,13 +9725,10 @@ gtk_widget_buildable_custom_finished (GtkBuildable *buildable,
else if (strcmp (tagname, "style") == 0)
{
StyleParserData *style_data = (StyleParserData *)user_data;
- GtkStyleContext *context;
GSList *l;
- context = _gtk_widget_get_style_context (GTK_WIDGET (buildable));
-
for (l = style_data->classes; l; l = l->next)
- gtk_style_context_add_class (context, (const gchar *)l->data);
+ gtk_widget_add_style_class (GTK_WIDGET (buildable), (const char *)l->data);
gtk_widget_reset_style (GTK_WIDGET (buildable));
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 33c547d415..c558b3c2f9 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -3690,13 +3690,9 @@ gtk_window_enable_csd (GtkWindow *window)
/* We need a visual with alpha for client shadows */
if (priv->use_client_shadow)
- {
- gtk_style_context_add_class (gtk_widget_get_style_context (widget), GTK_STYLE_CLASS_CSD);
- }
+ gtk_widget_add_style_class (widget, GTK_STYLE_CLASS_CSD);
else
- {
- gtk_style_context_add_class (gtk_widget_get_style_context (widget), "solid-csd");
- }
+ gtk_widget_add_style_class (widget, "solid-csd");
priv->client_decorated = TRUE;
}
@@ -3755,7 +3751,7 @@ gtk_window_set_titlebar (GtkWindow *window,
if (titlebar == NULL)
{
priv->client_decorated = FALSE;
- gtk_style_context_remove_class (gtk_widget_get_style_context (widget), GTK_STYLE_CLASS_CSD);
+ gtk_widget_remove_style_class (widget, GTK_STYLE_CLASS_CSD);
goto out;
}
@@ -3777,8 +3773,7 @@ gtk_window_set_titlebar (GtkWindow *window,
on_titlebar_title_notify (GTK_HEADER_BAR (titlebar), NULL, window);
}
- gtk_style_context_add_class (gtk_widget_get_style_context (titlebar),
- GTK_STYLE_CLASS_TITLEBAR);
+ gtk_widget_add_style_class (titlebar, GTK_STYLE_CLASS_TITLEBAR);
out:
if (was_mapped)
@@ -4787,7 +4782,6 @@ create_titlebar (GtkWindow *window)
{
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
GtkWidget *titlebar;
- GtkStyleContext *context;
titlebar = gtk_header_bar_new ();
g_object_set (titlebar,
@@ -4795,9 +4789,8 @@ create_titlebar (GtkWindow *window)
"has-subtitle", FALSE,
"show-title-buttons", TRUE,
NULL);
- context = gtk_widget_get_style_context (titlebar);
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_TITLEBAR);
- gtk_style_context_add_class (context, "default-decoration");
+ gtk_widget_add_style_class (titlebar, GTK_STYLE_CLASS_TITLEBAR);
+ gtk_widget_add_style_class (titlebar, "default-decoration");
return titlebar;
}
@@ -5692,56 +5685,50 @@ static void
update_window_style_classes (GtkWindow *window)
{
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
- GtkStyleContext *context;
+ GtkWidget *widget = GTK_WIDGET (window);
guint edge_constraints;
- context = gtk_widget_get_style_context (GTK_WIDGET (window));
edge_constraints = priv->edge_constraints;
if (!priv->edge_constraints)
{
if (priv->tiled)
- gtk_style_context_add_class (context, "tiled");
+ gtk_widget_add_style_class (widget, "titled");
else
- gtk_style_context_remove_class (context, "tiled");
+ gtk_widget_remove_style_class (widget, "tiled");
}
else
{
if (edge_constraints & GDK_SURFACE_STATE_TOP_TILED)
- gtk_style_context_add_class (context, "tiled-top");
+ gtk_widget_add_style_class (widget, "titled-top");
else
- gtk_style_context_remove_class (context, "tiled-top");
+ gtk_widget_remove_style_class (widget, "tiled-top");
if (edge_constraints & GDK_SURFACE_STATE_RIGHT_TILED)
- gtk_style_context_add_class (context, "tiled-right");
+ gtk_widget_add_style_class (widget, "titled-right");
else
- gtk_style_context_remove_class (context, "tiled-right");
+ gtk_widget_remove_style_class (widget, "tiled-right");
if (edge_constraints & GDK_SURFACE_STATE_BOTTOM_TILED)
- gtk_style_context_add_class (context, "tiled-bottom");
+ gtk_widget_add_style_class (widget, "titled-bottom");
else
- gtk_style_context_remove_class (context, "tiled-bottom");
+ gtk_widget_remove_style_class (widget, "tiled-bottom");
if (edge_constraints & GDK_SURFACE_STATE_LEFT_TILED)
- gtk_style_context_add_class (context, "tiled-left");
+ gtk_widget_add_style_class (widget, "titled-left");
else
- gtk_style_context_remove_class (context, "tiled-left");
+ gtk_widget_remove_style_class (widget, "tiled-left");
}
if (priv->maximized)
- gtk_style_context_add_class (context, "maximized");
- else
- gtk_style_context_remove_class (context, "maximized");
-
- if (priv->maximized)
- gtk_style_context_add_class (context, "maximized");
+ gtk_widget_add_style_class (widget, "maximized");
else
- gtk_style_context_remove_class (context, "maximized");
+ gtk_widget_remove_style_class (widget, "maximized");
if (priv->fullscreen)
- gtk_style_context_add_class (context, "fullscreen");
+ gtk_widget_add_style_class (widget, "fullscreen");
else
- gtk_style_context_remove_class (context, "fullscreen");
+ gtk_widget_remove_style_class (widget, "fullscreen");
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]