[gtk/wip/otte/css: 306/307] stylecontext: Make stylesheet APIs take StyleSheet objects



commit 8a7119c2ec111596b276662cb0baa56ad13e48da
Author: Benjamin Otte <otte redhat com>
Date:   Mon Feb 10 03:57:43 2020 +0100

    stylecontext: Make stylesheet APIs take StyleSheet objects
    
    It's the only type of GtkStyleProvider we have left.
    
    Also, drop the priority argument, use the StyleSheet's priority instead.

 .../constraint-editor-application.c                |  4 +-
 demos/gtk-demo/css_accordion.c                     | 13 ++--
 demos/gtk-demo/css_basics.c                        |  9 +--
 demos/gtk-demo/css_blendmodes.c                    | 14 ++--
 demos/gtk-demo/css_multiplebgs.c                   |  9 +--
 demos/gtk-demo/css_pixbufs.c                       |  9 +--
 demos/gtk-demo/css_shadows.c                       |  9 +--
 demos/gtk-demo/demotaggedentry.c                   |  5 +-
 demos/gtk-demo/dnd.c                               |  5 +-
 demos/gtk-demo/fishbowl.c                          |  4 +-
 demos/gtk-demo/fixed.c                             |  8 +--
 demos/node-editor/node-editor-application.c        |  4 +-
 demos/widget-factory/widget-factory.c              |  4 +-
 docs/reference/gtk/gtk4-sections.txt               |  8 +--
 docs/reference/gtk/question_index.xml              |  4 +-
 docs/reference/gtk/text_widget.xml                 |  2 +-
 examples/plugman.c                                 |  5 +-
 gtk/gtkcssstylesheet.c                             |  4 +-
 gtk/gtksettings.c                                  | 53 +++-----------
 gtk/gtkstylecascade.c                              | 71 ++++++++++---------
 gtk/gtkstylecascadeprivate.h                       | 11 ++-
 gtk/gtkstylecontext.c                              | 80 +++++++++-------------
 gtk/gtkstylecontext.h                              | 22 +++---
 gtk/gtkstyleprovider.c                             |  2 +-
 gtk/inspector/css-editor.c                         | 16 ++---
 gtk/inspector/window.c                             |  5 +-
 gtk/tools/gtk-builder-tool-preview.c               |  4 +-
 tests/animated-revealing.c                         |  4 +-
 tests/testadjustsize.c                             |  4 +-
 tests/testbaseline.c                               |  4 +-
 tests/testborderdrawing.c                          |  5 +-
 tests/testcombochange.c                            |  5 +-
 tests/testdnd3.c                                   |  5 +-
 tests/testentryicons.c                             |  3 +-
 tests/testframe.c                                  |  8 +--
 tests/testgrid.c                                   |  4 +-
 tests/testgtk.c                                    | 18 +++--
 tests/testheaderbar.c                              |  5 +-
 tests/testiconview-keynav.c                        |  6 +-
 tests/testlevelbar.c                               |  5 +-
 tests/testlist.c                                   |  5 +-
 tests/testlist3.c                                  |  4 +-
 tests/testmodelbutton.c                            |  5 +-
 tests/testoutsetshadowdrawing.c                    |  5 +-
 tests/testoverlay.c                                | 11 ++-
 tests/testoverlaystyleclass.c                      |  5 +-
 tests/testwidgetfocus.c                            |  5 +-
 tests/testwidgettransforms.c                       |  4 +-
 testsuite/css/change/test-css-change.c             |  8 +--
 testsuite/css/style/test-css-style.c               |  8 +--
 testsuite/reftests/gtk-reftest.c                   | 30 ++++----
 51 files changed, 227 insertions(+), 323 deletions(-)
---
diff --git a/demos/constraint-editor/constraint-editor-application.c 
b/demos/constraint-editor/constraint-editor-application.c
index 1ae31c403e..1f2b6f8358 100644
--- a/demos/constraint-editor/constraint-editor-application.c
+++ b/demos/constraint-editor/constraint-editor-application.c
@@ -64,9 +64,7 @@ constraint_editor_application_startup (GApplication *app)
 
   stylesheet = gtk_css_style_sheet_new ();
   gtk_css_style_sheet_load_from_resource (stylesheet, 
"/org/gtk/gtk4/constraint-editor/constraint-editor.css");
-  gtk_style_context_add_provider_for_display (gdk_display_get_default (),
-                                              GTK_STYLE_PROVIDER (stylesheet),
-                                              GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+  gtk_style_context_add_style_sheet_for_display (gdk_display_get_default (), stylesheet);
 }
 
 static void
diff --git a/demos/gtk-demo/css_accordion.c b/demos/gtk-demo/css_accordion.c
index 534d164630..5cef537915 100644
--- a/demos/gtk-demo/css_accordion.c
+++ b/demos/gtk-demo/css_accordion.c
@@ -10,7 +10,7 @@ static void
 destroy_provider (GtkWidget      *window,
                   GtkCssStyleSheet *stylesheet)
 {
-  gtk_style_context_remove_provider_for_display (gtk_widget_get_display (window), GTK_STYLE_PROVIDER 
(stylesheet));
+  gtk_style_context_remove_style_sheet_for_display (gtk_widget_get_display (window), stylesheet);
 }
 
 GtkWidget *
@@ -21,7 +21,7 @@ do_css_accordion (GtkWidget *do_widget)
   if (!window)
     {
       GtkWidget *container, *styled_box, *child;
-      GtkStyleProvider *stylesheet;
+      GtkCssStyleSheet *stylesheet;
 
       window = gtk_window_new ();
       gtk_window_set_title (GTK_WINDOW (window), "CSS Accordion");
@@ -56,12 +56,11 @@ do_css_accordion (GtkWidget *do_widget)
       child = gtk_button_new_with_label (":-)");
       gtk_container_add (GTK_CONTAINER (container), child);
 
-      stylesheet = GTK_STYLE_PROVIDER (gtk_css_style_sheet_new ());
-      gtk_css_style_sheet_load_from_resource (GTK_CSS_STYLE_SHEET (stylesheet), 
"/css_accordion/css_accordion.css");
+      stylesheet = gtk_css_style_sheet_new ();
+      gtk_css_style_sheet_load_from_resource (stylesheet, "/css_accordion/css_accordion.css");
+
+      gtk_style_context_add_style_sheet_for_display (gtk_widget_get_display (window), stylesheet);
 
-      gtk_style_context_add_provider_for_display (gtk_widget_get_display (window),
-                                                  GTK_STYLE_PROVIDER (stylesheet),
-                                                  GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
       g_signal_connect (window, "destroy",
                         G_CALLBACK (destroy_provider), stylesheet);
       g_object_unref (stylesheet);
diff --git a/demos/gtk-demo/css_basics.c b/demos/gtk-demo/css_basics.c
index 80239febc3..a750ff70aa 100644
--- a/demos/gtk-demo/css_basics.c
+++ b/demos/gtk-demo/css_basics.c
@@ -53,9 +53,9 @@ css_text_changed (GtkTextBuffer  *buffer,
 }
 
 static void
-apply_css (GtkWidget *widget, GtkStyleProvider *stylesheet)
+apply_css (GtkWidget *widget, GtkCssStyleSheet *stylesheet)
 {
-  gtk_style_context_add_provider (gtk_widget_get_style_context (widget), stylesheet, G_MAXUINT);
+  gtk_style_context_add_style_sheet (gtk_widget_get_style_context (widget), stylesheet);
   if (GTK_IS_CONTAINER (widget))
     gtk_container_forall (GTK_CONTAINER (widget), (GtkCallback) apply_css, stylesheet);
 }
@@ -68,7 +68,7 @@ do_css_basics (GtkWidget *do_widget)
   if (!window)
     {
       GtkWidget *container, *child;
-      GtkStyleProvider *stylesheet;
+      GtkCssStyleSheet *stylesheet;
       GtkTextBuffer *text;
       GBytes *bytes;
 
@@ -89,7 +89,8 @@ do_css_basics (GtkWidget *do_widget)
                                   "underline", PANGO_UNDERLINE_ERROR,
                                   NULL);
 
-      stylesheet = GTK_STYLE_PROVIDER (gtk_css_style_sheet_new ());
+      stylesheet = gtk_css_style_sheet_new ();
+      gtk_css_style_sheet_set_priority (stylesheet, G_MAXUINT);
 
       container = gtk_scrolled_window_new (NULL, NULL);
       gtk_container_add (GTK_CONTAINER (window), container);
diff --git a/demos/gtk-demo/css_blendmodes.c b/demos/gtk-demo/css_blendmodes.c
index 7aa688d510..325ab85822 100644
--- a/demos/gtk-demo/css_blendmodes.c
+++ b/demos/gtk-demo/css_blendmodes.c
@@ -58,8 +58,8 @@ update_css_for_blend_mode (GtkCssStyleSheet *stylesheet,
 #pragma GCC diagnostic pop
 
 static void
-row_activated (GtkListBox     *listbox,
-               GtkListBoxRow  *row,
+row_activated (GtkListBox       *listbox,
+               GtkListBoxRow    *row,
                GtkCssStyleSheet *stylesheet)
 {
   const gchar *blend_mode;
@@ -71,7 +71,7 @@ row_activated (GtkListBox     *listbox,
 
 static void
 setup_listbox (GtkBuilder       *builder,
-               GtkStyleProvider *stylesheet)
+               GtkCssStyleSheet *stylesheet)
 {
   GtkWidget *normal_row;
   GtkWidget *listbox;
@@ -118,7 +118,7 @@ do_css_blendmodes (GtkWidget *do_widget)
 
   if (!window)
     {
-      GtkStyleProvider *stylesheet;
+      GtkCssStyleSheet *stylesheet;
       GtkBuilder *builder;
 
       builder = gtk_builder_new_from_resource ("/css_blendmodes/blendmodes.ui");
@@ -128,11 +128,9 @@ do_css_blendmodes (GtkWidget *do_widget)
       g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window);
 
       /* Setup the CSS stylesheet for window */
-      stylesheet = GTK_STYLE_PROVIDER (gtk_css_style_sheet_new ());
+      stylesheet = gtk_css_style_sheet_new ();
 
-      gtk_style_context_add_provider_for_display (gdk_display_get_default (),
-                                                  stylesheet,
-                                                  GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+      gtk_style_context_add_style_sheet_for_display (gdk_display_get_default (), stylesheet);
 
       setup_listbox (builder, stylesheet);
     }
diff --git a/demos/gtk-demo/css_multiplebgs.c b/demos/gtk-demo/css_multiplebgs.c
index 5f5f9d80bc..25d99026a7 100644
--- a/demos/gtk-demo/css_multiplebgs.c
+++ b/demos/gtk-demo/css_multiplebgs.c
@@ -67,9 +67,9 @@ drawing_area_draw (GtkDrawingArea *da,
 }
 
 static void
-apply_css (GtkWidget *widget, GtkStyleProvider *stylesheet)
+apply_css (GtkWidget *widget, GtkCssStyleSheet *stylesheet)
 {
-  gtk_style_context_add_provider (gtk_widget_get_style_context (widget), stylesheet, G_MAXUINT);
+  gtk_style_context_add_style_sheet (gtk_widget_get_style_context (widget), stylesheet);
   if (GTK_IS_CONTAINER (widget))
     gtk_container_forall (GTK_CONTAINER (widget), (GtkCallback) apply_css, stylesheet);
 }
@@ -82,7 +82,7 @@ do_css_multiplebgs (GtkWidget *do_widget)
   if (!window)
     {
       GtkWidget *paned, *container, *child;
-      GtkStyleProvider *stylesheet;
+      GtkCssStyleSheet *stylesheet;
       GtkTextBuffer *text;
       GBytes *bytes;
 
@@ -127,7 +127,8 @@ do_css_multiplebgs (GtkWidget *do_widget)
                                   "underline", PANGO_UNDERLINE_ERROR,
                                   NULL);
 
-      stylesheet = GTK_STYLE_PROVIDER (gtk_css_style_sheet_new ());
+      stylesheet = gtk_css_style_sheet_new ();
+      gtk_css_style_sheet_set_priority (stylesheet, G_MAXUINT);
 
       container = gtk_scrolled_window_new (NULL, NULL);
       gtk_container_add (GTK_CONTAINER (paned), container);
diff --git a/demos/gtk-demo/css_pixbufs.c b/demos/gtk-demo/css_pixbufs.c
index 68e2b372c3..abd3f53a82 100644
--- a/demos/gtk-demo/css_pixbufs.c
+++ b/demos/gtk-demo/css_pixbufs.c
@@ -53,9 +53,9 @@ css_text_changed (GtkTextBuffer  *buffer,
 }
 
 static void
-apply_css (GtkWidget *widget, GtkStyleProvider *stylesheet)
+apply_css (GtkWidget *widget, GtkCssStyleSheet *stylesheet)
 {
-  gtk_style_context_add_provider (gtk_widget_get_style_context (widget), stylesheet, G_MAXUINT);
+  gtk_style_context_add_style_sheet (gtk_widget_get_style_context (widget), stylesheet);
   if (GTK_IS_CONTAINER (widget))
     gtk_container_forall (GTK_CONTAINER (widget), (GtkCallback) apply_css, stylesheet);
 }
@@ -68,7 +68,7 @@ do_css_pixbufs (GtkWidget *do_widget)
   if (!window)
     {
       GtkWidget *paned, *container, *child;
-      GtkStyleProvider *stylesheet;
+      GtkCssStyleSheet *stylesheet;
       GtkTextBuffer *text;
       GBytes *bytes;
 
@@ -96,7 +96,8 @@ do_css_pixbufs (GtkWidget *do_widget)
                                   "underline", PANGO_UNDERLINE_ERROR,
                                   NULL);
 
-      stylesheet = GTK_STYLE_PROVIDER (gtk_css_style_sheet_new ());
+      stylesheet = gtk_css_style_sheet_new ();
+      gtk_css_style_sheet_set_priority (stylesheet, G_MAXUINT);
 
       container = gtk_scrolled_window_new (NULL, NULL);
       gtk_container_add (GTK_CONTAINER (paned), container);
diff --git a/demos/gtk-demo/css_shadows.c b/demos/gtk-demo/css_shadows.c
index 21c7e2f638..a6e3346aa5 100644
--- a/demos/gtk-demo/css_shadows.c
+++ b/demos/gtk-demo/css_shadows.c
@@ -51,9 +51,9 @@ css_text_changed (GtkTextBuffer  *buffer,
 }
 
 static void
-apply_css (GtkWidget *widget, GtkStyleProvider *stylesheet)
+apply_css (GtkWidget *widget, GtkCssStyleSheet *stylesheet)
 {
-  gtk_style_context_add_provider (gtk_widget_get_style_context (widget), stylesheet, G_MAXUINT);
+  gtk_style_context_add_style_sheet (gtk_widget_get_style_context (widget), stylesheet);
   if (GTK_IS_CONTAINER (widget))
     gtk_container_forall (GTK_CONTAINER (widget), (GtkCallback) apply_css, stylesheet);
 }
@@ -87,7 +87,7 @@ do_css_shadows (GtkWidget *do_widget)
   if (!window)
     {
       GtkWidget *paned, *container, *child;
-      GtkStyleProvider *stylesheet;
+      GtkCssStyleSheet *stylesheet;
       GtkTextBuffer *text;
       GBytes *bytes;
 
@@ -114,7 +114,8 @@ do_css_shadows (GtkWidget *do_widget)
                                   "underline", PANGO_UNDERLINE_ERROR,
                                   NULL);
 
-      stylesheet = GTK_STYLE_PROVIDER (gtk_css_style_sheet_new ());
+      stylesheet = gtk_css_style_sheet_new ();
+      gtk_css_style_sheet_set_priority (stylesheet, G_MAXUINT);
 
       container = gtk_scrolled_window_new (NULL, NULL);
       gtk_container_add (GTK_CONTAINER (paned), container);
diff --git a/demos/gtk-demo/demotaggedentry.c b/demos/gtk-demo/demotaggedentry.c
index 018a6e4f67..6584c5e071 100644
--- a/demos/gtk-demo/demotaggedentry.c
+++ b/demos/gtk-demo/demotaggedentry.c
@@ -275,10 +275,9 @@ demo_tagged_entry_tag_init (DemoTaggedEntryTag *tag)
   gtk_widget_add_controller (GTK_WIDGET (tag), GTK_EVENT_CONTROLLER (gesture));
 
   stylesheet = gtk_css_style_sheet_new ();
+  gtk_css_style_sheet_set_priority (stylesheet, 800);
   gtk_css_style_sheet_load_from_resource (stylesheet, "/tagged_entry/tagstyle.css");
-  gtk_style_context_add_provider_for_display (gdk_display_get_default (),
-                                              GTK_STYLE_PROVIDER (stylesheet),
-                                              800);
+  gtk_style_context_add_style_sheet_for_display (gdk_display_get_default (), stylesheet);
   g_object_unref (stylesheet);
 }
 
diff --git a/demos/gtk-demo/dnd.c b/demos/gtk-demo/dnd.c
index 78a102e2a9..c88d48bb44 100644
--- a/demos/gtk-demo/dnd.c
+++ b/demos/gtk-demo/dnd.c
@@ -379,10 +379,9 @@ do_dnd (GtkWidget *do_widget)
       gtk_widget_add_controller (fixed, GTK_EVENT_CONTROLLER (multipress));
 
       stylesheet = gtk_css_style_sheet_new ();
+      gtk_css_style_sheet_set_priority (stylesheet, 800);
       gtk_css_style_sheet_load_from_resource (stylesheet, "/dnd/dnd.css");
-      gtk_style_context_add_provider_for_display (gdk_display_get_default (),
-                                                  GTK_STYLE_PROVIDER (stylesheet),
-                                                  800);
+      gtk_style_context_add_style_sheet_for_display (gdk_display_get_default (), stylesheet);
     }
 
   if (!gtk_widget_get_visible (window))
diff --git a/demos/gtk-demo/fishbowl.c b/demos/gtk-demo/fishbowl.c
index ee1ae0aaf8..5df7f99da2 100644
--- a/demos/gtk-demo/fishbowl.c
+++ b/demos/gtk-demo/fishbowl.c
@@ -277,9 +277,7 @@ do_fishbowl (GtkWidget *do_widget)
     {
       stylesheet = gtk_css_style_sheet_new ();
       gtk_css_style_sheet_load_from_data (stylesheet, css, -1);
-      gtk_style_context_add_provider_for_display (gdk_display_get_default (),
-                                                  GTK_STYLE_PROVIDER (stylesheet),
-                                                  GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+      gtk_style_context_add_style_sheet_for_display (gdk_display_get_default (), stylesheet);
     }
 
   if (!window)
diff --git a/demos/gtk-demo/fixed.c b/demos/gtk-demo/fixed.c
index 65022d398c..e99a82b224 100644
--- a/demos/gtk-demo/fixed.c
+++ b/demos/gtk-demo/fixed.c
@@ -112,8 +112,7 @@ close_window (GtkWidget *widget)
   for (int i = 0; i < N_FACES; i++)
     faces[i].face = NULL;
 
-  gtk_style_context_remove_provider_for_display (gdk_display_get_default (),
-                                                 GTK_STYLE_PROVIDER (stylesheet));
+  gtk_style_context_remove_style_sheet_for_display (gdk_display_get_default (), stylesheet);
   stylesheet = NULL;
 
   demo_window = NULL;
@@ -143,10 +142,9 @@ create_demo_window (GtkWidget *do_widget)
   gtk_widget_set_overflow (fixed, GTK_OVERFLOW_VISIBLE);
 
   stylesheet = gtk_css_style_sheet_new ();
+  gtk_css_style_sheet_set_priority (stylesheet, 800);
   gtk_css_style_sheet_load_from_resource (stylesheet, "/fixed/fixed.css");
-  gtk_style_context_add_provider_for_display (gdk_display_get_default (),
-                                              GTK_STYLE_PROVIDER (stylesheet),
-                                              800);
+  gtk_style_context_add_style_sheet_for_display (gdk_display_get_default (), stylesheet);
   g_object_unref (stylesheet);
 
   return window;
diff --git a/demos/node-editor/node-editor-application.c b/demos/node-editor/node-editor-application.c
index c94f8f3a09..8e4d3d6920 100644
--- a/demos/node-editor/node-editor-application.c
+++ b/demos/node-editor/node-editor-application.c
@@ -81,9 +81,7 @@ node_editor_application_startup (GApplication *app)
 
   stylesheet = gtk_css_style_sheet_new ();
   gtk_css_style_sheet_load_from_data (stylesheet, css, -1);
-  gtk_style_context_add_provider_for_display (gdk_display_get_default (),
-                                              GTK_STYLE_PROVIDER (stylesheet),
-                                              GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+  gtk_style_context_add_style_sheet_for_display (gdk_display_get_default (), stylesheet);
 }
 
 static void
diff --git a/demos/widget-factory/widget-factory.c b/demos/widget-factory/widget-factory.c
index 8fd715cb29..d61b2d2dfa 100644
--- a/demos/widget-factory/widget-factory.c
+++ b/demos/widget-factory/widget-factory.c
@@ -1692,9 +1692,7 @@ activate (GApplication *app)
 
   stylesheet = gtk_css_style_sheet_new ();
   gtk_css_style_sheet_load_from_resource (stylesheet, "/org/gtk/WidgetFactory4/widget-factory.css");
-  gtk_style_context_add_provider_for_display (gdk_display_get_default (),
-                                              GTK_STYLE_PROVIDER (stylesheet),
-                                              GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+  gtk_style_context_add_style_sheet_for_display (gdk_display_get_default (), stylesheet);
   g_object_unref (stylesheet);
 
   builder = gtk_builder_new ();
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index 5beaf48cbf..66b8c72df5 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -4570,8 +4570,8 @@ GTK_STYLE_CLASS_WARNING
 GTK_STYLE_CLASS_WIDE
 <SUBSECTION>
 GtkStyleContext
-gtk_style_context_add_provider
-gtk_style_context_add_provider_for_display
+gtk_style_context_add_style_sheet
+gtk_style_context_add_style_sheet_for_display
 gtk_style_context_get_display
 gtk_style_context_get_state
 gtk_style_context_get_color
@@ -4579,8 +4579,8 @@ gtk_style_context_get_border
 gtk_style_context_get_padding
 gtk_style_context_get_margin
 gtk_style_context_lookup_color
-gtk_style_context_remove_provider
-gtk_style_context_remove_provider_for_display
+gtk_style_context_remove_style_sheet
+gtk_style_context_remove_style_sheet_for_display
 gtk_style_context_reset_widgets
 gtk_style_context_restore
 gtk_style_context_save
diff --git a/docs/reference/gtk/question_index.xml b/docs/reference/gtk/question_index.xml
index 0cd8062185..e59700a584 100644
--- a/docs/reference/gtk/question_index.xml
+++ b/docs/reference/gtk/question_index.xml
@@ -645,7 +645,7 @@ How do I change the color of a widget?
 The background color of a widget is determined by the CSS style that applies
 to it. To change that, you can set style classes on the widget, and provide
 custom CSS to change the appearance. Such CSS can be loaded with
-gtk_css_provider_load_from_file() and its variants. See gtk_style_context_add_provider().
+gtk_css_provider_load_from_file() and its variants. See gtk_style_context_add_style_sheet().
 </para></answer>
 </qandaentry>
 
@@ -672,7 +672,7 @@ You can also change the font of a widget by putting
  }
 </programlisting>
 in a CSS file, loading it with gtk_css_provider_load_from_file(), and
-adding the provider with gtk_style_context_add_provider_for_display().
+adding the provider with gtk_style_context_add_style_sheet_for_display().
 To associate this style information with your widget, set a style class
 on its #GtkStyleContext using gtk_style_context_add_class().
 The advantage of this approach is that users can then override the font
diff --git a/docs/reference/gtk/text_widget.xml b/docs/reference/gtk/text_widget.xml
index 84cd55bdb6..36beb87048 100644
--- a/docs/reference/gtk/text_widget.xml
+++ b/docs/reference/gtk/text_widget.xml
@@ -188,7 +188,7 @@ foreground color &mdash; use CSS to override their default values.
                                    "}",
                                    -1);
   context = gtk_widget_get_style_context (view);
-  gtk_style_context_add_provider (context,
+  gtk_style_context_add_style_sheet (context,
                                   GTK_STYLE_PROVIDER (stylesheet),
                                   GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
 
diff --git a/examples/plugman.c b/examples/plugman.c
index 9a8032e3d0..a9f913e10d 100644
--- a/examples/plugman.c
+++ b/examples/plugman.c
@@ -220,9 +220,8 @@ plugin_action (GAction  *action,
 
   stylesheet = gtk_css_style_sheet_new ();
   gtk_css_style_sheet_load_from_data (stylesheet, css_to_load, -1);
-  gtk_style_context_add_provider_for_display (gdk_display_get_default (),
-                                              GTK_STYLE_PROVIDER (stylesheet),
-                                              GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+  gtk_style_context_add_style_sheet_for_display (gdk_display_get_default (), stylesheet);
+  g_object_unref (stylesheet);
 }
 
 static void
diff --git a/gtk/gtkcssstylesheet.c b/gtk/gtkcssstylesheet.c
index 3d1c7af3e9..fa0d9c9a7e 100644
--- a/gtk/gtkcssstylesheet.c
+++ b/gtk/gtkcssstylesheet.c
@@ -55,8 +55,8 @@
  *
  * An application can make GTK+ parse a specific CSS style sheet by calling
  * gtk_css_style_sheet_load_from_file() or gtk_css_style_sheet_load_from_resource()
- * and adding the provider with gtk_style_context_add_provider() or
- * gtk_style_context_add_provider_for_display().
+ * and adding the provider with gtk_style_context_add_style_sheet() or
+ * gtk_style_context_add_style_sheet_for_display().
  *
  * In addition, certain files will be read when GTK+ is initialized. First, the
  * file `$XDG_CONFIG_HOME/gtk-4.0/gtk.css` is loaded if it exists. Then, GTK+
diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c
index 446862202a..0235b4468e 100644
--- a/gtk/gtksettings.c
+++ b/gtk/gtksettings.c
@@ -124,7 +124,7 @@ struct _GtkSettingsPrivate
   GtkSettingsPropertyValue *property_values;
   GdkDisplay *display;
   GtkStyleCascade *style_cascade;
-  GtkCssStyleSheet *theme_provider;
+  GtkCssStyleSheet *theme_style_sheet;
   gint font_size;
   gboolean font_size_absolute;
   gchar *font_family;
@@ -224,9 +224,6 @@ static void    settings_update_xsettings         (GtkSettings           *setting
 static void gtk_settings_load_from_key_file      (GtkSettings           *settings,
                                                   const gchar           *path,
                                                   GtkSettingsSource      source);
-static void settings_update_provider             (GdkDisplay            *display,
-                                                  GtkCssStyleSheet       **old,
-                                                  GtkCssStyleSheet        *new);
 
 /* --- variables --- */
 static GQuark            quark_gtk_settings = 0;
@@ -254,7 +251,8 @@ gtk_settings_init (GtkSettings *settings)
   object_list = g_slist_prepend (object_list, settings);
 
   priv->style_cascade = _gtk_style_cascade_new ();
-  priv->theme_provider = gtk_css_style_sheet_new ();
+  priv->theme_style_sheet = gtk_css_style_sheet_new ();
+  gtk_css_style_sheet_set_priority (priv->theme_style_sheet, GTK_STYLE_PROVIDER_PRIORITY_THEME);
 
   /* build up property array for all yet existing properties and queue
    * notification for them (at least notification for internal properties
@@ -977,7 +975,7 @@ gtk_settings_finalize (GObject *object)
 
   g_datalist_clear (&priv->queued_settings);
 
-  settings_update_provider (priv->display, &priv->theme_provider, NULL);
+  g_object_unref (priv->theme_style_sheet);
   g_object_unref (priv->style_cascade);
 
   if (priv->font_options)
@@ -1008,6 +1006,7 @@ settings_init_style (GtkSettings *settings)
       gchar *css_path;
 
       css_style_sheet = gtk_css_style_sheet_new ();
+      gtk_css_style_sheet_set_priority (css_style_sheet, GTK_STYLE_PROVIDER_PRIORITY_USER);
       css_path = g_build_filename (g_get_user_config_dir (),
                                    "gtk-4.0",
                                    "gtk.css",
@@ -1022,13 +1021,8 @@ settings_init_style (GtkSettings *settings)
 
   priv->style_cascade = _gtk_style_cascade_new ();
 
-  _gtk_style_cascade_add_provider (priv->style_cascade,
-                                   GTK_STYLE_PROVIDER (css_style_sheet),
-                                   GTK_STYLE_PROVIDER_PRIORITY_USER);
-
-  _gtk_style_cascade_add_provider (priv->style_cascade,
-                                   GTK_STYLE_PROVIDER (priv->theme_provider),
-                                   GTK_STYLE_PROVIDER_PRIORITY_SETTINGS);
+  gtk_style_cascade_add_style_sheet (priv->style_cascade, css_style_sheet);
+  gtk_style_cascade_add_style_sheet (priv->style_cascade, priv->theme_style_sheet),
 
   settings_update_theme (settings);
 }
@@ -1606,31 +1600,6 @@ settings_update_fontconfig (GtkSettings *settings)
 #endif /* GDK_WINDOWING_X11 || GDK_WINDOWING_WAYLAND */
 }
 
-static void
-settings_update_provider (GdkDisplay      *display,
-                          GtkCssStyleSheet **old,
-                          GtkCssStyleSheet  *new)
-{
-  if (display != NULL && *old != new)
-    {
-      if (*old)
-        {
-          gtk_style_context_remove_provider_for_display (display,
-                                                         GTK_STYLE_PROVIDER (*old));
-          g_object_unref (*old);
-          *old = NULL;
-        }
-
-      if (new)
-        {
-          gtk_style_context_add_provider_for_display (display,
-                                                      GTK_STYLE_PROVIDER (new),
-                                                      GTK_STYLE_PROVIDER_PRIORITY_THEME);
-          *old = g_object_ref (new);
-        }
-    }
-}
-
 static void
 get_theme_name (GtkSettings  *settings,
                 gchar       **theme_name,
@@ -1685,12 +1654,12 @@ settings_update_theme (GtkSettings *settings)
 
   get_theme_name (settings, &theme_name, &theme_variant);
 
-  gtk_css_style_sheet_load_named (priv->theme_provider,
-                               theme_name,
-                               theme_variant);
+  gtk_css_style_sheet_load_named (priv->theme_style_sheet,
+                                  theme_name,
+                                  theme_variant);
 
   /* reload per-theme settings */
-  theme_dir = gtk_css_style_sheet_get_theme_dir (priv->theme_provider);
+  theme_dir = gtk_css_style_sheet_get_theme_dir (priv->theme_style_sheet);
   if (theme_dir)
     {
       path = g_build_filename (theme_dir, "settings.ini", NULL);
diff --git a/gtk/gtkstylecascade.c b/gtk/gtkstylecascade.c
index 81d1b2ada9..b1a7764f6d 100644
--- a/gtk/gtkstylecascade.c
+++ b/gtk/gtkstylecascade.c
@@ -34,8 +34,7 @@ struct _GtkStyleCascadeIter {
 
 struct _GtkStyleProviderData
 {
-  GtkStyleProvider *provider;
-  guint priority;
+  GtkCssStyleSheet *stylesheet;
   guint changed_signal_id;
 };
 
@@ -54,10 +53,11 @@ gtk_style_cascade_iter_next (GtkStyleCascade     *cascade,
       if (iter->cascade_index[ix] <= 0)
         continue;
 
-      data = &g_array_index (cas->providers,
+      data = &g_array_index (cas->stylesheets,
                              GtkStyleProviderData,
                              iter->cascade_index[ix] - 1);
-      if (highest_priority_data == NULL || data->priority > highest_priority_data->priority)
+      if (highest_priority_data == NULL ||
+          gtk_css_style_sheet_get_priority (data->stylesheet) > gtk_css_style_sheet_get_priority 
(highest_priority_data->stylesheet))
         {
           highest_priority_index = ix;
           highest_priority_data = data;
@@ -67,7 +67,7 @@ gtk_style_cascade_iter_next (GtkStyleCascade     *cascade,
   if (highest_priority_data != NULL)
     {
       iter->cascade_index[highest_priority_index]--;
-      return highest_priority_data->provider;
+      return GTK_STYLE_PROVIDER (highest_priority_data->stylesheet);
     }
   return NULL;
 }
@@ -85,7 +85,7 @@ gtk_style_cascade_iter_init (GtkStyleCascade     *cascade,
 
   iter->cascade_index = g_new (int, iter->n_cascades);
   for (cas = cascade, ix = 0; ix < iter->n_cascades; cas = cas->parent, ix++)
-    iter->cascade_index[ix] = cas->providers->len;
+    iter->cascade_index[ix] = cas->stylesheets->len;
 
   return gtk_style_cascade_iter_next (cascade, iter);
 }
@@ -97,10 +97,10 @@ gtk_style_cascade_iter_clear (GtkStyleCascadeIter *iter)
 }
 
 static GtkCssValue *
-gtk_style_cascade_get_color (GtkStyleProvider *provider,
+gtk_style_cascade_get_color (GtkStyleProvider *stylesheet,
                              const char              *name)
 {
-  GtkStyleCascade *cascade = GTK_STYLE_CASCADE (provider);
+  GtkStyleCascade *cascade = GTK_STYLE_CASCADE (stylesheet);
   GtkStyleCascadeIter iter;
   GtkCssValue *color;
   GtkStyleProvider *item;
@@ -122,10 +122,10 @@ gtk_style_cascade_get_color (GtkStyleProvider *provider,
 }
 
 static GtkCssKeyframes *
-gtk_style_cascade_get_keyframes (GtkStyleProvider *provider,
+gtk_style_cascade_get_keyframes (GtkStyleProvider *stylesheet,
                                  const char       *name)
 {
-  GtkStyleCascade *cascade = GTK_STYLE_CASCADE (provider);
+  GtkStyleCascade *cascade = GTK_STYLE_CASCADE (stylesheet);
   GtkStyleCascadeIter iter;
   GtkCssKeyframes *keyframes;
   GtkStyleProvider *item;
@@ -147,13 +147,13 @@ gtk_style_cascade_get_keyframes (GtkStyleProvider *provider,
 }
 
 static void
-gtk_style_cascade_lookup (GtkStyleProvider             *provider,
+gtk_style_cascade_lookup (GtkStyleProvider             *stylesheet,
                           const GtkCountingBloomFilter *filter,
                           GtkCssNode                   *node,
                           GtkCssLookup                 *lookup,
                           GtkCssChange                 *change)
 {
-  GtkStyleCascade *cascade = GTK_STYLE_CASCADE (provider);
+  GtkStyleCascade *cascade = GTK_STYLE_CASCADE (stylesheet);
   GtkStyleCascadeIter iter;
   GtkStyleProvider *item;
   GtkCssChange iter_change;
@@ -188,7 +188,7 @@ gtk_style_cascade_dispose (GObject *object)
   GtkStyleCascade *cascade = GTK_STYLE_CASCADE (object);
 
   _gtk_style_cascade_set_parent (cascade, NULL);
-  g_array_unref (cascade->providers);
+  g_array_unref (cascade->stylesheets);
 
   G_OBJECT_CLASS (_gtk_style_cascade_parent_class)->dispose (object);
 }
@@ -206,15 +206,15 @@ style_provider_data_clear (gpointer data_)
 {
   GtkStyleProviderData *data = data_;
 
-  g_signal_handler_disconnect (data->provider, data->changed_signal_id);
-  g_object_unref (data->provider);
+  g_signal_handler_disconnect (data->stylesheet, data->changed_signal_id);
+  g_object_unref (data->stylesheet);
 }
 
 static void
 _gtk_style_cascade_init (GtkStyleCascade *cascade)
 {
-  cascade->providers = g_array_new (FALSE, FALSE, sizeof (GtkStyleProviderData));
-  g_array_set_clear_func (cascade->providers, style_provider_data_clear);
+  cascade->stylesheets = g_array_new (FALSE, FALSE, sizeof (GtkStyleProviderData));
+  g_array_set_clear_func (cascade->stylesheets, style_provider_data_clear);
 }
 
 GtkStyleCascade *
@@ -254,53 +254,52 @@ _gtk_style_cascade_set_parent (GtkStyleCascade *cascade,
 }
 
 void
-_gtk_style_cascade_add_provider (GtkStyleCascade  *cascade,
-                                 GtkStyleProvider *provider,
-                                 guint             priority)
+gtk_style_cascade_add_style_sheet (GtkStyleCascade  *cascade,
+                                   GtkCssStyleSheet *stylesheet)
 {
   GtkStyleProviderData data;
   guint i;
 
   gtk_internal_return_if_fail (GTK_IS_STYLE_CASCADE (cascade));
-  gtk_internal_return_if_fail (GTK_IS_STYLE_PROVIDER (provider));
-  gtk_internal_return_if_fail (GTK_STYLE_PROVIDER (cascade) != provider);
+  gtk_internal_return_if_fail (GTK_IS_CSS_STYLE_SHEET (stylesheet));
 
-  data.provider = g_object_ref (provider);
-  data.priority = priority;
-  data.changed_signal_id = g_signal_connect_swapped (provider,
+  data.stylesheet = g_object_ref (stylesheet);
+  data.changed_signal_id = g_signal_connect_swapped (stylesheet,
                                                      "gtk-private-changed",
                                                      G_CALLBACK (gtk_style_provider_changed),
                                                      cascade);
 
   /* ensure it gets removed first */
-  _gtk_style_cascade_remove_provider (cascade, provider);
+  gtk_style_cascade_remove_style_sheet (cascade, stylesheet);
 
-  for (i = 0; i < cascade->providers->len; i++)
+  for (i = 0; i < cascade->stylesheets->len; i++)
     {
-      if (g_array_index (cascade->providers, GtkStyleProviderData, i).priority > priority)
+      GtkStyleProviderData *adata = &g_array_index (cascade->stylesheets, GtkStyleProviderData, i);
+
+      if (gtk_css_style_sheet_get_priority (adata->stylesheet) > gtk_css_style_sheet_get_priority 
(stylesheet))
         break;
     }
-  g_array_insert_val (cascade->providers, i, data);
+  g_array_insert_val (cascade->stylesheets, i, data);
 
   gtk_style_provider_changed (GTK_STYLE_PROVIDER (cascade));
 }
 
 void
-_gtk_style_cascade_remove_provider (GtkStyleCascade  *cascade,
-                                    GtkStyleProvider *provider)
+gtk_style_cascade_remove_style_sheet (GtkStyleCascade  *cascade,
+                                      GtkCssStyleSheet *stylesheet)
 {
   guint i;
 
   gtk_internal_return_if_fail (GTK_IS_STYLE_CASCADE (cascade));
-  gtk_internal_return_if_fail (GTK_IS_STYLE_PROVIDER (provider));
+  gtk_internal_return_if_fail (GTK_IS_CSS_STYLE_SHEET (stylesheet));
 
-  for (i = 0; i < cascade->providers->len; i++)
+  for (i = 0; i < cascade->stylesheets->len; i++)
     {
-      GtkStyleProviderData *data = &g_array_index (cascade->providers, GtkStyleProviderData, i);
+      GtkStyleProviderData *data = &g_array_index (cascade->stylesheets, GtkStyleProviderData, i);
 
-      if (data->provider == provider)
+      if (data->stylesheet == stylesheet)
         {
-          g_array_remove_index (cascade->providers, i);
+          g_array_remove_index (cascade->stylesheets, i);
   
           gtk_style_provider_changed (GTK_STYLE_PROVIDER (cascade));
           break;
diff --git a/gtk/gtkstylecascadeprivate.h b/gtk/gtkstylecascadeprivate.h
index 61f3521829..00e8ad66ec 100644
--- a/gtk/gtkstylecascadeprivate.h
+++ b/gtk/gtkstylecascadeprivate.h
@@ -38,7 +38,7 @@ struct _GtkStyleCascade
   GObject object;
 
   GtkStyleCascade *parent;
-  GArray *providers;
+  GArray *stylesheets;
 };
 
 struct _GtkStyleCascadeClass
@@ -52,11 +52,10 @@ GtkStyleCascade *     _gtk_style_cascade_new                    (void);
 
 void                  _gtk_style_cascade_set_parent             (GtkStyleCascade     *cascade,
                                                                  GtkStyleCascade     *parent);
-void                  _gtk_style_cascade_add_provider           (GtkStyleCascade     *cascade,
-                                                                 GtkStyleProvider    *provider,
-                                                                 guint                priority);
-void                  _gtk_style_cascade_remove_provider        (GtkStyleCascade     *cascade,
-                                                                 GtkStyleProvider    *provider);
+void                  gtk_style_cascade_add_style_sheet         (GtkStyleCascade     *cascade,
+                                                                 GtkCssStyleSheet    *stylesheet);
+void                  gtk_style_cascade_remove_style_sheet      (GtkStyleCascade     *cascade,
+                                                                 GtkCssStyleSheet    *stylesheet);
 
 
 G_END_DECLS
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index d12e67e997..f3775cfc31 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -59,8 +59,8 @@
  * In order to construct the final style information, #GtkStyleContext
  * queries information from all attached #GtkStyleProviders. Style providers
  * can be either attached explicitly to the context through
- * gtk_style_context_add_provider(), or to the display through
- * gtk_style_context_add_provider_for_display(). The resulting style is a
+ * gtk_style_context_add_style_sheet(), or to the display through
+ * gtk_style_context_add_style_sheet_for_display(). The resulting style is a
  * combination of all providers’ information in priority order.
  *
  * For GTK+ widgets, any #GtkStyleContext returned by
@@ -346,34 +346,28 @@ gtk_style_context_new_for_node (GtkCssNode *node)
 }
 
 /**
- * gtk_style_context_add_provider:
+ * gtk_style_context_add_style_sheet:
  * @context: a #GtkStyleContext
- * @provider: a #GtkStyleProvider
- * @priority: the priority of the style provider. The lower
- *            it is, the earlier it will be used in the style
- *            construction. Typically this will be in the range
- *            between %GTK_STYLE_PROVIDER_PRIORITY_FALLBACK and
- *            %GTK_STYLE_PROVIDER_PRIORITY_USER
- *
- * Adds a style provider to @context, to be used in style construction.
- * Note that a style provider added by this function only affects
+ * @stylesheet: (transfer none): a #GtkCssStyleSheet
+ *
+ * Adds a style sheet to @context, to be used in style construction.
+ * Note that a style sheet added by this function only affects
  * the style of the widget to which @context belongs. If you want
  * to affect the style of all widgets, use
- * gtk_style_context_add_provider_for_display().
+ * gtk_style_context_add_style_sheet_for_display().
  *
  * Note: If both priorities are the same, a #GtkStyleProvider
  * added through this function takes precedence over another added
- * through gtk_style_context_add_provider_for_display().
+ * through gtk_style_context_add_style_sheet_for_display().
  **/
 void
-gtk_style_context_add_provider (GtkStyleContext  *context,
-                                GtkStyleProvider *provider,
-                                guint             priority)
+gtk_style_context_add_style_sheet (GtkStyleContext  *context,
+                                   GtkCssStyleSheet *stylesheet)
 {
   GtkStyleContextPrivate *priv = gtk_style_context_get_instance_private (context);
 
   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
-  g_return_if_fail (GTK_IS_STYLE_PROVIDER (provider));
+  g_return_if_fail (GTK_IS_CSS_STYLE_SHEET (stylesheet));
 
   if (!gtk_style_context_has_custom_cascade (context))
     {
@@ -382,36 +376,36 @@ gtk_style_context_add_provider (GtkStyleContext  *context,
       new_cascade = _gtk_style_cascade_new ();
       _gtk_style_cascade_set_parent (new_cascade,
                                      gtk_settings_get_style_cascade (gtk_settings_get_for_display 
(priv->display)));
-      _gtk_style_cascade_add_provider (new_cascade, provider, priority);
+      gtk_style_cascade_add_style_sheet (new_cascade, stylesheet);
       gtk_style_context_set_cascade (context, new_cascade);
       g_object_unref (new_cascade);
     }
   else
     {
-      _gtk_style_cascade_add_provider (priv->cascade, provider, priority);
+      gtk_style_cascade_add_style_sheet (priv->cascade, stylesheet);
     }
 }
 
 /**
- * gtk_style_context_remove_provider:
+ * gtk_style_context_remove_style_sheet:
  * @context: a #GtkStyleContext
- * @provider: a #GtkStyleProvider
+ * @stylesheet: a #GtkCssStyleSheet
  *
- * Removes @provider from the style providers list in @context.
+ * Removes @stylesheet from the style providers list in @context.
  **/
 void
-gtk_style_context_remove_provider (GtkStyleContext  *context,
-                                   GtkStyleProvider *provider)
+gtk_style_context_remove_style_sheet (GtkStyleContext  *context,
+                                      GtkCssStyleSheet *stylesheet)
 {
   GtkStyleContextPrivate *priv = gtk_style_context_get_instance_private (context);
 
   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
-  g_return_if_fail (GTK_IS_STYLE_PROVIDER (provider));
+  g_return_if_fail (GTK_IS_CSS_STYLE_SHEET (stylesheet));
 
   if (!gtk_style_context_has_custom_cascade (context))
     return;
 
-  _gtk_style_cascade_remove_provider (priv->cascade, provider);
+  gtk_style_cascade_remove_style_sheet (priv->cascade, stylesheet);
 }
 
 /**
@@ -445,14 +439,9 @@ gtk_style_context_reset_widgets (GdkDisplay *display)
 }
 
 /**
- * gtk_style_context_add_provider_for_display:
+ * gtk_style_context_add_style_sheet_for_display:
  * @display: a #GdkDisplay
- * @provider: a #GtkStyleProvider
- * @priority: the priority of the style provider. The lower
- *            it is, the earlier it will be used in the style
- *            construction. Typically this will be in the range
- *            between %GTK_STYLE_PROVIDER_PRIORITY_FALLBACK and
- *            %GTK_STYLE_PROVIDER_PRIORITY_USER
+ * @stylesheet: (transfer none): a #GtkCssStyleSheet
  *
  * Adds a global style provider to @display, which will be used
  * in style construction for all #GtkStyleContexts under @display.
@@ -461,43 +450,40 @@ gtk_style_context_reset_widgets (GdkDisplay *display)
  * available.
  *
  * Note: If both priorities are the same, A #GtkStyleProvider
- * added through gtk_style_context_add_provider() takes precedence
+ * added through gtk_style_context_add_style_sheet() takes precedence
  * over another added through this function.
  **/
 void
-gtk_style_context_add_provider_for_display (GdkDisplay       *display,
-                                            GtkStyleProvider *provider,
-                                            guint             priority)
+gtk_style_context_add_style_sheet_for_display (GdkDisplay       *display,
+                                               GtkCssStyleSheet *stylesheet)
 {
   GtkStyleCascade *cascade;
 
   g_return_if_fail (GDK_IS_DISPLAY (display));
-  g_return_if_fail (GTK_IS_STYLE_PROVIDER (provider));
-  g_return_if_fail (!GTK_IS_SETTINGS (provider) || _gtk_settings_get_display (GTK_SETTINGS (provider)) == 
display);
+  g_return_if_fail (GTK_IS_CSS_STYLE_SHEET (stylesheet));
 
   cascade = gtk_settings_get_style_cascade (gtk_settings_get_for_display (display));
-  _gtk_style_cascade_add_provider (cascade, provider, priority);
+  gtk_style_cascade_add_style_sheet (cascade, stylesheet);
 }
 
 /**
- * gtk_style_context_remove_provider_for_display:
+ * gtk_style_context_remove_style_sheet_for_display:
  * @display: a #GdkDisplay
  * @provider: a #GtkStyleProvider
  *
  * Removes @provider from the global style providers list in @display.
  **/
 void
-gtk_style_context_remove_provider_for_display (GdkDisplay       *display,
-                                               GtkStyleProvider *provider)
+gtk_style_context_remove_style_sheet_for_display (GdkDisplay       *display,
+                                                  GtkCssStyleSheet *stylesheet)
 {
   GtkStyleCascade *cascade;
 
   g_return_if_fail (GDK_IS_DISPLAY (display));
-  g_return_if_fail (GTK_IS_STYLE_PROVIDER (provider));
-  g_return_if_fail (!GTK_IS_SETTINGS (provider));
+  g_return_if_fail (GTK_IS_CSS_STYLE_SHEET (stylesheet));
 
   cascade = gtk_settings_get_style_cascade (gtk_settings_get_for_display (display));
-  _gtk_style_cascade_remove_provider (cascade, provider);
+  gtk_style_cascade_remove_style_sheet (cascade, stylesheet);
 }
 
 /*
diff --git a/gtk/gtkstylecontext.h b/gtk/gtkstylecontext.h
index 851a78081d..bd6220efbe 100644
--- a/gtk/gtkstylecontext.h
+++ b/gtk/gtkstylecontext.h
@@ -25,7 +25,8 @@
 #include <gtk/css/gtkcss.h>
 
 #include <gtk/gtkborder.h>
-#include <gtk/gtkstyleprovider.h>
+#include <gtk/gtkcssstylesheet.h>
+#include <gtk/gtkenums.h>
 #include <gtk/gtktypes.h>
 
 G_BEGIN_DECLS
@@ -832,21 +833,18 @@ GDK_AVAILABLE_IN_ALL
 GType gtk_style_context_get_type (void) G_GNUC_CONST;
 
 GDK_AVAILABLE_IN_ALL
-void gtk_style_context_add_provider_for_display    (GdkDisplay       *display,
-                                                    GtkStyleProvider *provider,
-                                                    guint             priority);
+void gtk_style_context_add_style_sheet_for_display (GdkDisplay       *display,
+                                                    GtkCssStyleSheet *stylesheet);
 GDK_AVAILABLE_IN_ALL
-void gtk_style_context_remove_provider_for_display (GdkDisplay       *display,
-                                                    GtkStyleProvider *provider);
+void gtk_style_context_remove_style_sheet_for_display (GdkDisplay       *display,
+                                                    GtkCssStyleSheet *stylesheet);
 
 GDK_AVAILABLE_IN_ALL
-void gtk_style_context_add_provider    (GtkStyleContext  *context,
-                                        GtkStyleProvider *provider,
-                                        guint             priority);
-
+void gtk_style_context_add_style_sheet             (GtkStyleContext  *context,
+                                                    GtkCssStyleSheet *stylesheet);
 GDK_AVAILABLE_IN_ALL
-void gtk_style_context_remove_provider (GtkStyleContext  *context,
-                                        GtkStyleProvider *provider);
+void gtk_style_context_remove_style_sheet          (GtkStyleContext  *context,
+                                                    GtkCssStyleSheet *stylesheet);
 
 GDK_AVAILABLE_IN_ALL
 void gtk_style_context_save    (GtkStyleContext *context);
diff --git a/gtk/gtkstyleprovider.c b/gtk/gtkstyleprovider.c
index 88d83a263f..7125b2b2c5 100644
--- a/gtk/gtkstyleprovider.c
+++ b/gtk/gtkstyleprovider.c
@@ -29,7 +29,7 @@
  * @See_also: #GtkStyleContext, #GtkCssProvider
  *
  * GtkStyleProvider is an interface used to provide style information to a #GtkStyleContext.
- * See gtk_style_context_add_provider() and gtk_style_context_add_provider_for_display().
+ * See gtk_style_context_add_style_sheet() and gtk_style_context_add_style_sheet_for_display().
  */
 
 enum {
diff --git a/gtk/inspector/css-editor.c b/gtk/inspector/css-editor.c
index fe26e00b85..1cfbc4dccd 100644
--- a/gtk/inspector/css-editor.c
+++ b/gtk/inspector/css-editor.c
@@ -163,12 +163,9 @@ disable_toggled (GtkToggleButton       *button,
     return;
 
   if (gtk_toggle_button_get_active (button))
-    gtk_style_context_remove_provider_for_display (ce->priv->display,
-                                                   GTK_STYLE_PROVIDER (ce->priv->stylesheet));
+    gtk_style_context_remove_style_sheet_for_display (ce->priv->display, ce->priv->stylesheet);
   else
-    gtk_style_context_add_provider_for_display (ce->priv->display,
-                                                GTK_STYLE_PROVIDER (ce->priv->stylesheet),
-                                                GTK_STYLE_PROVIDER_PRIORITY_USER);
+    gtk_style_context_add_style_sheet_for_display (ce->priv->display, ce->priv->stylesheet);
 }
 
 static gchar *
@@ -331,6 +328,7 @@ static void
 create_provider (GtkInspectorCssEditor *ce)
 {
   ce->priv->stylesheet = gtk_css_style_sheet_new ();
+  gtk_css_style_sheet_set_priority (ce->priv->stylesheet, GTK_STYLE_PROVIDER_PRIORITY_USER);
   g_signal_connect (ce->priv->stylesheet, "parsing-error",
                     G_CALLBACK (show_parsing_error), ce);
 
@@ -347,17 +345,15 @@ static void
 add_provider (GtkInspectorCssEditor *ce,
               GdkDisplay *display)
 {
-  gtk_style_context_add_provider_for_display (display,
-                                              GTK_STYLE_PROVIDER (ce->priv->stylesheet),
-                                              GTK_STYLE_PROVIDER_PRIORITY_USER);
+  gtk_style_context_add_style_sheet_for_display (display, ce->priv->stylesheet);
 }
 
 static void
 remove_provider (GtkInspectorCssEditor *ce,
                  GdkDisplay *display)
 {
-  gtk_style_context_remove_provider_for_display (display,
-                                                 GTK_STYLE_PROVIDER (ce->priv->stylesheet));
+  gtk_style_context_remove_style_sheet_for_display (display,
+                                                    ce->priv->stylesheet);
 }
 
 static void
diff --git a/gtk/inspector/window.c b/gtk/inspector/window.c
index 575db5dbd3..bcd0c4bd93 100644
--- a/gtk/inspector/window.c
+++ b/gtk/inspector/window.c
@@ -325,10 +325,9 @@ gtk_inspector_window_realize (GtkWidget *widget)
   gsk_renderer_set_debug_flags (renderer, 0);
 
   stylesheet = gtk_css_style_sheet_new ();
+  gtk_css_style_sheet_set_priority (stylesheet, 800);
   gtk_css_style_sheet_load_from_resource (stylesheet, "/org/gtk/libgtk/inspector/inspector.css");
-  gtk_style_context_add_provider_for_display (gtk_widget_get_display (widget),
-                                              GTK_STYLE_PROVIDER (stylesheet),
-                                              800);
+  gtk_style_context_add_style_sheet_for_display (gtk_widget_get_display (widget), stylesheet);
   g_object_unref (stylesheet);
 }
 
diff --git a/gtk/tools/gtk-builder-tool-preview.c b/gtk/tools/gtk-builder-tool-preview.c
index e2a6d486fd..9d47aa9f5e 100644
--- a/gtk/tools/gtk-builder-tool-preview.c
+++ b/gtk/tools/gtk-builder-tool-preview.c
@@ -65,9 +65,7 @@ preview_file (const char *filename,
       stylesheet = gtk_css_style_sheet_new ();
       gtk_css_style_sheet_load_from_path (stylesheet, cssfile);
 
-      gtk_style_context_add_provider_for_display (gdk_display_get_default (),
-                                                  GTK_STYLE_PROVIDER (stylesheet),
-                                                  GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+      gtk_style_context_add_style_sheet_for_display (gdk_display_get_default (), stylesheet);
     }
 
   builder = gtk_builder_new ();
diff --git a/tests/animated-revealing.c b/tests/animated-revealing.c
index a4fbacba5a..54f2401683 100644
--- a/tests/animated-revealing.c
+++ b/tests/animated-revealing.c
@@ -67,9 +67,7 @@ main(int argc, char **argv)
 
   stylesheet = gtk_css_style_sheet_new ();
   gtk_css_style_sheet_load_from_data (stylesheet, "* { padding: 2px; text-shadow: 5px 5px 2px grey; }", -1);
-  gtk_style_context_add_provider_for_display (gdk_display_get_default (),
-                                              GTK_STYLE_PROVIDER (stylesheet),
-                                              GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+  gtk_style_context_add_style_sheet_for_display (gdk_display_get_default (), stylesheet);
 
   for (x = 0; x < 10; x++)
     {
diff --git a/tests/testadjustsize.c b/tests/testadjustsize.c
index 2f76ddd401..269311d305 100644
--- a/tests/testadjustsize.c
+++ b/tests/testadjustsize.c
@@ -370,9 +370,7 @@ main (int argc, char *argv[])
     ".black-bg { background-color: black; }"
     ".red-bg { background-color: red; }"
     ".blue-bg { background-color: blue; }", -1);
-  gtk_style_context_add_provider_for_display (gdk_display_get_default (),
-                                              GTK_STYLE_PROVIDER (stylesheet),
-                                              GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+  gtk_style_context_add_style_sheet_for_display (gdk_display_get_default (), stylesheet);
   g_object_unref (stylesheet);
   
   if (g_getenv ("RTL"))
diff --git a/tests/testbaseline.c b/tests/testbaseline.c
index f8f7bfd259..7668a8b320 100644
--- a/tests/testbaseline.c
+++ b/tests/testbaseline.c
@@ -95,9 +95,7 @@ main (int    argc,
     ".small-font { font-size: 5px; }"
     ".medium-font { font-size: 10px; }"
     ".large-font { font-size: 15px; }", -1);
-  gtk_style_context_add_provider_for_display (gdk_display_get_default (),
-                                              GTK_STYLE_PROVIDER (stylesheet),
-                                              GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+  gtk_style_context_add_style_sheet_for_display (gdk_display_get_default (), stylesheet);
   g_object_unref (stylesheet);
   window = gtk_window_new ();
   g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (quit_cb), &done);
diff --git a/tests/testborderdrawing.c b/tests/testborderdrawing.c
index b3381344f6..d6d4d0db1c 100644
--- a/tests/testborderdrawing.c
+++ b/tests/testborderdrawing.c
@@ -102,9 +102,8 @@ main (int argc, char **argv)
 
   stylesheet = gtk_css_style_sheet_new ();
   gtk_css_style_sheet_load_from_data (stylesheet, css, -1);
-  gtk_style_context_add_provider_for_display (gdk_display_get_default (),
-                                              GTK_STYLE_PROVIDER (stylesheet),
-                                              GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+  gtk_style_context_add_style_sheet_for_display (gdk_display_get_default (), stylesheet);
+  g_object_unref (stylesheet);
 
   window = gtk_window_new ();
   box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 40);
diff --git a/tests/testcombochange.c b/tests/testcombochange.c
index 5d43c55e0d..8319657001 100644
--- a/tests/testcombochange.c
+++ b/tests/testcombochange.c
@@ -96,9 +96,8 @@ create_combo (const char *name,
   gtk_css_style_sheet_load_from_data (stylesheet, css_data, -1);
   g_free (css_data);
 
-  gtk_style_context_add_provider (context,
-                                  GTK_STYLE_PROVIDER (stylesheet),
-                                  GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+  gtk_style_context_add_style_sheet (context, stylesheet);
+  g_object_unref (stylesheet);
 
   return combo;
 }
diff --git a/tests/testdnd3.c b/tests/testdnd3.c
index 7d24d25590..d18992717a 100644
--- a/tests/testdnd3.c
+++ b/tests/testdnd3.c
@@ -175,11 +175,12 @@ set_color (GtkWidget *item,
   context = gtk_widget_get_style_context (item);
   stylesheet = g_object_get_data (G_OBJECT (context), "style-stylesheet");
   if (stylesheet)
-    gtk_style_context_remove_provider (context, GTK_STYLE_PROVIDER (stylesheet));
+    gtk_style_context_remove_style_sheet (context, stylesheet);
 
   stylesheet = gtk_css_style_sheet_new ();
+  gtk_css_style_sheet_set_priority (stylesheet, 800);
   gtk_css_style_sheet_load_from_data (stylesheet, css, -1);
-  gtk_style_context_add_provider (gtk_widget_get_style_context (item), GTK_STYLE_PROVIDER (stylesheet), 800);
+  gtk_style_context_add_style_sheet (gtk_widget_get_style_context (item), stylesheet);
   g_object_set_data_full (G_OBJECT (context), "style-stylesheet", stylesheet, g_object_unref);
 
   g_free (str);
diff --git a/tests/testentryicons.c b/tests/testentryicons.c
index 8ccf45a76f..d31a3b8cc0 100644
--- a/tests/testentryicons.c
+++ b/tests/testentryicons.c
@@ -294,7 +294,8 @@ main (int argc, char **argv)
   GtkCssStyleSheet *stylesheet;
   stylesheet = gtk_css_style_sheet_new ();
   gtk_css_style_sheet_load_from_data (stylesheet, cssdata, -1);
-  gtk_style_context_add_provider_for_display (gdk_display_get_default (), GTK_STYLE_PROVIDER (stylesheet), 
800);
+  gtk_style_context_add_style_sheet_for_display (gdk_display_get_default (), stylesheet);
+  g_object_unref (stylesheet);
   gtk_widget_show (window);
 
   while (!done)
diff --git a/tests/testframe.c b/tests/testframe.c
index f93bcd5717..311dfa3463 100644
--- a/tests/testframe.c
+++ b/tests/testframe.c
@@ -33,9 +33,7 @@ spin_hpadding_cb (GtkSpinButton *spin, gpointer user_data)
     {
       stylesheet = gtk_css_style_sheet_new ();
       g_object_set_data (G_OBJECT (frame), "stylesheet", stylesheet);
-      gtk_style_context_add_provider (context,
-                                      GTK_STYLE_PROVIDER (stylesheet),
-                                      GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+      gtk_style_context_add_style_sheet (context, stylesheet);
     }
 
   gtk_style_context_save (context);
@@ -69,9 +67,7 @@ spin_vpadding_cb (GtkSpinButton *spin, gpointer user_data)
     {
       stylesheet = gtk_css_style_sheet_new ();
       g_object_set_data (G_OBJECT (frame), "stylesheet", stylesheet);
-      gtk_style_context_add_provider (context,
-                                      GTK_STYLE_PROVIDER (stylesheet),
-                                      GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+      gtk_style_context_add_style_sheet (context, stylesheet);
     }
 
   gtk_style_context_save (context);
diff --git a/tests/testgrid.c b/tests/testgrid.c
index 9411b7728a..6cf60fad21 100644
--- a/tests/testgrid.c
+++ b/tests/testgrid.c
@@ -13,9 +13,7 @@ oriented_test_widget (const gchar *label, const gchar *color)
   stylesheet = gtk_css_style_sheet_new ();
   data = g_strdup_printf ("box { background: %s; }", color);
   gtk_css_style_sheet_load_from_data (stylesheet, data, -1);
-  gtk_style_context_add_provider (gtk_widget_get_style_context (box),
-                                  GTK_STYLE_PROVIDER (stylesheet),
-                                  GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+  gtk_style_context_add_style_sheet (gtk_widget_get_style_context (box), stylesheet);
   g_free (data);
   g_object_unref (stylesheet);
   gtk_container_add (GTK_CONTAINER (box), widget);
diff --git a/tests/testgtk.c b/tests/testgtk.c
index 230f784344..cdf496e611 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -206,9 +206,7 @@ create_alpha_window (GtkWidget *widget)
                                            "  background: radial-gradient(ellipse at center, #FFBF00, 
#FFBF0000);\n"
                                            "}\n",
                                            -1);
-          gtk_style_context_add_provider_for_display (gtk_widget_get_display (window),
-                                                      GTK_STYLE_PROVIDER (stylesheet),
-                                                      GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+          gtk_style_context_add_style_sheet_for_display (gtk_widget_get_display (window), stylesheet);
           g_object_unref (stylesheet);
         }
 
@@ -6327,7 +6325,7 @@ usage (void)
 int
 main (int argc, char *argv[])
 {
-  GtkCssStyleSheet *stylesheet, *memory_provider;
+  GtkCssStyleSheet *stylesheet, *memory_stylesheet;
   GdkDisplay *display;
   GtkBindingSet *binding_set;
   int i;
@@ -6359,8 +6357,7 @@ main (int argc, char *argv[])
 
   display = gdk_display_get_default ();
 
-  gtk_style_context_add_provider_for_display (display, GTK_STYLE_PROVIDER (stylesheet),
-                                              GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+  gtk_style_context_add_style_sheet_for_display (display, stylesheet);
   g_object_unref (stylesheet);
 
   gtk_accelerator_set_default_mod_mask (GDK_SHIFT_MASK |
@@ -6422,16 +6419,17 @@ main (int argc, char *argv[])
                                1,
                                G_TYPE_STRING, "GtkWidgetClass <ctrl><release>9 test");
 
-  memory_provider = gtk_css_style_sheet_new ();
-  gtk_css_style_sheet_load_from_data (memory_provider,
+  memory_stylesheet = gtk_css_style_sheet_new ();
+  gtk_css_style_sheet_set_priority (memory_stylesheet, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION + 1);
+  gtk_css_style_sheet_load_from_data (memory_stylesheet,
                                    "#testgtk-version-label {\n"
                                    "  color: #f00;\n"
                                    "  font-family: Sans;\n"
                                    "  font-size: 18px;\n"
                                    "}",
                                    -1);
-  gtk_style_context_add_provider_for_display (display, GTK_STYLE_PROVIDER (memory_provider),
-                                              GTK_STYLE_PROVIDER_PRIORITY_APPLICATION + 1);
+  gtk_style_context_add_style_sheet_for_display (display, memory_stylesheet);
+  g_object_unref (memory_stylesheet);
 
   create_main_window ();
 
diff --git a/tests/testheaderbar.c b/tests/testheaderbar.c
index 4f81128b61..f5de76e4b1 100644
--- a/tests/testheaderbar.c
+++ b/tests/testheaderbar.c
@@ -145,9 +145,8 @@ main (int argc, char *argv[])
 
   stylesheet = gtk_css_style_sheet_new ();
   gtk_css_style_sheet_load_from_data (stylesheet, css, -1);
-  gtk_style_context_add_provider_for_display (gtk_widget_get_display (window),
-                                              GTK_STYLE_PROVIDER (stylesheet),
-                                              GTK_STYLE_PROVIDER_PRIORITY_USER);
+  gtk_style_context_add_style_sheet_for_display (gtk_widget_get_display (window), stylesheet);
+  g_object_unref (stylesheet);
 
 
   change_header (NULL, window);
diff --git a/tests/testiconview-keynav.c b/tests/testiconview-keynav.c
index 6e4f55debe..c68951b5eb 100644
--- a/tests/testiconview-keynav.c
+++ b/tests/testiconview-keynav.c
@@ -216,9 +216,9 @@ set_styles (void)
 
   gtk_css_style_sheet_load_from_data (stylesheet, CSS, -1);
 
-  gtk_style_context_add_provider_for_display (gdk_display_get_default (),
-                                              GTK_STYLE_PROVIDER (stylesheet),
-                                              GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+  gtk_style_context_add_style_sheet_for_display (gdk_display_get_default (), stylesheet);
+
+  g_object_unref (stylesheet);
 }
 
 int
diff --git a/tests/testlevelbar.c b/tests/testlevelbar.c
index a8ec684cd4..e6885a44d8 100644
--- a/tests/testlevelbar.c
+++ b/tests/testlevelbar.c
@@ -35,9 +35,8 @@ add_custom_css (void)
 
   stylesheet = gtk_css_style_sheet_new ();
   gtk_css_style_sheet_load_from_data (stylesheet, data, -1);
-  gtk_style_context_add_provider_for_display (gdk_display_get_default (),
-                                              GTK_STYLE_PROVIDER (stylesheet),
-                                              GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+  gtk_style_context_add_style_sheet_for_display (gdk_display_get_default (), stylesheet);
+  g_object_unref (stylesheet);
 }
 
 static gboolean
diff --git a/tests/testlist.c b/tests/testlist.c
index 44b4ba48df..6530217540 100644
--- a/tests/testlist.c
+++ b/tests/testlist.c
@@ -262,9 +262,8 @@ main (int argc, char *argv[])
 
   stylesheet = gtk_css_style_sheet_new ();
   gtk_css_style_sheet_load_from_data (stylesheet, css, -1);
-  gtk_style_context_add_provider_for_display (gtk_widget_get_display (window),
-                                              GTK_STYLE_PROVIDER (stylesheet),
-                                              GTK_STYLE_PROVIDER_PRIORITY_USER);
+  gtk_style_context_add_style_sheet_for_display (gtk_widget_get_display (window), stylesheet);
+  g_object_unref (stylesheet);
 
 
   list = gtk_list_box_new ();
diff --git a/tests/testlist3.c b/tests/testlist3.c
index eff6f61e1d..363f3ea3ef 100644
--- a/tests/testlist3.c
+++ b/tests/testlist3.c
@@ -163,7 +163,9 @@ main (int argc, char *argv[])
 
   stylesheet = gtk_css_style_sheet_new ();
   gtk_css_style_sheet_load_from_data (stylesheet, css, -1);
-  gtk_style_context_add_provider_for_display (gdk_display_get_default (), GTK_STYLE_PROVIDER (stylesheet), 
800);
+  gtk_style_context_add_style_sheet_for_display (gdk_display_get_default (), stylesheet);
+  g_object_unref (stylesheet);
+
   window = gtk_window_new ();
   gtk_window_set_default_size (GTK_WINDOW (window), -1, 300);
 
diff --git a/tests/testmodelbutton.c b/tests/testmodelbutton.c
index a6be8eacd2..83eae089ad 100644
--- a/tests/testmodelbutton.c
+++ b/tests/testmodelbutton.c
@@ -35,9 +35,8 @@ on_application_activate (GApplication *gapplication,
     "button.model { background: yellow; }"
     , -1);
   g_assert (GDK_IS_DISPLAY (display));
-  gtk_style_context_add_provider_for_display (display,
-                                              GTK_STYLE_PROVIDER (stylesheet),
-                                              GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+  gtk_style_context_add_style_sheet_for_display (display, stylesheet);
+  g_object_unref (stylesheet);
 
   action = g_simple_action_new ("beep", NULL);
   g_signal_connect (action, "activate", G_CALLBACK (on_action_beep), NULL);
diff --git a/tests/testoutsetshadowdrawing.c b/tests/testoutsetshadowdrawing.c
index 1e4cb6fcbe..6c202953a0 100644
--- a/tests/testoutsetshadowdrawing.c
+++ b/tests/testoutsetshadowdrawing.c
@@ -99,9 +99,8 @@ main (int argc, char **argv)
 
   stylesheet = gtk_css_style_sheet_new ();
   gtk_css_style_sheet_load_from_data (stylesheet, css, -1);
-  gtk_style_context_add_provider_for_display (gdk_display_get_default (),
-                                              GTK_STYLE_PROVIDER (stylesheet),
-                                              GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+  gtk_style_context_add_style_sheet_for_display (gdk_display_get_default (), stylesheet);
+  g_object_unref (stylesheet);
 
   window = gtk_window_new ();
   gtk_window_set_decorated (GTK_WINDOW (window), FALSE);
diff --git a/tests/testoverlay.c b/tests/testoverlay.c
index 1c00d8af42..819adf9013 100644
--- a/tests/testoverlay.c
+++ b/tests/testoverlay.c
@@ -492,18 +492,17 @@ main (int argc, char *argv[])
   GtkWidget *win6;
   GtkWidget *win7;
   GtkWidget *win8;
-  GtkCssStyleSheet *css_style_sheet;
+  GtkCssStyleSheet *stylesheet;
 
   gtk_init ();
 
   if (g_getenv ("RTL"))
     gtk_widget_set_default_direction (GTK_TEXT_DIR_RTL);
 
-  css_style_sheet = gtk_css_style_sheet_new ();
-  gtk_css_style_sheet_load_from_data (css_style_sheet, css, -1);
-  gtk_style_context_add_provider_for_display (gdk_display_get_default (),
-                                              GTK_STYLE_PROVIDER (css_style_sheet),
-                                              GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+  stylesheet = gtk_css_style_sheet_new ();
+  gtk_css_style_sheet_load_from_data (stylesheet, css, -1);
+  gtk_style_context_add_style_sheet_for_display (gdk_display_get_default (), stylesheet);
+  g_object_unref (stylesheet);
 
   win1 = test_nonzerox ();
   gtk_widget_show (win1);
diff --git a/tests/testoverlaystyleclass.c b/tests/testoverlaystyleclass.c
index 5865f900c1..990817b183 100644
--- a/tests/testoverlaystyleclass.c
+++ b/tests/testoverlaystyleclass.c
@@ -56,9 +56,8 @@ main (int argc, char *argv[])
                                    ".left { border-left-style: none; border-top-left-radius: 0px; 
border-bottom-left-radius: 0px; }"
                                    ".right { border-right-style: none; border-top-right-radius: 0px; 
border-bottom-right-radius: 0px; }",
                                    -1);
-  gtk_style_context_add_provider_for_display (gdk_display_get_default (),
-                                              GTK_STYLE_PROVIDER (stylesheet),
-                                              GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+  gtk_style_context_add_style_sheet_for_display (gdk_display_get_default (), stylesheet);
+  g_object_unref (stylesheet);
 
   win = gtk_window_new ();
   gtk_window_set_default_size (GTK_WINDOW (win), 600, 600);
diff --git a/tests/testwidgetfocus.c b/tests/testwidgetfocus.c
index 148240eee4..413a1f168a 100644
--- a/tests/testwidgetfocus.c
+++ b/tests/testwidgetfocus.c
@@ -288,9 +288,8 @@ main()
 
   stylesheet = gtk_css_style_sheet_new ();
   gtk_css_style_sheet_load_from_data (stylesheet, css, -1);
-  gtk_style_context_add_provider_for_display (gdk_display_get_default (),
-                                              GTK_STYLE_PROVIDER (stylesheet),
-                                              GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+  gtk_style_context_add_style_sheet_for_display (gdk_display_get_default (), stylesheet);
+  g_object_unref (stylesheet);
 
   window = gtk_window_new ();
   widget = g_object_new (GTK_TYPE_FOCUS_WIDGET, NULL);
diff --git a/tests/testwidgettransforms.c b/tests/testwidgettransforms.c
index 842522293c..a30e043cb0 100644
--- a/tests/testwidgettransforms.c
+++ b/tests/testwidgettransforms.c
@@ -304,9 +304,7 @@ main (int argc, char **argv)
 
   stylesheet = gtk_css_style_sheet_new ();
   gtk_css_style_sheet_load_from_data (stylesheet, css, -1);
-  gtk_style_context_add_provider_for_display (gdk_display_get_default (),
-                                              GTK_STYLE_PROVIDER (stylesheet),
-                                              GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+  gtk_style_context_add_style_sheet_for_display (gdk_display_get_default (), stylesheet);
 
   window = gtk_window_new ();
   matrix_chooser = g_object_new (GTK_TYPE_MATRIX_CHOOSER, NULL);
diff --git a/testsuite/css/change/test-css-change.c b/testsuite/css/change/test-css-change.c
index 35b7ce7dcf..5bb67d5a5c 100644
--- a/testsuite/css/change/test-css-change.c
+++ b/testsuite/css/change/test-css-change.c
@@ -127,10 +127,9 @@ load_ui_file (GFile *file, gboolean generate)
   g_assert (css_file != NULL);
 
   stylesheet = gtk_css_style_sheet_new ();
+  gtk_css_style_sheet_set_priority (stylesheet, GTK_STYLE_PROVIDER_PRIORITY_FORCE);
   gtk_css_style_sheet_load_from_path (stylesheet, css_file);
-  gtk_style_context_add_provider_for_display (gdk_display_get_default (),
-                                              GTK_STYLE_PROVIDER (stylesheet),
-                                              GTK_STYLE_PROVIDER_PRIORITY_FORCE);
+  gtk_style_context_add_style_sheet_for_display (gdk_display_get_default (), stylesheet);
 
   builder = gtk_builder_new_from_file (ui_file);
   window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
@@ -168,8 +167,7 @@ load_ui_file (GFile *file, gboolean generate)
   g_free (diff);
 
 out:
-  gtk_style_context_remove_provider_for_display (gdk_display_get_default (),
-                                                 GTK_STYLE_PROVIDER (stylesheet));
+  gtk_style_context_remove_style_sheet_for_display (gdk_display_get_default (), stylesheet);
   g_object_unref (stylesheet);
 
   g_free (output);
diff --git a/testsuite/css/style/test-css-style.c b/testsuite/css/style/test-css-style.c
index ad434d10b6..22f94e87b3 100644
--- a/testsuite/css/style/test-css-style.c
+++ b/testsuite/css/style/test-css-style.c
@@ -144,10 +144,9 @@ load_ui_file (GFile *file, gboolean generate)
   g_assert (css_file != NULL);
 
   stylesheet = gtk_css_style_sheet_new ();
+  gtk_css_style_sheet_set_priority (stylesheet, GTK_STYLE_PROVIDER_PRIORITY_FORCE);
   gtk_css_style_sheet_load_from_path (stylesheet, css_file);
-  gtk_style_context_add_provider_for_display (gdk_display_get_default (),
-                                              GTK_STYLE_PROVIDER (stylesheet),
-                                              GTK_STYLE_PROVIDER_PRIORITY_FORCE);
+  gtk_style_context_add_style_sheet_for_display (gdk_display_get_default (), stylesheet);
 
   builder = gtk_builder_new_from_file (ui_file);
   window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
@@ -183,8 +182,7 @@ load_ui_file (GFile *file, gboolean generate)
   g_clear_pointer (&diff, g_bytes_unref);
 
 out:
-  gtk_style_context_remove_provider_for_display (gdk_display_get_default (),
-                                                 GTK_STYLE_PROVIDER (stylesheet));
+  gtk_style_context_remove_style_sheet_for_display (gdk_display_get_default (), stylesheet);
   g_object_unref (stylesheet);
 
   g_free (output);
diff --git a/testsuite/reftests/gtk-reftest.c b/testsuite/reftests/gtk-reftest.c
index 96283c141b..2d86c1c3b7 100644
--- a/testsuite/reftests/gtk-reftest.c
+++ b/testsuite/reftests/gtk-reftest.c
@@ -212,37 +212,35 @@ get_reference_image (const char *ui_file)
   return reference_image;
 }
 
-static GtkStyleProvider *
+static GtkCssStyleSheet *
 add_extra_css (const char *testname,
                const char *extension)
 {
-  GtkStyleProvider *provider = NULL;
+  GtkCssStyleSheet *stylesheet;
   char *css_file;
   
   css_file = get_test_file (testname, extension, TRUE);
   if (css_file == NULL)
     return NULL;
 
-  provider = GTK_STYLE_PROVIDER (gtk_css_style_sheet_new ());
-  gtk_css_style_sheet_load_from_path (GTK_CSS_STYLE_SHEET (provider),
-                                   css_file);
-  gtk_style_context_add_provider_for_display (gdk_display_get_default (),
-                                              provider,
-                                              GTK_STYLE_PROVIDER_PRIORITY_FORCE);
+  stylesheet = gtk_css_style_sheet_new ();
+  gtk_css_style_sheet_set_priority (stylesheet, GTK_STYLE_PROVIDER_PRIORITY_FORCE);
+  gtk_css_style_sheet_load_from_path (stylesheet, css_file);
+  gtk_style_context_add_style_sheet_for_display (gdk_display_get_default (), stylesheet);
 
   g_free (css_file);
   
-  return provider;
+  return stylesheet;
 }
 
 static void
-remove_extra_css (GtkStyleProvider *provider)
+remove_extra_css (GtkCssStyleSheet *stylesheet)
 {
-  if (provider == NULL)
+  if (stylesheet == NULL)
     return;
 
-  gtk_style_context_remove_provider_for_display (gdk_display_get_default (),
-                                                 provider);
+  gtk_style_context_remove_style_sheet_for_display (gdk_display_get_default (),
+                                                    stylesheet);
 }
 
 static void
@@ -272,11 +270,11 @@ test_ui_file (GFile *file)
 {
   char *ui_file, *reference_file;
   cairo_surface_t *ui_image, *reference_image, *diff_image;
-  GtkStyleProvider *provider;
+  GtkCssStyleSheet *stylesheet;
 
   ui_file = g_file_get_path (file);
 
-  provider = add_extra_css (ui_file, ".css");
+  stylesheet = add_extra_css (ui_file, ".css");
 
   ui_image = reftest_snapshot_ui_file (ui_file);
 
@@ -302,7 +300,7 @@ test_ui_file (GFile *file)
       g_test_fail ();
     }
 
-  remove_extra_css (provider);
+  remove_extra_css (stylesheet);
 }
 
 static int


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]