[gtk/wip/otte/css: 13/17] css: Rename GtkCssPprovider to GtkCssStyleSheet
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/css: 13/17] css: Rename GtkCssPprovider to GtkCssStyleSheet
- Date: Mon, 10 Feb 2020 03:02:32 +0000 (UTC)
commit 1d22d950502de2934b698a83c193fd536d7cee30
Author: Benjamin Otte <otte redhat com>
Date: Mon Feb 10 02:17:21 2020 +0100
css: Rename GtkCssPprovider to GtkCssStyleSheet
Reasons:
- less confusing for people new to GTK
- same name as used in HTML/JS
- I want to add more API from HTML/JS
.../constraint-editor-application.c | 8 +-
demos/gtk-demo/css_accordion.c | 16 +-
demos/gtk-demo/css_basics.c | 22 +-
demos/gtk-demo/css_blendmodes.c | 22 +-
demos/gtk-demo/css_multiplebgs.c | 22 +-
demos/gtk-demo/css_pixbufs.c | 22 +-
demos/gtk-demo/css_shadows.c | 22 +-
demos/gtk-demo/demotaggedentry.c | 10 +-
demos/gtk-demo/dnd.c | 8 +-
demos/gtk-demo/fishbowl.c | 10 +-
demos/gtk-demo/fixed.c | 14 +-
demos/node-editor/node-editor-application.c | 8 +-
demos/widget-factory/widget-factory.c | 10 +-
docs/reference/gtk/gtk4-docs.xml | 2 +-
docs/reference/gtk/gtk4-sections.txt | 36 +-
docs/reference/gtk/meson.build | 2 +-
docs/reference/gtk/text_widget.xml | 8 +-
examples/plugman.c | 8 +-
gtk/gtk-autocleanups.h | 2 +-
gtk/gtk.h | 2 +-
gtk/gtkcssimagelinear.c | 2 +-
gtk/gtkcssimageradial.c | 2 +-
gtk/gtkcssparserprivate.h | 2 +-
gtk/gtkcssselector.c | 2 +-
gtk/gtkcssstaticstyle.c | 8 +-
gtk/{gtkcssprovider.c => gtkcssstylesheet.c} | 413 +++++++++++----------
gtk/{gtkcssprovider.h => gtkcssstylesheet.h} | 37 +-
...providerprivate.h => gtkcssstylesheetprivate.h} | 16 +-
gtk/gtkemojichooser.c | 2 +-
gtk/gtkemojicompletion.c | 2 +-
gtk/gtksettings.c | 30 +-
gtk/gtkstyleproperty.c | 2 +-
gtk/inspector/css-editor.c | 24 +-
gtk/inspector/css-node-tree.c | 2 +-
gtk/inspector/init.c | 4 +-
gtk/inspector/visual.c | 4 +-
gtk/inspector/window.c | 12 +-
gtk/meson.build | 4 +-
gtk/tools/gtk-builder-tool-preview.c | 8 +-
po-properties/POTFILES.in | 2 +-
po/POTFILES.in | 2 +-
tests/animated-revealing.c | 8 +-
tests/testadjustsize.c | 10 +-
tests/testbaseline.c | 10 +-
tests/testborderdrawing.c | 8 +-
tests/testcombochange.c | 8 +-
tests/testdnd3.c | 24 +-
tests/testentryicons.c | 8 +-
tests/testframe.c | 28 +-
tests/testgrid.c | 10 +-
tests/testgtk.c | 28 +-
tests/testheaderbar.c | 8 +-
tests/testiconview-keynav.c | 8 +-
tests/testlevelbar.c | 8 +-
tests/testlist.c | 8 +-
tests/testlist3.c | 8 +-
tests/testmodelbutton.c | 6 +-
tests/testoutsetshadowdrawing.c | 8 +-
tests/testoverlay.c | 8 +-
tests/testoverlaystyleclass.c | 8 +-
tests/testwidgetfocus.c | 8 +-
tests/testwidgettransforms.c | 8 +-
testsuite/css/api.c | 14 +-
testsuite/css/change/test-css-change.c | 12 +-
testsuite/css/parser/test-css-parser.c | 12 +-
testsuite/css/style/test-css-style.c | 12 +-
testsuite/gtk/cssprovider.c | 46 ---
testsuite/gtk/cssstylesheet.c | 46 +++
testsuite/gtk/meson.build | 2 +-
testsuite/gtk/theme-validate.c | 12 +-
testsuite/reftests/gtk-reftest.c | 4 +-
71 files changed, 612 insertions(+), 610 deletions(-)
---
diff --git a/demos/constraint-editor/constraint-editor-application.c
b/demos/constraint-editor/constraint-editor-application.c
index aa130d9c13..1ae31c403e 100644
--- a/demos/constraint-editor/constraint-editor-application.c
+++ b/demos/constraint-editor/constraint-editor-application.c
@@ -52,7 +52,7 @@ constraint_editor_application_startup (GApplication *app)
{
const char *quit_accels[2] = { "<Ctrl>Q", NULL };
const char *open_accels[2] = { "<Ctrl>O", NULL };
- GtkCssProvider *provider;
+ GtkCssStyleSheet *stylesheet;
G_APPLICATION_CLASS (constraint_editor_application_parent_class)->startup (app);
@@ -62,10 +62,10 @@ constraint_editor_application_startup (GApplication *app)
gtk_application_set_accels_for_action (GTK_APPLICATION (app), "app.quit", quit_accels);
gtk_application_set_accels_for_action (GTK_APPLICATION (app), "win.open", open_accels);
- provider = gtk_css_provider_new ();
- gtk_css_provider_load_from_resource (provider, "/org/gtk/gtk4/constraint-editor/constraint-editor.css");
+ 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 (provider),
+ GTK_STYLE_PROVIDER (stylesheet),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
}
diff --git a/demos/gtk-demo/css_accordion.c b/demos/gtk-demo/css_accordion.c
index 357dddfb86..cec68057d9 100644
--- a/demos/gtk-demo/css_accordion.c
+++ b/demos/gtk-demo/css_accordion.c
@@ -8,9 +8,9 @@
static void
destroy_provider (GtkWidget *window,
- GtkCssProvider *provider)
+ GtkCssStyleSheet *stylesheet)
{
- gtk_style_context_remove_provider_for_display (gtk_widget_get_display (window), GTK_STYLE_PROVIDER
(provider));
+ gtk_style_context_remove_provider_for_display (gtk_widget_get_display (window), GTK_STYLE_PROVIDER
(stylesheet));
}
GtkWidget *
@@ -21,7 +21,7 @@ do_css_accordion (GtkWidget *do_widget)
if (!window)
{
GtkWidget *container, *styled_box, *child;
- GtkStyleProvider *provider;
+ GtkStyleProvider *stylesheet;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "CSS Accordion");
@@ -56,15 +56,15 @@ do_css_accordion (GtkWidget *do_widget)
child = gtk_button_new_with_label (":-)");
gtk_container_add (GTK_CONTAINER (container), child);
- provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
- gtk_css_provider_load_from_resource (GTK_CSS_PROVIDER (provider), "/css_accordion/css_accordion.css");
+ 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");
gtk_style_context_add_provider_for_display (gtk_widget_get_display (window),
- GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER (stylesheet),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
g_signal_connect (window, "destroy",
- G_CALLBACK (destroy_provider), provider);
- g_object_unref (provider);
+ G_CALLBACK (destroy_provider), stylesheet);
+ g_object_unref (stylesheet);
}
if (!gtk_widget_get_visible (window))
diff --git a/demos/gtk-demo/css_basics.c b/demos/gtk-demo/css_basics.c
index 06b36483ed..3d2cee2f6d 100644
--- a/demos/gtk-demo/css_basics.c
+++ b/demos/gtk-demo/css_basics.c
@@ -8,7 +8,7 @@
#include <gtk/gtk.h>
static void
-show_parsing_error (GtkCssProvider *provider,
+show_parsing_error (GtkCssStyleSheet *stylesheet,
GtkCssSection *section,
const GError *error,
GtkTextBuffer *buffer)
@@ -38,7 +38,7 @@ show_parsing_error (GtkCssProvider *provider,
static void
css_text_changed (GtkTextBuffer *buffer,
- GtkCssProvider *provider)
+ GtkCssStyleSheet *stylesheet)
{
GtkTextIter start, end;
char *text;
@@ -48,16 +48,16 @@ css_text_changed (GtkTextBuffer *buffer,
gtk_text_buffer_remove_all_tags (buffer, &start, &end);
text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
- gtk_css_provider_load_from_data (provider, text, -1);
+ gtk_css_style_sheet_load_from_data (stylesheet, text, -1);
g_free (text);
}
static void
-apply_css (GtkWidget *widget, GtkStyleProvider *provider)
+apply_css (GtkWidget *widget, GtkStyleProvider *stylesheet)
{
- gtk_style_context_add_provider (gtk_widget_get_style_context (widget), provider, G_MAXUINT);
+ gtk_style_context_add_provider (gtk_widget_get_style_context (widget), stylesheet, G_MAXUINT);
if (GTK_IS_CONTAINER (widget))
- gtk_container_forall (GTK_CONTAINER (widget), (GtkCallback) apply_css, provider);
+ gtk_container_forall (GTK_CONTAINER (widget), (GtkCallback) apply_css, stylesheet);
}
GtkWidget *
@@ -68,7 +68,7 @@ do_css_basics (GtkWidget *do_widget)
if (!window)
{
GtkWidget *container, *child;
- GtkStyleProvider *provider;
+ GtkStyleProvider *stylesheet;
GtkTextBuffer *text;
GBytes *bytes;
@@ -89,25 +89,25 @@ do_css_basics (GtkWidget *do_widget)
"underline", PANGO_UNDERLINE_ERROR,
NULL);
- provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
+ stylesheet = GTK_STYLE_PROVIDER (gtk_css_style_sheet_new ());
container = gtk_scrolled_window_new (NULL, NULL);
gtk_container_add (GTK_CONTAINER (window), container);
child = gtk_text_view_new_with_buffer (text);
gtk_container_add (GTK_CONTAINER (container), child);
g_signal_connect (text, "changed",
- G_CALLBACK (css_text_changed), provider);
+ G_CALLBACK (css_text_changed), stylesheet);
bytes = g_resources_lookup_data ("/css_basics/css_basics.css", 0, NULL);
gtk_text_buffer_set_text (text, g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes));
g_bytes_unref (bytes);
- g_signal_connect (provider,
+ g_signal_connect (stylesheet,
"parsing-error",
G_CALLBACK (show_parsing_error),
gtk_text_view_get_buffer (GTK_TEXT_VIEW (child)));
- apply_css (window, provider);
+ apply_css (window, stylesheet);
}
if (!gtk_widget_get_visible (window))
diff --git a/demos/gtk-demo/css_blendmodes.c b/demos/gtk-demo/css_blendmodes.c
index f93f0336f8..7aa688d510 100644
--- a/demos/gtk-demo/css_blendmodes.c
+++ b/demos/gtk-demo/css_blendmodes.c
@@ -37,7 +37,7 @@ struct {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static void
-update_css_for_blend_mode (GtkCssProvider *provider,
+update_css_for_blend_mode (GtkCssStyleSheet *stylesheet,
const gchar *blend_mode)
{
GBytes *bytes;
@@ -50,7 +50,7 @@ update_css_for_blend_mode (GtkCssProvider *provider,
blend_mode,
blend_mode);
- gtk_css_provider_load_from_data (provider, css, -1);
+ gtk_css_style_sheet_load_from_data (stylesheet, css, -1);
g_bytes_unref (bytes);
g_free (css);
@@ -60,18 +60,18 @@ update_css_for_blend_mode (GtkCssProvider *provider,
static void
row_activated (GtkListBox *listbox,
GtkListBoxRow *row,
- GtkCssProvider *provider)
+ GtkCssStyleSheet *stylesheet)
{
const gchar *blend_mode;
blend_mode = blend_modes[gtk_list_box_row_get_index (row)].id;
- update_css_for_blend_mode (provider, blend_mode);
+ update_css_for_blend_mode (stylesheet, blend_mode);
}
static void
setup_listbox (GtkBuilder *builder,
- GtkStyleProvider *provider)
+ GtkStyleProvider *stylesheet)
{
GtkWidget *normal_row;
GtkWidget *listbox;
@@ -81,7 +81,7 @@ setup_listbox (GtkBuilder *builder,
listbox = gtk_list_box_new ();
gtk_container_add (GTK_CONTAINER (WID ("scrolledwindow")), listbox);
- g_signal_connect (listbox, "row-activated", G_CALLBACK (row_activated), provider);
+ g_signal_connect (listbox, "row-activated", G_CALLBACK (row_activated), stylesheet);
/* Add a row for each blend mode available */
for (i = 0; blend_modes[i].name != NULL; i++)
@@ -118,7 +118,7 @@ do_css_blendmodes (GtkWidget *do_widget)
if (!window)
{
- GtkStyleProvider *provider;
+ GtkStyleProvider *stylesheet;
GtkBuilder *builder;
builder = gtk_builder_new_from_resource ("/css_blendmodes/blendmodes.ui");
@@ -127,14 +127,14 @@ do_css_blendmodes (GtkWidget *do_widget)
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget));
g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window);
- /* Setup the CSS provider for window */
- provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
+ /* Setup the CSS stylesheet for window */
+ stylesheet = GTK_STYLE_PROVIDER (gtk_css_style_sheet_new ());
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
- provider,
+ stylesheet,
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
- setup_listbox (builder, provider);
+ setup_listbox (builder, stylesheet);
}
if (!gtk_widget_get_visible (window))
diff --git a/demos/gtk-demo/css_multiplebgs.c b/demos/gtk-demo/css_multiplebgs.c
index 6475c2c31a..8210a42dab 100644
--- a/demos/gtk-demo/css_multiplebgs.c
+++ b/demos/gtk-demo/css_multiplebgs.c
@@ -8,7 +8,7 @@
#include <gtk/gtk.h>
static void
-show_parsing_error (GtkCssProvider *provider,
+show_parsing_error (GtkCssStyleSheet *stylesheet,
GtkCssSection *section,
const GError *error,
GtkTextBuffer *buffer)
@@ -39,7 +39,7 @@ show_parsing_error (GtkCssProvider *provider,
static void
css_text_changed (GtkTextBuffer *buffer,
- GtkCssProvider *provider)
+ GtkCssStyleSheet *stylesheet)
{
GtkTextIter start, end;
char *text;
@@ -49,7 +49,7 @@ css_text_changed (GtkTextBuffer *buffer,
gtk_text_buffer_remove_all_tags (buffer, &start, &end);
text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
- gtk_css_provider_load_from_data (provider, text, -1);
+ gtk_css_style_sheet_load_from_data (stylesheet, text, -1);
g_free (text);
}
@@ -67,11 +67,11 @@ drawing_area_draw (GtkDrawingArea *da,
}
static void
-apply_css (GtkWidget *widget, GtkStyleProvider *provider)
+apply_css (GtkWidget *widget, GtkStyleProvider *stylesheet)
{
- gtk_style_context_add_provider (gtk_widget_get_style_context (widget), provider, G_MAXUINT);
+ gtk_style_context_add_provider (gtk_widget_get_style_context (widget), stylesheet, G_MAXUINT);
if (GTK_IS_CONTAINER (widget))
- gtk_container_forall (GTK_CONTAINER (widget), (GtkCallback) apply_css, provider);
+ gtk_container_forall (GTK_CONTAINER (widget), (GtkCallback) apply_css, stylesheet);
}
GtkWidget *
@@ -82,7 +82,7 @@ do_css_multiplebgs (GtkWidget *do_widget)
if (!window)
{
GtkWidget *paned, *container, *child;
- GtkStyleProvider *provider;
+ GtkStyleProvider *stylesheet;
GtkTextBuffer *text;
GBytes *bytes;
@@ -127,7 +127,7 @@ do_css_multiplebgs (GtkWidget *do_widget)
"underline", PANGO_UNDERLINE_ERROR,
NULL);
- provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
+ stylesheet = GTK_STYLE_PROVIDER (gtk_css_style_sheet_new ());
container = gtk_scrolled_window_new (NULL, NULL);
gtk_container_add (GTK_CONTAINER (paned), container);
@@ -136,18 +136,18 @@ do_css_multiplebgs (GtkWidget *do_widget)
g_signal_connect (text,
"changed",
G_CALLBACK (css_text_changed),
- provider);
+ stylesheet);
bytes = g_resources_lookup_data ("/css_multiplebgs/css_multiplebgs.css", 0, NULL);
gtk_text_buffer_set_text (text, g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes));
g_bytes_unref (bytes);
- g_signal_connect (provider,
+ g_signal_connect (stylesheet,
"parsing-error",
G_CALLBACK (show_parsing_error),
gtk_text_view_get_buffer (GTK_TEXT_VIEW (child)));
- apply_css (window, provider);
+ apply_css (window, stylesheet);
}
if (!gtk_widget_get_visible (window))
diff --git a/demos/gtk-demo/css_pixbufs.c b/demos/gtk-demo/css_pixbufs.c
index 4846102ac3..a59d3594c4 100644
--- a/demos/gtk-demo/css_pixbufs.c
+++ b/demos/gtk-demo/css_pixbufs.c
@@ -7,7 +7,7 @@
#include <gtk/gtk.h>
static void
-show_parsing_error (GtkCssProvider *provider,
+show_parsing_error (GtkCssStyleSheet *stylesheet,
GtkCssSection *section,
const GError *error,
GtkTextBuffer *buffer)
@@ -38,7 +38,7 @@ show_parsing_error (GtkCssProvider *provider,
static void
css_text_changed (GtkTextBuffer *buffer,
- GtkCssProvider *provider)
+ GtkCssStyleSheet *stylesheet)
{
GtkTextIter start, end;
char *text;
@@ -48,16 +48,16 @@ css_text_changed (GtkTextBuffer *buffer,
gtk_text_buffer_remove_all_tags (buffer, &start, &end);
text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
- gtk_css_provider_load_from_data (provider, text, -1);
+ gtk_css_style_sheet_load_from_data (stylesheet, text, -1);
g_free (text);
}
static void
-apply_css (GtkWidget *widget, GtkStyleProvider *provider)
+apply_css (GtkWidget *widget, GtkStyleProvider *stylesheet)
{
- gtk_style_context_add_provider (gtk_widget_get_style_context (widget), provider, G_MAXUINT);
+ gtk_style_context_add_provider (gtk_widget_get_style_context (widget), stylesheet, G_MAXUINT);
if (GTK_IS_CONTAINER (widget))
- gtk_container_forall (GTK_CONTAINER (widget), (GtkCallback) apply_css, provider);
+ gtk_container_forall (GTK_CONTAINER (widget), (GtkCallback) apply_css, stylesheet);
}
GtkWidget *
@@ -68,7 +68,7 @@ do_css_pixbufs (GtkWidget *do_widget)
if (!window)
{
GtkWidget *paned, *container, *child;
- GtkStyleProvider *provider;
+ GtkStyleProvider *stylesheet;
GtkTextBuffer *text;
GBytes *bytes;
@@ -96,25 +96,25 @@ do_css_pixbufs (GtkWidget *do_widget)
"underline", PANGO_UNDERLINE_ERROR,
NULL);
- provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
+ stylesheet = GTK_STYLE_PROVIDER (gtk_css_style_sheet_new ());
container = gtk_scrolled_window_new (NULL, NULL);
gtk_container_add (GTK_CONTAINER (paned), container);
child = gtk_text_view_new_with_buffer (text);
gtk_container_add (GTK_CONTAINER (container), child);
g_signal_connect (text, "changed",
- G_CALLBACK (css_text_changed), provider);
+ G_CALLBACK (css_text_changed), stylesheet);
bytes = g_resources_lookup_data ("/css_pixbufs/gtk.css", 0, NULL);
gtk_text_buffer_set_text (text, g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes));
g_bytes_unref (bytes);
- g_signal_connect (provider,
+ g_signal_connect (stylesheet,
"parsing-error",
G_CALLBACK (show_parsing_error),
gtk_text_view_get_buffer (GTK_TEXT_VIEW (child)));
- apply_css (window, provider);
+ apply_css (window, stylesheet);
}
if (!gtk_widget_get_visible (window))
diff --git a/demos/gtk-demo/css_shadows.c b/demos/gtk-demo/css_shadows.c
index 318141c896..44e1fe9b2c 100644
--- a/demos/gtk-demo/css_shadows.c
+++ b/demos/gtk-demo/css_shadows.c
@@ -6,7 +6,7 @@
#include <gtk/gtk.h>
static void
-show_parsing_error (GtkCssProvider *provider,
+show_parsing_error (GtkCssStyleSheet *stylesheet,
GtkCssSection *section,
const GError *error,
GtkTextBuffer *buffer)
@@ -36,7 +36,7 @@ show_parsing_error (GtkCssProvider *provider,
static void
css_text_changed (GtkTextBuffer *buffer,
- GtkCssProvider *provider)
+ GtkCssStyleSheet *stylesheet)
{
GtkTextIter start, end;
char *text;
@@ -46,16 +46,16 @@ css_text_changed (GtkTextBuffer *buffer,
gtk_text_buffer_remove_all_tags (buffer, &start, &end);
text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
- gtk_css_provider_load_from_data (provider, text, -1);
+ gtk_css_style_sheet_load_from_data (stylesheet, text, -1);
g_free (text);
}
static void
-apply_css (GtkWidget *widget, GtkStyleProvider *provider)
+apply_css (GtkWidget *widget, GtkStyleProvider *stylesheet)
{
- gtk_style_context_add_provider (gtk_widget_get_style_context (widget), provider, G_MAXUINT);
+ gtk_style_context_add_provider (gtk_widget_get_style_context (widget), stylesheet, G_MAXUINT);
if (GTK_IS_CONTAINER (widget))
- gtk_container_forall (GTK_CONTAINER (widget), (GtkCallback) apply_css, provider);
+ gtk_container_forall (GTK_CONTAINER (widget), (GtkCallback) apply_css, stylesheet);
}
GtkWidget *
@@ -90,7 +90,7 @@ do_css_shadows (GtkWidget *do_widget)
if (!window)
{
GtkWidget *paned, *container, *child;
- GtkStyleProvider *provider;
+ GtkStyleProvider *stylesheet;
GtkTextBuffer *text;
GBytes *bytes;
@@ -117,25 +117,25 @@ do_css_shadows (GtkWidget *do_widget)
"underline", PANGO_UNDERLINE_ERROR,
NULL);
- provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
+ stylesheet = GTK_STYLE_PROVIDER (gtk_css_style_sheet_new ());
container = gtk_scrolled_window_new (NULL, NULL);
gtk_container_add (GTK_CONTAINER (paned), container);
child = gtk_text_view_new_with_buffer (text);
gtk_container_add (GTK_CONTAINER (container), child);
g_signal_connect (text, "changed",
- G_CALLBACK (css_text_changed), provider);
+ G_CALLBACK (css_text_changed), stylesheet);
bytes = g_resources_lookup_data ("/css_shadows/gtk.css", 0, NULL);
gtk_text_buffer_set_text (text, g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes));
g_bytes_unref (bytes);
- g_signal_connect (provider,
+ g_signal_connect (stylesheet,
"parsing-error",
G_CALLBACK (show_parsing_error),
gtk_text_view_get_buffer (GTK_TEXT_VIEW (child)));
- apply_css (window, provider);
+ apply_css (window, stylesheet);
}
if (!gtk_widget_get_visible (window))
diff --git a/demos/gtk-demo/demotaggedentry.c b/demos/gtk-demo/demotaggedentry.c
index dcba5a435d..018a6e4f67 100644
--- a/demos/gtk-demo/demotaggedentry.c
+++ b/demos/gtk-demo/demotaggedentry.c
@@ -263,7 +263,7 @@ static void
demo_tagged_entry_tag_init (DemoTaggedEntryTag *tag)
{
GtkGesture *gesture;
- GtkCssProvider *provider;
+ GtkCssStyleSheet *stylesheet;
tag->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_set_parent (tag->box, GTK_WIDGET (tag));
@@ -274,12 +274,12 @@ demo_tagged_entry_tag_init (DemoTaggedEntryTag *tag)
g_signal_connect (gesture, "released", G_CALLBACK (on_released), tag);
gtk_widget_add_controller (GTK_WIDGET (tag), GTK_EVENT_CONTROLLER (gesture));
- provider = gtk_css_provider_new ();
- gtk_css_provider_load_from_resource (provider, "/tagged_entry/tagstyle.css");
+ stylesheet = gtk_css_style_sheet_new ();
+ 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 (provider),
+ GTK_STYLE_PROVIDER (stylesheet),
800);
- g_object_unref (provider);
+ g_object_unref (stylesheet);
}
static void
diff --git a/demos/gtk-demo/dnd.c b/demos/gtk-demo/dnd.c
index c768398be5..f17855e3d5 100644
--- a/demos/gtk-demo/dnd.c
+++ b/demos/gtk-demo/dnd.c
@@ -354,7 +354,7 @@ do_dnd (GtkWidget *do_widget)
{
GtkWidget *vbox, *fixed;
GtkGesture *multipress;
- GtkCssProvider *provider;
+ GtkCssStyleSheet *stylesheet;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window),
@@ -378,10 +378,10 @@ do_dnd (GtkWidget *do_widget)
g_signal_connect (multipress, "released", G_CALLBACK (released_cb), NULL);
gtk_widget_add_controller (fixed, GTK_EVENT_CONTROLLER (multipress));
- provider = gtk_css_provider_new ();
- gtk_css_provider_load_from_resource (provider, "/dnd/dnd.css");
+ stylesheet = gtk_css_style_sheet_new ();
+ 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 (provider),
+ GTK_STYLE_PROVIDER (stylesheet),
800);
}
diff --git a/demos/gtk-demo/fishbowl.c b/demos/gtk-demo/fishbowl.c
index 111d6a199e..ee1ae0aaf8 100644
--- a/demos/gtk-demo/fishbowl.c
+++ b/demos/gtk-demo/fishbowl.c
@@ -271,14 +271,14 @@ GtkWidget *
do_fishbowl (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
- static GtkCssProvider *provider = NULL;
+ static GtkCssStyleSheet *stylesheet = NULL;
- if (provider == NULL)
+ if (stylesheet == NULL)
{
- provider = gtk_css_provider_new ();
- gtk_css_provider_load_from_data (provider, css, -1);
+ 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 (provider),
+ GTK_STYLE_PROVIDER (stylesheet),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
}
diff --git a/demos/gtk-demo/fixed.c b/demos/gtk-demo/fixed.c
index 745b8c7288..d891fddb68 100644
--- a/demos/gtk-demo/fixed.c
+++ b/demos/gtk-demo/fixed.c
@@ -103,7 +103,7 @@ create_faces (void)
}
static GtkWidget *demo_window = NULL;
-static GtkCssProvider *provider = NULL;
+static GtkCssStyleSheet *stylesheet = NULL;
static void
close_window (GtkWidget *widget)
@@ -113,8 +113,8 @@ close_window (GtkWidget *widget)
faces[i].face = NULL;
gtk_style_context_remove_provider_for_display (gdk_display_get_default (),
- GTK_STYLE_PROVIDER (provider));
- provider = NULL;
+ GTK_STYLE_PROVIDER (stylesheet));
+ stylesheet = NULL;
demo_window = NULL;
}
@@ -142,12 +142,12 @@ create_demo_window (GtkWidget *do_widget)
gtk_container_add (GTK_CONTAINER (fixed), cube);
gtk_widget_set_overflow (fixed, GTK_OVERFLOW_VISIBLE);
- provider = gtk_css_provider_new ();
- gtk_css_provider_load_from_resource (provider, "/fixed/fixed.css");
+ stylesheet = gtk_css_style_sheet_new ();
+ 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 (provider),
+ GTK_STYLE_PROVIDER (stylesheet),
800);
- g_object_unref (provider);
+ 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 fd80787ce2..c94f8f3a09 100644
--- a/demos/node-editor/node-editor-application.c
+++ b/demos/node-editor/node-editor-application.c
@@ -68,7 +68,7 @@ node_editor_application_startup (GApplication *app)
{
const char *quit_accels[2] = { "<Ctrl>Q", NULL };
const char *open_accels[2] = { "<Ctrl>O", NULL };
- GtkCssProvider *provider;
+ GtkCssStyleSheet *stylesheet;
G_APPLICATION_CLASS (node_editor_application_parent_class)->startup (app);
@@ -79,10 +79,10 @@ node_editor_application_startup (GApplication *app)
gtk_application_set_accels_for_action (GTK_APPLICATION (app), "win.open", open_accels);
- provider = gtk_css_provider_new ();
- gtk_css_provider_load_from_data (provider, css, -1);
+ 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 (provider),
+ GTK_STYLE_PROVIDER (stylesheet),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
}
diff --git a/demos/widget-factory/widget-factory.c b/demos/widget-factory/widget-factory.c
index bbf10e8a5d..8fd715cb29 100644
--- a/demos/widget-factory/widget-factory.c
+++ b/demos/widget-factory/widget-factory.c
@@ -1653,7 +1653,7 @@ activate (GApplication *app)
GtkWidget *stack;
GtkWidget *dialog;
GtkAdjustment *adj;
- GtkCssProvider *provider;
+ GtkCssStyleSheet *stylesheet;
GMenuModel *model;
static GActionEntry win_entries[] = {
{ "dark", NULL, NULL, "false", change_theme_state },
@@ -1690,12 +1690,12 @@ activate (GApplication *app)
g_type_ensure (my_text_view_get_type ());
- provider = gtk_css_provider_new ();
- gtk_css_provider_load_from_resource (provider, "/org/gtk/WidgetFactory4/widget-factory.css");
+ 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 (provider),
+ GTK_STYLE_PROVIDER (stylesheet),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
- g_object_unref (provider);
+ g_object_unref (stylesheet);
builder = gtk_builder_new ();
scope = gtk_builder_cscope_new ();
diff --git a/docs/reference/gtk/gtk4-docs.xml b/docs/reference/gtk/gtk4-docs.xml
index b2afad8d64..d883a7dfac 100644
--- a/docs/reference/gtk/gtk4-docs.xml
+++ b/docs/reference/gtk/gtk4-docs.xml
@@ -373,7 +373,7 @@
<xi:include href="css-overview.xml" />
<xi:include href="css-properties.xml" />
<xi:include href="xml/gtkstylecontext.xml" />
- <xi:include href="xml/gtkcssprovider.xml" />
+ <xi:include href="xml/gtkcssstylesheet.xml" />
<xi:include href="xml/gtkstyleprovider.xml" />
<xi:include href="xml/gtkicontheme.xml" />
</part>
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index a503d9ce43..dccdf8c84e 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -4863,16 +4863,16 @@ gtk_border_get_type
</SECTION>
<SECTION>
-<FILE>gtkcssprovider</FILE>
-<TITLE>GtkCssProvider</TITLE>
-GtkCssProvider
-gtk_css_provider_load_named
-gtk_css_provider_load_from_data
-gtk_css_provider_load_from_file
-gtk_css_provider_load_from_path
-gtk_css_provider_load_from_resource
-gtk_css_provider_new
-gtk_css_provider_to_string
+<FILE>gtkcssstylesheet</FILE>
+<TITLE>GtkCssStyleSheet</TITLE>
+GtkCssStyleSheet
+gtk_css_style_sheet_load_named
+gtk_css_style_sheet_load_from_data
+gtk_css_style_sheet_load_from_file
+gtk_css_style_sheet_load_from_path
+gtk_css_style_sheet_load_from_resource
+gtk_css_style_sheet_new
+gtk_css_style_sheet_to_string
GTK_CSS_PARSER_ERROR
GtkCssParserError
GtkCssParserWarning
@@ -4889,17 +4889,15 @@ gtk_css_section_get_parent
gtk_css_section_get_start_location
gtk_css_section_get_end_location
<SUBSECTION Standard>
-GTK_TYPE_CSS_PROVIDER
-GTK_CSS_PROVIDER
-GTK_CSS_PROVIDER_CLASS
-GTK_CSS_PROVIDER_GET_CLASS
-GTK_IS_CSS_PROVIDER
-GTK_IS_CSS_PROVIDER_CLASS
+GTK_TYPE_CSS_STYLE_SHEET
+GTK_CSS_STYLE_SHEET
+GTK_CSS_STYLE_SHEET_CLASS
+GTK_CSS_STYLE_SHEET_GET_CLASS
+GTK_IS_CSS_STYLE_SHEET
+GTK_IS_CSS_STYLE_SHEET_CLASS
<SUBSECTION Private>
GTK_TYPE_CSS_SECTION
-GtkCssProviderPrivate
-gtk_css_provider_get_type
-gtk_css_provider_error_quark
+gtk_css_style_sheet_get_type
gtk_css_section_get_type
</SECTION>
diff --git a/docs/reference/gtk/meson.build b/docs/reference/gtk/meson.build
index 0f01d83117..6ecfaf649b 100644
--- a/docs/reference/gtk/meson.build
+++ b/docs/reference/gtk/meson.build
@@ -74,7 +74,7 @@ private_headers = [
'gtkcssparserprivate.h',
'gtkcsspathnodeprivate.h',
'gtkcsspositionvalueprivate.h',
- 'gtkcssproviderprivate.h',
+ 'gtkcssstylesheetprivate.h',
'gtkcssrepeatvalueprivate.h',
'gtkcssrgbavalueprivate.h',
'gtkcsssectionprivate.h',
diff --git a/docs/reference/gtk/text_widget.xml b/docs/reference/gtk/text_widget.xml
index e0efd6ccd8..84cd55bdb6 100644
--- a/docs/reference/gtk/text_widget.xml
+++ b/docs/reference/gtk/text_widget.xml
@@ -170,7 +170,7 @@ foreground color — use CSS to override their default values.
PangoFontDescription *font_desc;
GdkRGBA rgba;
GtkTextTag *tag;
- GtkCssProvider *provider;
+ GtkCssStyleSheet *stylesheet;
GtkStyleContext *context;
view = gtk_text_view_new (<!-- -->);
@@ -180,8 +180,8 @@ foreground color — use CSS to override their default values.
gtk_text_buffer_set_text (buffer, "Hello, this is some text", -1);
/* Change default font and color throughout the widget */
- provider = gtk_css_provider_new ();
- gtk_css_provider_load_from_data (provider,
+ stylesheet = gtk_css_style_sheet_new ();
+ gtk_css_style_sheet_load_from_data (stylesheet,
"textview {"
" font: 15 serif;"
" color: green;"
@@ -189,7 +189,7 @@ foreground color — use CSS to override their default values.
-1);
context = gtk_widget_get_style_context (view);
gtk_style_context_add_provider (context,
- GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER (stylesheet),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
/* Change left margin throughout the widget */
diff --git a/examples/plugman.c b/examples/plugman.c
index 67d7960c5d..9a8032e3d0 100644
--- a/examples/plugman.c
+++ b/examples/plugman.c
@@ -203,7 +203,7 @@ plugin_action (GAction *action,
{
const char *action_name;
const char *css_to_load;
- GtkCssProvider *css_provider;
+ GtkCssStyleSheet *stylesheet;
action_name = g_action_get_name (action);
if (strcmp (action_name, "red") == 0)
@@ -218,10 +218,10 @@ plugin_action (GAction *action,
g_message ("Color: %s", g_action_get_name (action));
- css_provider = gtk_css_provider_new ();
- gtk_css_provider_load_from_data (css_provider, css_to_load, -1);
+ 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 (css_provider),
+ GTK_STYLE_PROVIDER (stylesheet),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
}
diff --git a/gtk/gtk-autocleanups.h b/gtk/gtk-autocleanups.h
index c0a07ffcaf..0359736fac 100644
--- a/gtk/gtk-autocleanups.h
+++ b/gtk/gtk-autocleanups.h
@@ -60,7 +60,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkColorChooserDialog, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkColorChooserWidget, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkComboBox, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkComboBoxText, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkCssProvider, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkCssStyleSheet, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkDrawingArea, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkEditable, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkEntry, g_object_unref)
diff --git a/gtk/gtk.h b/gtk/gtk.h
index 53bf22169b..d2a5df38c1 100644
--- a/gtk/gtk.h
+++ b/gtk/gtk.h
@@ -86,7 +86,7 @@
#include <gtk/gtkconstraintlayout.h>
#include <gtk/gtkconstraint.h>
#include <gtk/gtkcontainer.h>
-#include <gtk/gtkcssprovider.h>
+#include <gtk/gtkcssstylesheet.h>
#include <gtk/gtkcustomlayout.h>
#include <gtk/gtkdebug.h>
#include <gtk/gtkdialog.h>
diff --git a/gtk/gtkcssimagelinear.c b/gtk/gtkcssimagelinear.c
index 845515ee6e..eab619bc89 100644
--- a/gtk/gtkcssimagelinear.c
+++ b/gtk/gtkcssimagelinear.c
@@ -26,7 +26,7 @@
#include "gtkcsscolorvalueprivate.h"
#include "gtkcssnumbervalueprivate.h"
#include "gtkcsscolorvalueprivate.h"
-#include "gtkcssprovider.h"
+#include "gtkcssstylesheet.h"
G_DEFINE_TYPE (GtkCssImageLinear, _gtk_css_image_linear, GTK_TYPE_CSS_IMAGE)
diff --git a/gtk/gtkcssimageradial.c b/gtk/gtkcssimageradial.c
index db4ce8f8ae..e940043124 100644
--- a/gtk/gtkcssimageradial.c
+++ b/gtk/gtkcssimageradial.c
@@ -27,7 +27,7 @@
#include "gtkcssnumbervalueprivate.h"
#include "gtkcsspositionvalueprivate.h"
#include "gtkcsscolorvalueprivate.h"
-#include "gtkcssprovider.h"
+#include "gtkcssstylesheet.h"
G_DEFINE_TYPE (GtkCssImageRadial, _gtk_css_image_radial, GTK_TYPE_CSS_IMAGE)
diff --git a/gtk/gtkcssparserprivate.h b/gtk/gtkcssparserprivate.h
index c2445b3c3b..f06c0654a8 100644
--- a/gtk/gtkcssparserprivate.h
+++ b/gtk/gtkcssparserprivate.h
@@ -18,7 +18,7 @@
#ifndef __GTK_CSS_PARSER_PRIVATE_H__
#define __GTK_CSS_PARSER_PRIVATE_H__
-#include <gtk/gtkcssprovider.h>
+#include <gtk/gtkcssstylesheet.h>
#include <gtk/css/gtkcss.h>
#include "gtk/css/gtkcsstokenizerprivate.h"
diff --git a/gtk/gtkcssselector.c b/gtk/gtkcssselector.c
index 802ae9a395..42552add58 100644
--- a/gtk/gtkcssselector.c
+++ b/gtk/gtkcssselector.c
@@ -22,7 +22,7 @@
#include <stdlib.h>
#include <string.h>
-#include "gtkcssprovider.h"
+#include "gtkcssstylesheet.h"
#include "gtkstylecontextprivate.h"
#include <errno.h>
diff --git a/gtk/gtkcssstaticstyle.c b/gtk/gtkcssstaticstyle.c
index c6d75e182b..2b54205639 100644
--- a/gtk/gtkcssstaticstyle.c
+++ b/gtk/gtkcssstaticstyle.c
@@ -711,14 +711,14 @@ gtk_css_static_style_get_default (void)
if (default_style == NULL)
{
GtkCountingBloomFilter filter = GTK_COUNTING_BLOOM_FILTER_INIT;
- GtkCssProvider *provider;
+ GtkCssStyleSheet *stylesheet;
- provider = gtk_css_provider_new ();
- default_style = gtk_css_static_style_new_compute (GTK_STYLE_PROVIDER (provider),
+ stylesheet = gtk_css_style_sheet_new ();
+ default_style = gtk_css_static_style_new_compute (GTK_STYLE_PROVIDER (stylesheet),
&filter,
NULL,
0);
- g_object_unref (provider);
+ g_object_unref (stylesheet);
}
return default_style;
diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssstylesheet.c
similarity index 75%
rename from gtk/gtkcssprovider.c
rename to gtk/gtkcssstylesheet.c
index e2388de1e1..371508b9d7 100644
--- a/gtk/gtkcssprovider.c
+++ b/gtk/gtkcssstylesheet.c
@@ -1,5 +1,6 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 2010 Carlos Garnacho <carlosg gnome org>
+ * 2020 Benjamin Otte <otte gnome org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -17,7 +18,7 @@
#include "config.h"
-#include "gtkcssproviderprivate.h"
+#include "gtkcssstylesheetprivate.h"
#include "gtkbitmaskprivate.h"
#include "gtkcssarrayvalueprivate.h"
@@ -45,19 +46,19 @@
#include <cairo-gobject.h>
/**
- * SECTION:gtkcssprovider
+ * SECTION:gtkcssstylesheet
* @Short_description: CSS-like styling for widgets
- * @Title: GtkCssProvider
+ * @Title: GtkCssStyleSheet
* @See_also: #GtkStyleContext, #GtkStyleProvider
*
- * GtkCssProvider is an object implementing the #GtkStyleProvider interface.
+ * GtkCssStyleSheet is an object implementing the #GtkStyleProvider interface.
* It is able to parse [CSS-like][css-overview] input in order to style widgets.
*
* An application can make GTK+ parse a specific CSS style sheet by calling
- * gtk_css_provider_load_from_file() or gtk_css_provider_load_from_resource()
+ * 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().
-
+ *
* 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+
* loads the first existing file among
@@ -75,13 +76,13 @@
#define MAX_SELECTOR_LIST_LENGTH 64
-struct _GtkCssProviderClass
+struct _GtkCssStyleSheetClass
{
GObjectClass parent_class;
- void (* parsing_error) (GtkCssProvider *provider,
- GtkCssSection *section,
- const GError * error);
+ void (* parsing_error) (GtkCssStyleSheet *self,
+ GtkCssSection *section,
+ const GError *error);
};
typedef struct GtkCssRuleset GtkCssRuleset;
@@ -107,12 +108,12 @@ struct GtkCssRuleset
struct _GtkCssScanner
{
- GtkCssProvider *provider;
+ GtkCssStyleSheet *stylesheet;
GtkCssParser *parser;
GtkCssScanner *parent;
};
-struct _GtkCssProviderPrivate
+struct _GtkCssStyleSheetPrivate
{
GScanner *scanner;
@@ -132,29 +133,29 @@ enum {
static gboolean gtk_keep_css_sections = FALSE;
-static guint css_provider_signals[LAST_SIGNAL] = { 0 };
+static guint css_style_sheet_signals[LAST_SIGNAL] = { 0 };
-static void gtk_css_provider_finalize (GObject *object);
+static void gtk_css_style_sheet_finalize (GObject *object);
static void gtk_css_style_provider_iface_init (GtkStyleProviderInterface *iface);
static void gtk_css_style_provider_emit_error (GtkStyleProvider *provider,
GtkCssSection *section,
const GError *error);
static void
-gtk_css_provider_load_internal (GtkCssProvider *css_provider,
- GtkCssScanner *scanner,
- GFile *file,
- GBytes *bytes);
+gtk_css_style_sheet_load_internal (GtkCssStyleSheet *self,
+ GtkCssScanner *scanner,
+ GFile *file,
+ GBytes *bytes);
-G_DEFINE_TYPE_EXTENDED (GtkCssProvider, gtk_css_provider, G_TYPE_OBJECT, 0,
- G_ADD_PRIVATE (GtkCssProvider)
+G_DEFINE_TYPE_EXTENDED (GtkCssStyleSheet, gtk_css_style_sheet, G_TYPE_OBJECT, 0,
+ G_ADD_PRIVATE (GtkCssStyleSheet)
G_IMPLEMENT_INTERFACE (GTK_TYPE_STYLE_PROVIDER,
gtk_css_style_provider_iface_init));
static void
-gtk_css_provider_parsing_error (GtkCssProvider *provider,
- GtkCssSection *section,
- const GError *error)
+gtk_css_style_sheet_parsing_error (GtkCssStyleSheet *self,
+ GtkCssSection *section,
+ const GError *error)
{
/* Only emit a warning when we have no error handlers. This is our
* default handlers. And in this case erroneous CSS files are a bug
@@ -162,8 +163,8 @@ gtk_css_provider_parsing_error (GtkCssProvider *provider,
* Note that these warnings can also be triggered by a broken theme
* that people installed from some weird location on the internets.
*/
- if (!g_signal_has_handler_pending (provider,
- css_provider_signals[PARSING_ERROR],
+ if (!g_signal_has_handler_pending (self,
+ css_style_sheet_signals[PARSING_ERROR],
0,
TRUE))
{
@@ -181,22 +182,22 @@ gtk_css_provider_parsing_error (GtkCssProvider *provider,
* It is the callers responsibility to reparse the current theme.
*/
void
-gtk_css_provider_set_keep_css_sections (void)
+gtk_css_style_sheet_set_keep_css_sections (void)
{
gtk_keep_css_sections = TRUE;
}
static void
-gtk_css_provider_class_init (GtkCssProviderClass *klass)
+gtk_css_style_sheet_class_init (GtkCssStyleSheetClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
if (g_getenv ("GTK_CSS_DEBUG"))
- gtk_css_provider_set_keep_css_sections ();
+ gtk_css_style_sheet_set_keep_css_sections ();
/**
- * GtkCssProvider::parsing-error:
- * @provider: the provider that had a parsing error
+ * GtkCssStyleSheet::parsing-error:
+ * @self: the #GtkCssStyleSheet that had a parsing error
* @section: section the error happened in
* @error: The parsing error
*
@@ -208,28 +209,28 @@ gtk_css_provider_class_init (GtkCssProviderClass *klass)
* data or even all of it to not be parsed at all. So it is a useful idea
* to check that the parsing succeeds by connecting to this signal.
*
- * Note that this signal may be emitted at any time as the css provider
+ * Note that this signal may be emitted at any time as the style sheet
* may opt to defer parsing parts or all of the input to a later time
* than when a loading function was called.
*/
- css_provider_signals[PARSING_ERROR] =
+ css_style_sheet_signals[PARSING_ERROR] =
g_signal_new (I_("parsing-error"),
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GtkCssProviderClass, parsing_error),
+ G_STRUCT_OFFSET (GtkCssStyleSheetClass, parsing_error),
NULL, NULL,
_gtk_marshal_VOID__BOXED_BOXED,
G_TYPE_NONE, 2, GTK_TYPE_CSS_SECTION, G_TYPE_ERROR);
- object_class->finalize = gtk_css_provider_finalize;
+ object_class->finalize = gtk_css_style_sheet_finalize;
- klass->parsing_error = gtk_css_provider_parsing_error;
+ klass->parsing_error = gtk_css_style_sheet_parsing_error;
}
static void
-gtk_css_ruleset_init_copy (GtkCssRuleset *new,
- GtkCssRuleset *ruleset,
- GtkCssSelector *selector)
+gtk_css_ruleset_init_copy (GtkCssRuleset *new,
+ GtkCssRuleset *ruleset,
+ GtkCssSelector *selector)
{
memcpy (new, ruleset, sizeof (GtkCssRuleset));
@@ -249,9 +250,9 @@ gtk_css_ruleset_clear (GtkCssRuleset *ruleset)
for (i = 0; i < ruleset->n_styles; i++)
{
_gtk_css_value_unref (ruleset->styles[i].value);
- ruleset->styles[i].value = NULL;
- if (ruleset->styles[i].section)
- gtk_css_section_unref (ruleset->styles[i].section);
+ ruleset->styles[i].value = NULL;
+ if (ruleset->styles[i].section)
+ gtk_css_section_unref (ruleset->styles[i].section);
}
g_free (ruleset->styles);
}
@@ -278,9 +279,9 @@ gtk_css_ruleset_add (GtkCssRuleset *ruleset,
if (ruleset->styles[i].property == property)
{
_gtk_css_value_unref (ruleset->styles[i].value);
- ruleset->styles[i].value = NULL;
- if (ruleset->styles[i].section)
- gtk_css_section_unref (ruleset->styles[i].section);
+ ruleset->styles[i].value = NULL;
+ if (ruleset->styles[i].section)
+ gtk_css_section_unref (ruleset->styles[i].section);
break;
}
}
@@ -302,7 +303,7 @@ gtk_css_ruleset_add (GtkCssRuleset *ruleset,
static void
gtk_css_scanner_destroy (GtkCssScanner *scanner)
{
- g_object_unref (scanner->provider);
+ g_object_unref (scanner->stylesheet);
gtk_css_parser_unref (scanner->parser);
g_slice_free (GtkCssScanner, scanner);
@@ -313,7 +314,7 @@ gtk_css_style_provider_emit_error (GtkStyleProvider *provider,
GtkCssSection *section,
const GError *error)
{
- g_signal_emit (provider, css_provider_signals[PARSING_ERROR], 0, section, error);
+ g_signal_emit (provider, css_style_sheet_signals[PARSING_ERROR], 0, section, error);
}
static void
@@ -330,23 +331,22 @@ gtk_css_scanner_parser_error (GtkCssParser *parser,
start,
end);
- gtk_css_style_provider_emit_error (GTK_STYLE_PROVIDER (scanner->provider), section, error);
+ gtk_css_style_provider_emit_error (GTK_STYLE_PROVIDER (scanner->stylesheet), section, error);
gtk_css_section_unref (section);
}
static GtkCssScanner *
-gtk_css_scanner_new (GtkCssProvider *provider,
- GtkCssScanner *parent,
- GFile *file,
- GBytes *bytes)
+gtk_css_scanner_new (GtkCssStyleSheet *stylesheet,
+ GtkCssScanner *parent,
+ GFile *file,
+ GBytes *bytes)
{
GtkCssScanner *scanner;
scanner = g_slice_new0 (GtkCssScanner);
- g_object_ref (provider);
- scanner->provider = provider;
+ scanner->stylesheet = g_object_ref (stylesheet);
scanner->parent = parent;
scanner->parser = gtk_css_parser_new_for_bytes (bytes,
@@ -376,9 +376,9 @@ gtk_css_scanner_would_recurse (GtkCssScanner *scanner,
}
static void
-gtk_css_provider_init (GtkCssProvider *css_provider)
+gtk_css_style_sheet_init (GtkCssStyleSheet *self)
{
- GtkCssProviderPrivate *priv = gtk_css_provider_get_instance_private (css_provider);
+ GtkCssStyleSheetPrivate *priv = gtk_css_style_sheet_get_instance_private (self);
priv->rulesets = g_array_new (FALSE, FALSE, sizeof (GtkCssRuleset));
@@ -391,12 +391,12 @@ gtk_css_provider_init (GtkCssProvider *css_provider)
}
static void
-verify_tree_match_results (GtkCssProvider *provider,
- GtkCssNode *node,
- GPtrArray *tree_rules)
+verify_tree_match_results (GtkCssStyleSheet *self,
+ GtkCssNode *node,
+ GPtrArray *tree_rules)
{
#ifdef VERIFY_TREE
- GtkCssProviderPrivate *priv = gtk_css_provider_get_instance_private (provider);
+ GtkCssStyleSheetPrivate *priv = gtk_css_style_sheet_get_instance_private (self);
GtkCssRuleset *ruleset;
gboolean should_match;
int i, j;
@@ -408,21 +408,21 @@ verify_tree_match_results (GtkCssProvider *provider,
ruleset = &g_array_index (priv->rulesets, GtkCssRuleset, i);
for (j = 0; j < tree_rules->len; j++)
- {
- if (ruleset == tree_rules->pdata[j])
- {
- found = TRUE;
- break;
- }
- }
+ {
+ if (ruleset == tree_rules->pdata[j])
+ {
+ found = TRUE;
+ break;
+ }
+ }
should_match = gtk_css_selector_matches (ruleset->selector, node);
if (found != !!should_match)
- {
- g_error ("expected rule '%s' to %s, but it %s",
- _gtk_css_selector_to_string (ruleset->selector),
- should_match ? "match" : "not match",
- found ? "matched" : "didn't match");
- }
+ {
+ g_error ("expected rule '%s' to %s, but it %s",
+ _gtk_css_selector_to_string (ruleset->selector),
+ should_match ? "match" : "not match",
+ found ? "matched" : "didn't match");
+ }
}
#endif
}
@@ -431,8 +431,8 @@ static GtkCssValue *
gtk_css_style_provider_get_color (GtkStyleProvider *provider,
const char *name)
{
- GtkCssProvider *css_provider = GTK_CSS_PROVIDER (provider);
- GtkCssProviderPrivate *priv = gtk_css_provider_get_instance_private (css_provider);
+ GtkCssStyleSheet *self = GTK_CSS_STYLE_SHEET (provider);
+ GtkCssStyleSheetPrivate *priv = gtk_css_style_sheet_get_instance_private (self);
return g_hash_table_lookup (priv->symbolic_colors, name);
}
@@ -441,8 +441,8 @@ static GtkCssKeyframes *
gtk_css_style_provider_get_keyframes (GtkStyleProvider *provider,
const char *name)
{
- GtkCssProvider *css_provider = GTK_CSS_PROVIDER (provider);
- GtkCssProviderPrivate *priv = gtk_css_provider_get_instance_private (css_provider);
+ GtkCssStyleSheet *self = GTK_CSS_STYLE_SHEET (provider);
+ GtkCssStyleSheetPrivate *priv = gtk_css_style_sheet_get_instance_private (self);
return g_hash_table_lookup (priv->keyframes, name);
}
@@ -454,8 +454,8 @@ gtk_css_style_provider_lookup (GtkStyleProvider *provider,
GtkCssLookup *lookup,
GtkCssChange *change)
{
- GtkCssProvider *css_provider = GTK_CSS_PROVIDER (provider);
- GtkCssProviderPrivate *priv = gtk_css_provider_get_instance_private (css_provider);
+ GtkCssStyleSheet *self = GTK_CSS_STYLE_SHEET (provider);
+ GtkCssStyleSheetPrivate *priv = gtk_css_style_sheet_get_instance_private (self);
GtkCssRuleset *ruleset;
guint j;
int i;
@@ -467,7 +467,7 @@ gtk_css_style_provider_lookup (GtkStyleProvider *provider,
tree_rules = _gtk_css_selector_tree_match_all (priv->tree, filter, node);
if (tree_rules)
{
- verify_tree_match_results (css_provider, node, tree_rules);
+ verify_tree_match_results (self, node, tree_rules);
for (i = tree_rules->len - 1; i >= 0; i--)
{
@@ -508,10 +508,10 @@ gtk_css_style_provider_iface_init (GtkStyleProviderInterface *iface)
}
static void
-gtk_css_provider_finalize (GObject *object)
+gtk_css_style_sheet_finalize (GObject *object)
{
- GtkCssProvider *css_provider = GTK_CSS_PROVIDER (object);
- GtkCssProviderPrivate *priv = gtk_css_provider_get_instance_private (css_provider);
+ GtkCssStyleSheet *self = GTK_CSS_STYLE_SHEET (object);
+ GtkCssStyleSheetPrivate *priv = gtk_css_style_sheet_get_instance_private (self);
guint i;
for (i = 0; i < priv->rulesets->len; i++)
@@ -532,29 +532,29 @@ gtk_css_provider_finalize (GObject *object)
g_free (priv->path);
- G_OBJECT_CLASS (gtk_css_provider_parent_class)->finalize (object);
+ G_OBJECT_CLASS (gtk_css_style_sheet_parent_class)->finalize (object);
}
/**
- * gtk_css_provider_new:
+ * gtk_css_style_sheet_new:
*
- * Returns a newly created #GtkCssProvider.
+ * Returns a newly created #GtkCssStyleSheet.
*
- * Returns: A new #GtkCssProvider
+ * Returns: A new #GtkCssStyleSheet
**/
-GtkCssProvider *
-gtk_css_provider_new (void)
+GtkCssStyleSheet *
+gtk_css_style_sheet_new (void)
{
- return g_object_new (GTK_TYPE_CSS_PROVIDER, NULL);
+ return g_object_new (GTK_TYPE_CSS_STYLE_SHEET, NULL);
}
static void
-css_provider_commit (GtkCssProvider *css_provider,
- GtkCssSelector **selectors,
- guint n_selectors,
- GtkCssRuleset *ruleset)
+css_style_sheet_commit (GtkCssStyleSheet *self,
+ GtkCssSelector **selectors,
+ guint n_selectors,
+ GtkCssRuleset *ruleset)
{
- GtkCssProviderPrivate *priv = gtk_css_provider_get_instance_private (css_provider);
+ GtkCssStyleSheetPrivate *priv = gtk_css_style_sheet_get_instance_private (self);
guint i;
if (ruleset->styles == NULL)
@@ -574,9 +574,9 @@ css_provider_commit (GtkCssProvider *css_provider,
}
static void
-gtk_css_provider_reset (GtkCssProvider *css_provider)
+gtk_css_style_sheet_reset (GtkCssStyleSheet *self)
{
- GtkCssProviderPrivate *priv = gtk_css_provider_get_instance_private (css_provider);
+ GtkCssStyleSheetPrivate *priv = gtk_css_style_sheet_get_instance_private (self);
guint i;
if (priv->resource)
@@ -651,21 +651,21 @@ parse_import (GtkCssScanner *scanner)
}
else if (gtk_css_scanner_would_recurse (scanner, file))
{
- char *path = g_file_get_path (file);
- gtk_css_parser_error (scanner->parser,
- GTK_CSS_PARSER_ERROR_IMPORT,
- gtk_css_parser_get_block_location (scanner->parser),
- gtk_css_parser_get_end_location (scanner->parser),
- "Loading '%s' would recurse",
- path);
- g_free (path);
+ char *path = g_file_get_path (file);
+ gtk_css_parser_error (scanner->parser,
+ GTK_CSS_PARSER_ERROR_IMPORT,
+ gtk_css_parser_get_block_location (scanner->parser),
+ gtk_css_parser_get_end_location (scanner->parser),
+ "Loading '%s' would recurse",
+ path);
+ g_free (path);
}
else
{
- gtk_css_provider_load_internal (scanner->provider,
- scanner,
- file,
- NULL);
+ gtk_css_style_sheet_load_internal (scanner->stylesheet,
+ scanner,
+ file,
+ NULL);
}
g_clear_object (&file);
@@ -676,7 +676,7 @@ parse_import (GtkCssScanner *scanner)
static gboolean
parse_color_definition (GtkCssScanner *scanner)
{
- GtkCssProviderPrivate *priv = gtk_css_provider_get_instance_private (scanner->provider);
+ GtkCssStyleSheetPrivate *priv = gtk_css_style_sheet_get_instance_private (scanner->stylesheet);
GtkCssValue *color;
char *name;
@@ -711,7 +711,7 @@ parse_color_definition (GtkCssScanner *scanner)
static gboolean
parse_keyframes (GtkCssScanner *scanner)
{
- GtkCssProviderPrivate *priv = gtk_css_provider_get_instance_private (scanner->provider);
+ GtkCssStyleSheetPrivate *priv = gtk_css_style_sheet_get_instance_private (scanner->stylesheet);
GtkCssKeyframes *keyframes;
char *name;
@@ -857,15 +857,14 @@ parse_declaration (GtkCssScanner *scanner,
{
GtkCssStyleProperty *child = _gtk_css_shorthand_property_get_subproperty (shorthand, i);
GtkCssValue *sub = _gtk_css_array_value_get_nth (value, i);
-
+
gtk_css_ruleset_add (ruleset, child, _gtk_css_value_ref (sub), section);
}
-
- _gtk_css_value_unref (value);
+
+ _gtk_css_value_unref (value);
}
else if (GTK_IS_CSS_STYLE_PROPERTY (property))
{
-
gtk_css_ruleset_add (ruleset, GTK_CSS_STYLE_PROPERTY (property), value, section);
}
else
@@ -928,7 +927,7 @@ parse_ruleset (GtkCssScanner *scanner)
gtk_css_parser_end_block (scanner->parser);
- css_provider_commit (scanner->provider, selectors, n_selectors, &ruleset);
+ css_style_sheet_commit (scanner->stylesheet, selectors, n_selectors, &ruleset);
gtk_css_ruleset_clear (&ruleset);
}
@@ -958,8 +957,8 @@ parse_stylesheet (GtkCssScanner *scanner)
}
static int
-gtk_css_provider_compare_rule (gconstpointer a_,
- gconstpointer b_)
+gtk_css_style_sheet_compare_rule (gconstpointer a_,
+ gconstpointer b_)
{
const GtkCssRuleset *a = (const GtkCssRuleset *) a_;
const GtkCssRuleset *b = (const GtkCssRuleset *) b_;
@@ -973,14 +972,14 @@ gtk_css_provider_compare_rule (gconstpointer a_,
}
static void
-gtk_css_provider_postprocess (GtkCssProvider *css_provider)
+gtk_css_style_sheet_postprocess (GtkCssStyleSheet *self)
{
- GtkCssProviderPrivate *priv = gtk_css_provider_get_instance_private (css_provider);
+ GtkCssStyleSheetPrivate *priv = gtk_css_style_sheet_get_instance_private (self);
GtkCssSelectorTreeBuilder *builder;
guint i;
gint64 before = g_get_monotonic_time ();
- g_array_sort (priv->rulesets, gtk_css_provider_compare_rule);
+ g_array_sort (priv->rulesets, gtk_css_style_sheet_compare_rule);
builder = _gtk_css_selector_tree_builder_new ();
for (i = 0; i < priv->rulesets->len; i++)
@@ -990,9 +989,9 @@ gtk_css_provider_postprocess (GtkCssProvider *css_provider)
ruleset = &g_array_index (priv->rulesets, GtkCssRuleset, i);
_gtk_css_selector_tree_builder_add (builder,
- ruleset->selector,
- &ruleset->selector_match,
- ruleset);
+ ruleset->selector,
+ &ruleset->selector_match,
+ ruleset);
}
priv->tree = _gtk_css_selector_tree_builder_build (builder);
@@ -1015,10 +1014,10 @@ gtk_css_provider_postprocess (GtkCssProvider *css_provider)
}
static void
-gtk_css_provider_load_internal (GtkCssProvider *self,
- GtkCssScanner *parent,
- GFile *file,
- GBytes *bytes)
+gtk_css_style_sheet_load_internal (GtkCssStyleSheet *self,
+ GtkCssScanner *parent,
+ GFile *file,
+ GBytes *bytes)
{
gint64 before = g_get_monotonic_time ();
@@ -1064,7 +1063,7 @@ gtk_css_provider_load_internal (GtkCssProvider *self,
gtk_css_scanner_destroy (scanner);
if (parent == NULL)
- gtk_css_provider_postprocess (self);
+ gtk_css_style_sheet_postprocess (self);
g_bytes_unref (bytes);
}
@@ -1078,24 +1077,24 @@ gtk_css_provider_load_internal (GtkCssProvider *self,
}
/**
- * gtk_css_provider_load_from_data:
- * @css_provider: a #GtkCssProvider
+ * gtk_css_style_sheet_load_from_data:
+ * @self: a #GtkCssStyleSheet
* @data: (array length=length) (element-type guint8): CSS data loaded in memory
* @length: the length of @data in bytes, or -1 for NUL terminated strings. If
* @length is not -1, the code will assume it is not NUL terminated and will
* potentially do a copy.
*
- * Loads @data into @css_provider, and by doing so clears any previously loaded
+ * Loads @data into @self, and by doing so clears any previously loaded
* information.
**/
void
-gtk_css_provider_load_from_data (GtkCssProvider *css_provider,
- const gchar *data,
- gssize length)
+gtk_css_style_sheet_load_from_data (GtkCssStyleSheet *self,
+ const gchar *data,
+ gssize length)
{
GBytes *bytes;
- g_return_if_fail (GTK_IS_CSS_PROVIDER (css_provider));
+ g_return_if_fail (GTK_IS_CSS_STYLE_SHEET (self));
g_return_if_fail (data != NULL);
if (length < 0)
@@ -1103,97 +1102,97 @@ gtk_css_provider_load_from_data (GtkCssProvider *css_provider,
bytes = g_bytes_new_static (data, length);
- gtk_css_provider_reset (css_provider);
+ gtk_css_style_sheet_reset (self);
g_bytes_ref (bytes);
- gtk_css_provider_load_internal (css_provider, NULL, NULL, bytes);
+ gtk_css_style_sheet_load_internal (self, NULL, NULL, bytes);
g_bytes_unref (bytes);
- gtk_style_provider_changed (GTK_STYLE_PROVIDER (css_provider));
+ gtk_style_provider_changed (GTK_STYLE_PROVIDER (self));
}
/**
- * gtk_css_provider_load_from_file:
- * @css_provider: a #GtkCssProvider
+ * gtk_css_style_sheet_load_from_file:
+ * @self: a #GtkCssStyleSheet
* @file: #GFile pointing to a file to load
*
- * Loads the data contained in @file into @css_provider, making it
+ * Loads the data contained in @file into @self, making it
* clear any previously loaded information.
**/
void
-gtk_css_provider_load_from_file (GtkCssProvider *css_provider,
- GFile *file)
+gtk_css_style_sheet_load_from_file (GtkCssStyleSheet *self,
+ GFile *file)
{
- g_return_if_fail (GTK_IS_CSS_PROVIDER (css_provider));
+ g_return_if_fail (GTK_IS_CSS_STYLE_SHEET (self));
g_return_if_fail (G_IS_FILE (file));
- gtk_css_provider_reset (css_provider);
+ gtk_css_style_sheet_reset (self);
- gtk_css_provider_load_internal (css_provider, NULL, file, NULL);
+ gtk_css_style_sheet_load_internal (self, NULL, file, NULL);
- gtk_style_provider_changed (GTK_STYLE_PROVIDER (css_provider));
+ gtk_style_provider_changed (GTK_STYLE_PROVIDER (self));
}
/**
- * gtk_css_provider_load_from_path:
- * @css_provider: a #GtkCssProvider
+ * gtk_css_style_sheet_load_from_path:
+ * @self: a #GtkCssStyleSheet
* @path: the path of a filename to load, in the GLib filename encoding
*
- * Loads the data contained in @path into @css_provider, making it clear
+ * Loads the data contained in @path into @self, making it clear
* any previously loaded information.
**/
void
-gtk_css_provider_load_from_path (GtkCssProvider *css_provider,
- const gchar *path)
+gtk_css_style_sheet_load_from_path (GtkCssStyleSheet *self,
+ const gchar *path)
{
GFile *file;
- g_return_if_fail (GTK_IS_CSS_PROVIDER (css_provider));
+ g_return_if_fail (GTK_IS_CSS_STYLE_SHEET (self));
g_return_if_fail (path != NULL);
file = g_file_new_for_path (path);
- gtk_css_provider_load_from_file (css_provider, file);
+ gtk_css_style_sheet_load_from_file (self, file);
g_object_unref (file);
}
/**
- * gtk_css_provider_load_from_resource:
- * @css_provider: a #GtkCssProvider
+ * gtk_css_style_sheet_load_from_resource:
+ * @self: a #GtkCssStyleSheet
* @resource_path: a #GResource resource path
*
* Loads the data contained in the resource at @resource_path into
- * the #GtkCssProvider, clearing any previously loaded information.
+ * the #GtkCssStyleSheet, clearing any previously loaded information.
*
* To track errors while loading CSS, connect to the
- * #GtkCssProvider::parsing-error signal.
+ * #GtkCssStyleSheet::parsing-error signal.
*/
void
-gtk_css_provider_load_from_resource (GtkCssProvider *css_provider,
- const gchar *resource_path)
+gtk_css_style_sheet_load_from_resource (GtkCssStyleSheet *self,
+ const gchar *resource_path)
{
GFile *file;
gchar *uri, *escaped;
- g_return_if_fail (GTK_IS_CSS_PROVIDER (css_provider));
+ g_return_if_fail (GTK_IS_CSS_STYLE_SHEET (self));
g_return_if_fail (resource_path != NULL);
escaped = g_uri_escape_string (resource_path,
- G_URI_RESERVED_CHARS_ALLOWED_IN_PATH, FALSE);
+ G_URI_RESERVED_CHARS_ALLOWED_IN_PATH, FALSE);
uri = g_strconcat ("resource://", escaped, NULL);
g_free (escaped);
file = g_file_new_for_uri (uri);
g_free (uri);
- gtk_css_provider_load_from_file (css_provider, file);
+ gtk_css_style_sheet_load_from_file (self, file);
g_object_unref (file);
}
gchar *
-_gtk_get_theme_dir (void)
+gtk_get_theme_dir (void)
{
const gchar *var;
@@ -1203,13 +1202,13 @@ _gtk_get_theme_dir (void)
return g_build_filename (var, "share", "themes", NULL);
}
-/* Return the path that this providers gtk.css was loaded from,
+/* Return the path that this style sheet's gtk.css was loaded from,
* if it is part of a theme, otherwise NULL.
*/
const gchar *
-_gtk_css_provider_get_theme_dir (GtkCssProvider *provider)
+gtk_css_style_sheet_get_theme_dir (GtkCssStyleSheet *self)
{
- GtkCssProviderPrivate *priv = gtk_css_provider_get_instance_private (provider);
+ GtkCssStyleSheetPrivate *priv = gtk_css_style_sheet_get_instance_private (self);
return priv->path;
}
@@ -1229,10 +1228,10 @@ _gtk_css_provider_get_theme_dir (GtkCssProvider *provider)
* and return the first found file.
*/
static gchar *
-_gtk_css_find_theme_dir (const gchar *dir,
- const gchar *subdir,
- const gchar *name,
- const gchar *variant)
+gtk_css_find_theme_dir (const gchar *dir,
+ const gchar *subdir,
+ const gchar *name,
+ const gchar *variant)
{
gchar *file;
gchar *base;
@@ -1281,12 +1280,12 @@ _gtk_css_find_theme (const gchar *name,
char *dir;
/* First look in the user's data directory */
- path = _gtk_css_find_theme_dir (g_get_user_data_dir (), "themes", name, variant);
+ path = gtk_css_find_theme_dir (g_get_user_data_dir (), "themes", name, variant);
if (path)
return path;
/* Next look in the user's home directory */
- path = _gtk_css_find_theme_dir (g_get_home_dir (), ".themes", name, variant);
+ path = gtk_css_find_theme_dir (g_get_home_dir (), ".themes", name, variant);
if (path)
return path;
@@ -1294,22 +1293,22 @@ _gtk_css_find_theme (const gchar *name,
dirs = g_get_system_data_dirs ();
for (i = 0; dirs[i]; i++)
{
- path = _gtk_css_find_theme_dir (dirs[i], "themes", name, variant);
+ path = gtk_css_find_theme_dir (dirs[i], "themes", name, variant);
if (path)
return path;
}
/* Finally, try in the default theme directory */
- dir = _gtk_get_theme_dir ();
- path = _gtk_css_find_theme_dir (dir, NULL, name, variant);
+ dir = gtk_get_theme_dir ();
+ path = gtk_css_find_theme_dir (dir, NULL, name, variant);
g_free (dir);
return path;
}
/**
- * gtk_css_provider_load_named:
- * @provider: a #GtkCssProvider
+ * gtk_css_style_sheet_load_named:
+ * @self: a #GtkCssStyleSheet
* @name: A theme name
* @variant: (allow-none): variant to load, for example, "dark", or
* %NULL for the default
@@ -1320,17 +1319,17 @@ _gtk_css_find_theme (const gchar *name,
* theme that GTK uses for loading its own theme.
**/
void
-gtk_css_provider_load_named (GtkCssProvider *provider,
- const gchar *name,
- const gchar *variant)
+gtk_css_style_sheet_load_named (GtkCssStyleSheet *self,
+ const gchar *name,
+ const gchar *variant)
{
gchar *path;
gchar *resource_path;
- g_return_if_fail (GTK_IS_CSS_PROVIDER (provider));
+ g_return_if_fail (GTK_IS_CSS_STYLE_SHEET (self));
g_return_if_fail (name != NULL);
- gtk_css_provider_reset (provider);
+ gtk_css_style_sheet_reset (self);
/* try loading the resource for the theme. This is mostly meant for built-in
* themes.
@@ -1342,7 +1341,7 @@ gtk_css_provider_load_named (GtkCssProvider *provider,
if (g_resources_get_info (resource_path, 0, NULL, NULL, NULL))
{
- gtk_css_provider_load_from_resource (provider, resource_path);
+ gtk_css_style_sheet_load_from_resource (self, resource_path);
g_free (resource_path);
return;
}
@@ -1352,7 +1351,7 @@ gtk_css_provider_load_named (GtkCssProvider *provider,
path = _gtk_css_find_theme (name, variant);
if (path)
{
- GtkCssProviderPrivate *priv = gtk_css_provider_get_instance_private (provider);
+ GtkCssStyleSheetPrivate *priv = gtk_css_style_sheet_get_instance_private (self);
char *dir, *resource_file;
GResource *resource;
@@ -1364,7 +1363,7 @@ gtk_css_provider_load_named (GtkCssProvider *provider,
if (resource != NULL)
g_resources_register (resource);
- gtk_css_provider_load_from_path (provider, path);
+ gtk_css_style_sheet_load_from_path (self, path);
/* Only set this after load, as load_from_path will clear it */
priv->resource = resource;
@@ -1379,19 +1378,21 @@ gtk_css_provider_load_named (GtkCssProvider *provider,
if (variant)
{
/* If there was a variant, try without */
- gtk_css_provider_load_named (provider, name, NULL);
+ gtk_css_style_sheet_load_named (self, name, NULL);
}
else
{
/* Worst case, fall back to the default */
g_return_if_fail (!g_str_equal (name, DEFAULT_THEME_NAME)); /* infloop protection */
- gtk_css_provider_load_named (provider, DEFAULT_THEME_NAME, NULL);
+ gtk_css_style_sheet_load_named (self, DEFAULT_THEME_NAME, NULL);
}
}
}
static int
-compare_properties (gconstpointer a, gconstpointer b, gpointer style)
+compare_properties (gconstpointer a,
+ gconstpointer b,
+ gpointer style)
{
const guint *ua = a;
const guint *ub = b;
@@ -1438,8 +1439,8 @@ gtk_css_ruleset_print (const GtkCssRuleset *ruleset,
}
static void
-gtk_css_provider_print_colors (GHashTable *colors,
- GString *str)
+gtk_css_style_sheet_print_colors (GHashTable *colors,
+ GString *str)
{
GList *keys, *walk;
@@ -1463,8 +1464,8 @@ gtk_css_provider_print_colors (GHashTable *colors,
}
static void
-gtk_css_provider_print_keyframes (GHashTable *keyframes,
- GString *str)
+gtk_css_style_sheet_print_keyframes (GHashTable *keyframes,
+ GString *str)
{
GList *keys, *walk;
@@ -1490,32 +1491,32 @@ gtk_css_provider_print_keyframes (GHashTable *keyframes,
}
/**
- * gtk_css_provider_to_string:
- * @provider: the provider to write to a string
+ * gtk_css_style_sheet_to_string:
+ * @self: the #GtkCssStyleSheet to write to a string
*
- * Converts the @provider into a string representation in CSS
+ * Converts the @self into a string representation in CSS
* format.
*
- * Using gtk_css_provider_load_from_data() with the return value
- * from this function on a new provider created with
- * gtk_css_provider_new() will basically create a duplicate of
- * this @provider.
+ * Using gtk_css_style_sheet_load_from_data() with the return value
+ * from this function on a new style sheet created with
+ * gtk_css_style_sheet_new() will basically create a duplicate of
+ * @self.
*
- * Returns: a new string representing the @provider.
+ * Returns: a new string representing the style sheet.
**/
char *
-gtk_css_provider_to_string (GtkCssProvider *provider)
+gtk_css_style_sheet_to_string (GtkCssStyleSheet *self)
{
- GtkCssProviderPrivate *priv = gtk_css_provider_get_instance_private (provider);
+ GtkCssStyleSheetPrivate *priv = gtk_css_style_sheet_get_instance_private (self);
GString *str;
guint i;
- g_return_val_if_fail (GTK_IS_CSS_PROVIDER (provider), NULL);
+ g_return_val_if_fail (GTK_IS_CSS_STYLE_SHEET (self), NULL);
str = g_string_new ("");
- gtk_css_provider_print_colors (priv->symbolic_colors, str);
- gtk_css_provider_print_keyframes (priv->keyframes, str);
+ gtk_css_style_sheet_print_colors (priv->symbolic_colors, str);
+ gtk_css_style_sheet_print_keyframes (priv->keyframes, str);
for (i = 0; i < priv->rulesets->len; i++)
{
diff --git a/gtk/gtkcssprovider.h b/gtk/gtkcssstylesheet.h
similarity index 55%
rename from gtk/gtkcssprovider.h
rename to gtk/gtkcssstylesheet.h
index 01d26bf326..e1bdb7c034 100644
--- a/gtk/gtkcssprovider.h
+++ b/gtk/gtkcssstylesheet.h
@@ -1,5 +1,6 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 2010 Carlos Garnacho <carlosg gnome org>
+ * 2020 Benjamin Otte <otte gnome org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -15,57 +16,57 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __GTK_CSS_PROVIDER_H__
-#define __GTK_CSS_PROVIDER_H__
+#ifndef __GTK_CSS_STYLE_SHEET_H__
+#define __GTK_CSS_STYLE_SHEET_H__
#include <gio/gio.h>
#include <gtk/css/gtkcss.h>
G_BEGIN_DECLS
-#define GTK_TYPE_CSS_PROVIDER (gtk_css_provider_get_type ())
-#define GTK_CSS_PROVIDER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_CSS_PROVIDER,
GtkCssProvider))
-#define GTK_IS_CSS_PROVIDER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_CSS_PROVIDER))
+#define GTK_TYPE_CSS_STYLE_SHEET (gtk_css_style_sheet_get_type ())
+#define GTK_CSS_STYLE_SHEET(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_CSS_STYLE_SHEET,
GtkCssStyleSheet))
+#define GTK_IS_CSS_STYLE_SHEET(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_CSS_STYLE_SHEET))
-typedef struct _GtkCssProvider GtkCssProvider;
-typedef struct _GtkCssProviderClass GtkCssProviderClass;
-typedef struct _GtkCssProviderPrivate GtkCssProviderPrivate;
+typedef struct _GtkCssStyleSheet GtkCssStyleSheet;
+typedef struct _GtkCssStyleSheetClass GtkCssStyleSheetClass;
+typedef struct _GtkCssStyleSheetPrivate GtkCssStyleSheetPrivate;
-struct _GtkCssProvider
+struct _GtkCssStyleSheet
{
GObject parent_instance;
};
GDK_AVAILABLE_IN_ALL
-GType gtk_css_provider_get_type (void) G_GNUC_CONST;
+GType gtk_css_style_sheet_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
-GtkCssProvider * gtk_css_provider_new (void);
+GtkCssStyleSheet * gtk_css_style_sheet_new (void);
GDK_AVAILABLE_IN_ALL
-char * gtk_css_provider_to_string (GtkCssProvider *provider);
+char * gtk_css_style_sheet_to_string (GtkCssStyleSheet *provider);
GDK_AVAILABLE_IN_ALL
-void gtk_css_provider_load_from_data (GtkCssProvider *css_provider,
+void gtk_css_style_sheet_load_from_data (GtkCssStyleSheet *css_style_sheet,
const gchar *data,
gssize length);
GDK_AVAILABLE_IN_ALL
-void gtk_css_provider_load_from_file (GtkCssProvider *css_provider,
+void gtk_css_style_sheet_load_from_file (GtkCssStyleSheet *css_style_sheet,
GFile *file);
GDK_AVAILABLE_IN_ALL
-void gtk_css_provider_load_from_path (GtkCssProvider *css_provider,
+void gtk_css_style_sheet_load_from_path (GtkCssStyleSheet *css_style_sheet,
const gchar *path);
GDK_AVAILABLE_IN_ALL
-void gtk_css_provider_load_from_resource (GtkCssProvider *css_provider,
+void gtk_css_style_sheet_load_from_resource (GtkCssStyleSheet *css_style_sheet,
const gchar *resource_path);
GDK_AVAILABLE_IN_ALL
-void gtk_css_provider_load_named (GtkCssProvider *provider,
+void gtk_css_style_sheet_load_named (GtkCssStyleSheet *provider,
const char *name,
const char *variant);
G_END_DECLS
-#endif /* __GTK_CSS_PROVIDER_H__ */
+#endif /* __GTK_CSS_STYLE_SHEET_H__ */
diff --git a/gtk/gtkcssproviderprivate.h b/gtk/gtkcssstylesheetprivate.h
similarity index 61%
rename from gtk/gtkcssproviderprivate.h
rename to gtk/gtkcssstylesheetprivate.h
index e345d00120..ba9cf83653 100644
--- a/gtk/gtkcssproviderprivate.h
+++ b/gtk/gtkcssstylesheetprivate.h
@@ -1,5 +1,6 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 2011 Red Hat, Inc.
+ * 2020 Benjamin Otte <otte gnome org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -15,19 +16,20 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __GTK_CSS_PROVIDER_PRIVATE_H__
-#define __GTK_CSS_PROVIDER_PRIVATE_H__
+#ifndef __GTK_CSS_STYLE_SHEET_PRIVATE_H__
+#define __GTK_CSS_STYLE_SHEET_PRIVATE_H__
-#include "gtkcssprovider.h"
+#include "gtkcssstylesheet.h"
G_BEGIN_DECLS
-gchar *_gtk_get_theme_dir (void);
+gchar * gtk_get_theme_dir (void);
-const gchar *_gtk_css_provider_get_theme_dir (GtkCssProvider *provider);
-void gtk_css_provider_set_keep_css_sections (void);
+const gchar * gtk_css_style_sheet_get_theme_dir (GtkCssStyleSheet *self);
+
+void gtk_css_style_sheet_set_keep_css_sections (void);
G_END_DECLS
-#endif /* __GTK_CSS_PROVIDER_PRIVATE_H__ */
+#endif /* __GTK_CSS_STYLE_SHEET_PRIVATE_H__ */
diff --git a/gtk/gtkemojichooser.c b/gtk/gtkemojichooser.c
index 8d1695a3e1..27f4387be1 100644
--- a/gtk/gtkemojichooser.c
+++ b/gtk/gtkemojichooser.c
@@ -22,7 +22,7 @@
#include "gtkadjustmentprivate.h"
#include "gtkbox.h"
#include "gtkbutton.h"
-#include "gtkcssprovider.h"
+#include "gtkcssstylesheet.h"
#include "gtkentry.h"
#include "gtkflowbox.h"
#include "gtkstack.h"
diff --git a/gtk/gtkemojicompletion.c b/gtk/gtkemojicompletion.c
index 41e37ff221..5c4d52f6a6 100644
--- a/gtk/gtkemojicompletion.c
+++ b/gtk/gtkemojicompletion.c
@@ -22,7 +22,7 @@
#include "gtktextprivate.h"
#include "gtkeditable.h"
#include "gtkbox.h"
-#include "gtkcssprovider.h"
+#include "gtkcssstylesheet.h"
#include "gtklistbox.h"
#include "gtklabel.h"
#include "gtkpopover.h"
diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c
index 09f6cbf811..446862202a 100644
--- a/gtk/gtksettings.c
+++ b/gtk/gtksettings.c
@@ -20,7 +20,7 @@
#include "gtksettingsprivate.h"
-#include "gtkcssproviderprivate.h"
+#include "gtkcssstylesheetprivate.h"
#include "gtkhslaprivate.h"
#include "gtkintl.h"
#include "gtkprivate.h"
@@ -124,7 +124,7 @@ struct _GtkSettingsPrivate
GtkSettingsPropertyValue *property_values;
GdkDisplay *display;
GtkStyleCascade *style_cascade;
- GtkCssProvider *theme_provider;
+ GtkCssStyleSheet *theme_provider;
gint font_size;
gboolean font_size_absolute;
gchar *font_family;
@@ -225,8 +225,8 @@ static void gtk_settings_load_from_key_file (GtkSettings *setting
const gchar *path,
GtkSettingsSource source);
static void settings_update_provider (GdkDisplay *display,
- GtkCssProvider **old,
- GtkCssProvider *new);
+ GtkCssStyleSheet **old,
+ GtkCssStyleSheet *new);
/* --- variables --- */
static GQuark quark_gtk_settings = 0;
@@ -254,7 +254,7 @@ 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_provider_new ();
+ priv->theme_provider = gtk_css_style_sheet_new ();
/* build up property array for all yet existing properties and queue
* notification for them (at least notification for internal properties
@@ -1000,14 +1000,14 @@ static void
settings_init_style (GtkSettings *settings)
{
GtkSettingsPrivate *priv = gtk_settings_get_instance_private (settings);
- static GtkCssProvider *css_provider = NULL;
+ static GtkCssStyleSheet *css_style_sheet = NULL;
- /* Add provider for user file */
- if (G_UNLIKELY (!css_provider))
+ /* Add stylesheet for user file */
+ if (G_UNLIKELY (!css_style_sheet))
{
gchar *css_path;
- css_provider = gtk_css_provider_new ();
+ css_style_sheet = gtk_css_style_sheet_new ();
css_path = g_build_filename (g_get_user_config_dir (),
"gtk-4.0",
"gtk.css",
@@ -1015,7 +1015,7 @@ settings_init_style (GtkSettings *settings)
if (g_file_test (css_path,
G_FILE_TEST_IS_REGULAR))
- gtk_css_provider_load_from_path (css_provider, css_path);
+ gtk_css_style_sheet_load_from_path (css_style_sheet, css_path);
g_free (css_path);
}
@@ -1023,7 +1023,7 @@ settings_init_style (GtkSettings *settings)
priv->style_cascade = _gtk_style_cascade_new ();
_gtk_style_cascade_add_provider (priv->style_cascade,
- GTK_STYLE_PROVIDER (css_provider),
+ GTK_STYLE_PROVIDER (css_style_sheet),
GTK_STYLE_PROVIDER_PRIORITY_USER);
_gtk_style_cascade_add_provider (priv->style_cascade,
@@ -1608,8 +1608,8 @@ settings_update_fontconfig (GtkSettings *settings)
static void
settings_update_provider (GdkDisplay *display,
- GtkCssProvider **old,
- GtkCssProvider *new)
+ GtkCssStyleSheet **old,
+ GtkCssStyleSheet *new)
{
if (display != NULL && *old != new)
{
@@ -1685,12 +1685,12 @@ settings_update_theme (GtkSettings *settings)
get_theme_name (settings, &theme_name, &theme_variant);
- gtk_css_provider_load_named (priv->theme_provider,
+ gtk_css_style_sheet_load_named (priv->theme_provider,
theme_name,
theme_variant);
/* reload per-theme settings */
- theme_dir = _gtk_css_provider_get_theme_dir (priv->theme_provider);
+ theme_dir = gtk_css_style_sheet_get_theme_dir (priv->theme_provider);
if (theme_dir)
{
path = g_build_filename (theme_dir, "settings.ini", NULL);
diff --git a/gtk/gtkstyleproperty.c b/gtk/gtkstyleproperty.c
index 7f4785252a..8798d855ec 100644
--- a/gtk/gtkstyleproperty.c
+++ b/gtk/gtkstyleproperty.c
@@ -19,7 +19,7 @@
#include "gtkstylepropertyprivate.h"
-#include "gtkcssprovider.h"
+#include "gtkcssstylesheet.h"
#include "gtkcssparserprivate.h"
#include "gtkcssshorthandpropertyprivate.h"
#include "gtkcssstylepropertyprivate.h"
diff --git a/gtk/inspector/css-editor.c b/gtk/inspector/css-editor.c
index 4cb20632d7..fe26e00b85 100644
--- a/gtk/inspector/css-editor.c
+++ b/gtk/inspector/css-editor.c
@@ -26,7 +26,7 @@
#include "window.h"
#include "css-editor.h"
-#include "gtkcssprovider.h"
+#include "gtkcssstylesheet.h"
#include "gtkstyleprovider.h"
#include "gtkstylecontext.h"
#include "gtktextview.h"
@@ -44,7 +44,7 @@ struct _GtkInspectorCssEditorPrivate
GtkWidget *view;
GtkTextBuffer *text;
GdkDisplay *display;
- GtkCssProvider *provider;
+ GtkCssStyleSheet *stylesheet;
GtkToggleButton *disable_button;
guint timeout;
GList *errors;
@@ -164,10 +164,10 @@ disable_toggled (GtkToggleButton *button,
if (gtk_toggle_button_get_active (button))
gtk_style_context_remove_provider_for_display (ce->priv->display,
- GTK_STYLE_PROVIDER (ce->priv->provider));
+ GTK_STYLE_PROVIDER (ce->priv->stylesheet));
else
gtk_style_context_add_provider_for_display (ce->priv->display,
- GTK_STYLE_PROVIDER (ce->priv->provider),
+ GTK_STYLE_PROVIDER (ce->priv->stylesheet),
GTK_STYLE_PROVIDER_PRIORITY_USER);
}
@@ -259,7 +259,7 @@ update_style (GtkInspectorCssEditor *ce)
ce->priv->errors = NULL;
text = get_current_text (ce->priv->text);
- gtk_css_provider_load_from_data (ce->priv->provider, text, -1);
+ gtk_css_style_sheet_load_from_data (ce->priv->stylesheet, text, -1);
g_free (text);
}
@@ -290,7 +290,7 @@ text_changed (GtkTextBuffer *buffer,
}
static void
-show_parsing_error (GtkCssProvider *provider,
+show_parsing_error (GtkCssStyleSheet *stylesheet,
GtkCssSection *section,
const GError *error,
GtkInspectorCssEditor *ce)
@@ -330,8 +330,8 @@ show_parsing_error (GtkCssProvider *provider,
static void
create_provider (GtkInspectorCssEditor *ce)
{
- ce->priv->provider = gtk_css_provider_new ();
- g_signal_connect (ce->priv->provider, "parsing-error",
+ ce->priv->stylesheet = gtk_css_style_sheet_new ();
+ g_signal_connect (ce->priv->stylesheet, "parsing-error",
G_CALLBACK (show_parsing_error), ce);
}
@@ -339,8 +339,8 @@ create_provider (GtkInspectorCssEditor *ce)
static void
destroy_provider (GtkInspectorCssEditor *ce)
{
- g_signal_handlers_disconnect_by_func (ce->priv->provider, show_parsing_error, ce);
- g_clear_object (&ce->priv->provider);
+ g_signal_handlers_disconnect_by_func (ce->priv->stylesheet, show_parsing_error, ce);
+ g_clear_object (&ce->priv->stylesheet);
}
static void
@@ -348,7 +348,7 @@ add_provider (GtkInspectorCssEditor *ce,
GdkDisplay *display)
{
gtk_style_context_add_provider_for_display (display,
- GTK_STYLE_PROVIDER (ce->priv->provider),
+ GTK_STYLE_PROVIDER (ce->priv->stylesheet),
GTK_STYLE_PROVIDER_PRIORITY_USER);
}
@@ -357,7 +357,7 @@ remove_provider (GtkInspectorCssEditor *ce,
GdkDisplay *display)
{
gtk_style_context_remove_provider_for_display (display,
- GTK_STYLE_PROVIDER (ce->priv->provider));
+ GTK_STYLE_PROVIDER (ce->priv->stylesheet));
}
static void
diff --git a/gtk/inspector/css-node-tree.c b/gtk/inspector/css-node-tree.c
index c465f7a5a9..2f96befebd 100644
--- a/gtk/inspector/css-node-tree.c
+++ b/gtk/inspector/css-node-tree.c
@@ -31,7 +31,7 @@
#include "gtklabel.h"
#include "gtkpopover.h"
#include "gtk/gtkwidgetprivate.h"
-#include "gtkcssproviderprivate.h"
+#include "gtkcssstylesheetprivate.h"
#include "gtkcssstylepropertyprivate.h"
#include "gtkcssstyleprivate.h"
#include "gtkcssvalueprivate.h"
diff --git a/gtk/inspector/init.c b/gtk/inspector/init.c
index 2681e62e81..dda401d0fc 100644
--- a/gtk/inspector/init.c
+++ b/gtk/inspector/init.c
@@ -46,7 +46,7 @@
#include "window.h"
#include "gtkmagnifierprivate.h"
-#include "gtkcssproviderprivate.h"
+#include "gtkcssstylesheetprivate.h"
#include "gtkmodulesprivate.h"
@@ -98,7 +98,7 @@ gtk_inspector_init (void)
g_io_module_scope_free (scope);
}
- gtk_css_provider_set_keep_css_sections ();
+ gtk_css_style_sheet_set_keep_css_sections ();
}
// vim: set et sw=2 ts=2:
diff --git a/gtk/inspector/visual.c b/gtk/inspector/visual.c
index ef78b33a07..4faaf5c504 100644
--- a/gtk/inspector/visual.c
+++ b/gtk/inspector/visual.c
@@ -29,7 +29,7 @@
#include "gtkadjustment.h"
#include "gtkbox.h"
#include "gtkcomboboxtext.h"
-#include "gtkcssproviderprivate.h"
+#include "gtkcssstylesheetprivate.h"
#include "gtkdebug.h"
#include "gtkprivate.h"
#include "gtksettings.h"
@@ -511,7 +511,7 @@ init_theme (GtkInspectorVisual *vis)
}
g_strfreev (builtin_themes);
- path = _gtk_get_theme_dir ();
+ path = gtk_get_theme_dir ();
fill_gtk (path, t);
g_free (path);
diff --git a/gtk/inspector/window.c b/gtk/inspector/window.c
index 6b4b2524d5..575db5dbd3 100644
--- a/gtk/inspector/window.c
+++ b/gtk/inspector/window.c
@@ -58,7 +58,7 @@
#include "gtkwindowgroup.h"
#include "gtkrevealer.h"
#include "gtklayoutmanager.h"
-#include "gtkcssprovider.h"
+#include "gtkcssstylesheet.h"
#include "gtkstylecontext.h"
@@ -317,19 +317,19 @@ static void
gtk_inspector_window_realize (GtkWidget *widget)
{
GskRenderer *renderer;
- GtkCssProvider *provider;
+ GtkCssStyleSheet *stylesheet;
GTK_WIDGET_CLASS (gtk_inspector_window_parent_class)->realize (widget);
renderer = gtk_native_get_renderer (GTK_NATIVE (widget));
gsk_renderer_set_debug_flags (renderer, 0);
- provider = gtk_css_provider_new ();
- gtk_css_provider_load_from_resource (provider, "/org/gtk/libgtk/inspector/inspector.css");
+ stylesheet = gtk_css_style_sheet_new ();
+ 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 (provider),
+ GTK_STYLE_PROVIDER (stylesheet),
800);
- g_object_unref (provider);
+ g_object_unref (stylesheet);
}
static void
diff --git a/gtk/meson.build b/gtk/meson.build
index bd162d1be5..c7ac036b03 100644
--- a/gtk/meson.build
+++ b/gtk/meson.build
@@ -205,7 +205,7 @@ gtk_public_sources = files([
'gtkconstraintlayout.c',
'gtkconstraint.c',
'gtkcontainer.c',
- 'gtkcssprovider.c',
+ 'gtkcssstylesheet.c',
'gtkdialog.c',
'gtkdragdest.c',
'gtkdragicon.c',
@@ -460,7 +460,7 @@ gtk_public_headers = files([
'gtkconstraintlayout.h',
'gtkconstraint.h',
'gtkcontainer.h',
- 'gtkcssprovider.h',
+ 'gtkcssstylesheet.h',
'gtkcustomlayout.h',
'gtkdebug.h',
'gtkdialog.h',
diff --git a/gtk/tools/gtk-builder-tool-preview.c b/gtk/tools/gtk-builder-tool-preview.c
index cc19251235..ff4c4c0db6 100644
--- a/gtk/tools/gtk-builder-tool-preview.c
+++ b/gtk/tools/gtk-builder-tool-preview.c
@@ -60,13 +60,13 @@ preview_file (const char *filename,
if (cssfile)
{
- GtkCssProvider *provider;
+ GtkCssStyleSheet *stylesheet;
- provider = gtk_css_provider_new ();
- gtk_css_provider_load_from_path (provider, cssfile);
+ 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 (provider),
+ GTK_STYLE_PROVIDER (stylesheet),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
}
diff --git a/po-properties/POTFILES.in b/po-properties/POTFILES.in
index 543f02fead..a98c0f576c 100644
--- a/po-properties/POTFILES.in
+++ b/po-properties/POTFILES.in
@@ -115,7 +115,7 @@ gtk/gtkconstraint.c
gtk/gtkcontainer.c
gtk/gtkcssiconthemevalue.c
gtk/gtkcssnode.c
-gtk/gtkcssprovider.c
+gtk/gtkcssstylesheet.c
gtk/gtkcssshorthandproperty.c
gtk/gtkcssstaticstyle.c
gtk/gtkcssstyleproperty.c
diff --git a/po/POTFILES.in b/po/POTFILES.in
index a686acd294..dbaac473ac 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -115,7 +115,7 @@ gtk/gtkconstraint.c
gtk/gtkcontainer.c
gtk/gtkcssiconthemevalue.c
gtk/gtkcssnode.c
-gtk/gtkcssprovider.c
+gtk/gtkcssstylesheet.c
gtk/gtkcssshorthandproperty.c
gtk/gtkcssstaticstyle.c
gtk/gtkcssstyleproperty.c
diff --git a/tests/animated-revealing.c b/tests/animated-revealing.c
index 15a8da41c0..b2157ecdd0 100644
--- a/tests/animated-revealing.c
+++ b/tests/animated-revealing.c
@@ -21,7 +21,7 @@ int
main(int argc, char **argv)
{
GtkWidget *window, *revealer, *grid, *widget;
- GtkCssProvider *cssprovider;
+ GtkCssStyleSheet *stylesheet;
GError *error = NULL;
guint x, y;
@@ -53,10 +53,10 @@ main(int argc, char **argv)
grid = gtk_grid_new ();
gtk_container_add (GTK_CONTAINER (revealer), grid);
- cssprovider = gtk_css_provider_new ();
- gtk_css_provider_load_from_data (cssprovider, "* { padding: 2px; text-shadow: 5px 5px 2px grey; }", -1);
+ 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 (cssprovider),
+ GTK_STYLE_PROVIDER (stylesheet),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
for (x = 0; x < 10; x++)
diff --git a/tests/testadjustsize.c b/tests/testadjustsize.c
index 7bcb86215f..32a0474da9 100644
--- a/tests/testadjustsize.c
+++ b/tests/testadjustsize.c
@@ -349,19 +349,19 @@ open_valigned_label_window (void)
int
main (int argc, char *argv[])
{
- GtkCssProvider *provider;
+ GtkCssStyleSheet *stylesheet;
gtk_init ();
- provider = gtk_css_provider_new ();
- gtk_css_provider_load_from_data (provider,
+ stylesheet = gtk_css_style_sheet_new ();
+ gtk_css_style_sheet_load_from_data (stylesheet,
".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 (provider),
+ GTK_STYLE_PROVIDER (stylesheet),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
- g_object_unref (provider);
+ g_object_unref (stylesheet);
if (g_getenv ("RTL"))
gtk_widget_set_default_direction (GTK_TEXT_DIR_RTL);
diff --git a/tests/testbaseline.c b/tests/testbaseline.c
index 2ab609582f..4512fca100 100644
--- a/tests/testbaseline.c
+++ b/tests/testbaseline.c
@@ -74,19 +74,19 @@ main (int argc,
GtkWidget *vbox, *hbox, *grid_hbox, *spin, *spin2, *toggle, *combo, *image;
GtkAdjustment *adjustment;
int i, j;
- GtkCssProvider *provider;
+ GtkCssStyleSheet *stylesheet;
gtk_init ();
- provider = gtk_css_provider_new ();
- gtk_css_provider_load_from_data (provider,
+ stylesheet = gtk_css_style_sheet_new ();
+ gtk_css_style_sheet_load_from_data (stylesheet,
".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 (provider),
+ GTK_STYLE_PROVIDER (stylesheet),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
- g_object_unref (provider);
+ g_object_unref (stylesheet);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (gtk_main_quit), NULL);
diff --git a/tests/testborderdrawing.c b/tests/testborderdrawing.c
index 80d5b81a96..90574c608f 100644
--- a/tests/testborderdrawing.c
+++ b/tests/testborderdrawing.c
@@ -85,14 +85,14 @@ main (int argc, char **argv)
GtkWidget *top;
GtkWidget *bottom;
GtkWidget *w;
- GtkCssProvider *provider;
+ GtkCssStyleSheet *stylesheet;
gtk_init ();
- provider = gtk_css_provider_new ();
- gtk_css_provider_load_from_data (provider, css, -1);
+ 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 (provider),
+ GTK_STYLE_PROVIDER (stylesheet),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
diff --git a/tests/testcombochange.c b/tests/testcombochange.c
index ea52eb4943..5d43c55e0d 100644
--- a/tests/testcombochange.c
+++ b/tests/testcombochange.c
@@ -76,7 +76,7 @@ create_combo (const char *name,
{
GtkCellRenderer *cell_renderer;
GtkWidget *combo;
- GtkCssProvider *provider;
+ GtkCssStyleSheet *stylesheet;
GtkStyleContext *context;
gchar *css_data;
@@ -90,14 +90,14 @@ create_combo (const char *name,
context = gtk_widget_get_style_context (combo);
- provider = gtk_css_provider_new ();
+ stylesheet = gtk_css_style_sheet_new ();
css_data = g_strdup_printf ("#%s { -GtkComboBox-appears-as-list: %s }",
name, is_list ? "true" : "false");
- gtk_css_provider_load_from_data (provider, css_data, -1);
+ gtk_css_style_sheet_load_from_data (stylesheet, css_data, -1);
g_free (css_data);
gtk_style_context_add_provider (context,
- GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER (stylesheet),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
return combo;
diff --git a/tests/testdnd3.c b/tests/testdnd3.c
index f9315569fc..4b6e89b22c 100644
--- a/tests/testdnd3.c
+++ b/tests/testdnd3.c
@@ -5,7 +5,7 @@ prepare (GtkDragSource *source, double x, double y)
{
GtkWidget *canvas;
GtkWidget *item;
- GdkContentProvider *provider;
+ GdkContentProvider *stylesheet;
GBytes *bytes;
canvas = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (source));
@@ -15,12 +15,12 @@ prepare (GtkDragSource *source, double x, double y)
return NULL;
bytes = g_bytes_new (&item, sizeof (gpointer));
- provider = gdk_content_provider_new_for_bytes ("CANVAS_ITEM", bytes);
+ stylesheet = gdk_content_provider_new_for_bytes ("CANVAS_ITEM", bytes);
g_bytes_unref (bytes);
g_object_set_data (G_OBJECT (canvas), "dragged-item", item);
- return provider;
+ return stylesheet;
}
static void
@@ -167,20 +167,20 @@ set_color (GtkWidget *item,
char *css;
char *str;
GtkStyleContext *context;
- GtkCssProvider *provider;
+ GtkCssStyleSheet *stylesheet;
str = gdk_rgba_to_string (color);
css = g_strdup_printf ("* { background: %s; padding: 10px; }", str);
context = gtk_widget_get_style_context (item);
- provider = g_object_get_data (G_OBJECT (context), "style-provider");
- if (provider)
- gtk_style_context_remove_provider (context, GTK_STYLE_PROVIDER (provider));
-
- provider = gtk_css_provider_new ();
- gtk_css_provider_load_from_data (provider, css, -1);
- gtk_style_context_add_provider (gtk_widget_get_style_context (item), GTK_STYLE_PROVIDER (provider), 800);
- g_object_set_data_full (G_OBJECT (context), "style-provider", provider, g_object_unref);
+ stylesheet = g_object_get_data (G_OBJECT (context), "style-stylesheet");
+ if (stylesheet)
+ gtk_style_context_remove_provider (context, GTK_STYLE_PROVIDER (stylesheet));
+
+ stylesheet = gtk_css_style_sheet_new ();
+ 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);
+ g_object_set_data_full (G_OBJECT (context), "style-stylesheet", stylesheet, g_object_unref);
g_free (str);
g_free (css);
diff --git a/tests/testentryicons.c b/tests/testentryicons.c
index e117579d2e..39cf9614b5 100644
--- a/tests/testentryicons.c
+++ b/tests/testentryicons.c
@@ -279,10 +279,10 @@ main (int argc, char **argv)
gtk_container_add (GTK_CONTAINER (box), image);
gtk_grid_attach (GTK_GRID (grid), box, 1, 7, 1, 1);
- GtkCssProvider *provider;
- provider = gtk_css_provider_new ();
- gtk_css_provider_load_from_data (provider, cssdata, -1);
- gtk_style_context_add_provider_for_display (gdk_display_get_default (), GTK_STYLE_PROVIDER (provider),
800);
+ 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_widget_show (window);
gtk_main();
diff --git a/tests/testframe.c b/tests/testframe.c
index 20ca049ec2..6add6ff317 100644
--- a/tests/testframe.c
+++ b/tests/testframe.c
@@ -22,19 +22,19 @@ static void
spin_hpadding_cb (GtkSpinButton *spin, gpointer user_data)
{
GtkWidget *frame = user_data;
- GtkCssProvider *provider;
+ GtkCssStyleSheet *stylesheet;
GtkStyleContext *context;
gchar *data;
GtkBorder pad;
context = gtk_widget_get_style_context (frame);
- provider = g_object_get_data (G_OBJECT (frame), "provider");
- if (provider == NULL)
+ stylesheet = g_object_get_data (G_OBJECT (frame), "stylesheet");
+ if (stylesheet == NULL)
{
- provider = gtk_css_provider_new ();
- g_object_set_data (G_OBJECT (frame), "provider", provider);
+ stylesheet = gtk_css_style_sheet_new ();
+ g_object_set_data (G_OBJECT (frame), "stylesheet", stylesheet);
gtk_style_context_add_provider (context,
- GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER (stylesheet),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
}
@@ -48,7 +48,7 @@ spin_hpadding_cb (GtkSpinButton *spin, gpointer user_data)
pad.top,
(gint)gtk_spin_button_get_value (spin));
- gtk_css_provider_load_from_data (provider, data, -1);
+ gtk_css_style_sheet_load_from_data (stylesheet, data, -1);
g_free (data);
gtk_widget_queue_resize (frame);
@@ -58,19 +58,19 @@ static void
spin_vpadding_cb (GtkSpinButton *spin, gpointer user_data)
{
GtkWidget *frame = user_data;
- GtkCssProvider *provider;
+ GtkCssStyleSheet *stylesheet;
GtkStyleContext *context;
gchar *data;
GtkBorder pad;
context = gtk_widget_get_style_context (frame);
- provider = g_object_get_data (G_OBJECT (frame), "provider");
- if (provider == NULL)
+ stylesheet = g_object_get_data (G_OBJECT (frame), "stylesheet");
+ if (stylesheet == NULL)
{
- provider = gtk_css_provider_new ();
- g_object_set_data (G_OBJECT (frame), "provider", provider);
+ stylesheet = gtk_css_style_sheet_new ();
+ g_object_set_data (G_OBJECT (frame), "stylesheet", stylesheet);
gtk_style_context_add_provider (context,
- GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER (stylesheet),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
}
@@ -84,7 +84,7 @@ spin_vpadding_cb (GtkSpinButton *spin, gpointer user_data)
(gint)gtk_spin_button_get_value (spin),
pad.left);
- gtk_css_provider_load_from_data (provider, data, -1);
+ gtk_css_style_sheet_load_from_data (stylesheet, data, -1);
g_free (data);
gtk_widget_queue_resize (frame);
diff --git a/tests/testgrid.c b/tests/testgrid.c
index 4b63268895..99a74c88ec 100644
--- a/tests/testgrid.c
+++ b/tests/testgrid.c
@@ -5,19 +5,19 @@ oriented_test_widget (const gchar *label, const gchar *color)
{
GtkWidget *box;
GtkWidget *widget;
- GtkCssProvider *provider;
+ GtkCssStyleSheet *stylesheet;
gchar *data;
widget = gtk_label_new (label);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- provider = gtk_css_provider_new ();
+ stylesheet = gtk_css_style_sheet_new ();
data = g_strdup_printf ("box { background: %s; }", color);
- gtk_css_provider_load_from_data (provider, data, -1);
+ gtk_css_style_sheet_load_from_data (stylesheet, data, -1);
gtk_style_context_add_provider (gtk_widget_get_style_context (box),
- GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER (stylesheet),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
g_free (data);
- g_object_unref (provider);
+ g_object_unref (stylesheet);
gtk_container_add (GTK_CONTAINER (box), widget);
return box;
diff --git a/tests/testgtk.c b/tests/testgtk.c
index bfedeeff48..5a287a36bb 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -185,7 +185,7 @@ create_alpha_window (GtkWidget *widget)
if (!window)
{
- static GtkCssProvider *provider = NULL;
+ static GtkCssStyleSheet *stylesheet = NULL;
GtkWidget *content_area;
GtkWidget *vbox;
GtkWidget *label;
@@ -196,18 +196,18 @@ create_alpha_window (GtkWidget *widget)
"_Close", 0,
NULL);
gtk_widget_add_style_class (window, "alpha");
- if (provider == NULL)
+ if (stylesheet == NULL)
{
- provider = gtk_css_provider_new ();
- gtk_css_provider_load_from_data (provider,
+ stylesheet = gtk_css_style_sheet_new ();
+ gtk_css_style_sheet_load_from_data (stylesheet,
"dialog.alpha {\n"
" 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 (provider),
+ GTK_STYLE_PROVIDER (stylesheet),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
- g_object_unref (provider);
+ g_object_unref (stylesheet);
}
content_area = gtk_dialog_get_content_area (GTK_DIALOG (window));
@@ -6372,7 +6372,7 @@ usage (void)
int
main (int argc, char *argv[])
{
- GtkCssProvider *provider, *memory_provider;
+ GtkCssStyleSheet *stylesheet, *memory_provider;
GdkDisplay *display;
GtkBindingSet *binding_set;
int i;
@@ -6390,23 +6390,23 @@ main (int argc, char *argv[])
gtk_init ();
- provider = gtk_css_provider_new ();
+ stylesheet = gtk_css_style_sheet_new ();
/* Check to see if we are being run from the correct
* directory.
*/
if (file_exists ("testgtk.css"))
- gtk_css_provider_load_from_path (provider, "testgtk.css");
+ gtk_css_style_sheet_load_from_path (stylesheet, "testgtk.css");
else if (file_exists ("tests/testgtk.css"))
- gtk_css_provider_load_from_path (provider, "tests/testgtk.css");
+ gtk_css_style_sheet_load_from_path (stylesheet, "tests/testgtk.css");
else
g_warning ("Couldn't find file \"testgtk.css\".");
display = gdk_display_get_default ();
- gtk_style_context_add_provider_for_display (display, GTK_STYLE_PROVIDER (provider),
+ gtk_style_context_add_provider_for_display (display, GTK_STYLE_PROVIDER (stylesheet),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
- g_object_unref (provider);
+ g_object_unref (stylesheet);
gtk_accelerator_set_default_mod_mask (GDK_SHIFT_MASK |
GDK_CONTROL_MASK |
@@ -6467,8 +6467,8 @@ main (int argc, char *argv[])
1,
G_TYPE_STRING, "GtkWidgetClass <ctrl><release>9 test");
- memory_provider = gtk_css_provider_new ();
- gtk_css_provider_load_from_data (memory_provider,
+ memory_provider = gtk_css_style_sheet_new ();
+ gtk_css_style_sheet_load_from_data (memory_provider,
"#testgtk-version-label {\n"
" color: #f00;\n"
" font-family: Sans;\n"
diff --git a/tests/testheaderbar.c b/tests/testheaderbar.c
index 51f5a97a13..a0dfac6091 100644
--- a/tests/testheaderbar.c
+++ b/tests/testheaderbar.c
@@ -123,17 +123,17 @@ main (int argc, char *argv[])
GtkWidget *footer;
GtkWidget *button;
GtkWidget *content;
- GtkCssProvider *provider;
+ GtkCssStyleSheet *stylesheet;
gtk_init ();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_style_context_add_class (gtk_widget_get_style_context (window), "main");
- provider = gtk_css_provider_new ();
- gtk_css_provider_load_from_data (provider, css, -1);
+ 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 (provider),
+ GTK_STYLE_PROVIDER (stylesheet),
GTK_STYLE_PROVIDER_PRIORITY_USER);
diff --git a/tests/testiconview-keynav.c b/tests/testiconview-keynav.c
index 69a9b95869..a4e5062347 100644
--- a/tests/testiconview-keynav.c
+++ b/tests/testiconview-keynav.c
@@ -210,14 +210,14 @@ focus_changed (GtkWidget *view,
static void
set_styles (void)
{
- GtkCssProvider *provider;
+ GtkCssStyleSheet *stylesheet;
- provider = gtk_css_provider_new ();
+ stylesheet = gtk_css_style_sheet_new ();
- gtk_css_provider_load_from_data (provider, CSS, -1);
+ gtk_css_style_sheet_load_from_data (stylesheet, CSS, -1);
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
- GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER (stylesheet),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
}
diff --git a/tests/testlevelbar.c b/tests/testlevelbar.c
index 255bd1d523..9b98346dba 100644
--- a/tests/testlevelbar.c
+++ b/tests/testlevelbar.c
@@ -27,16 +27,16 @@ create_level_bar (void)
static void
add_custom_css (void)
{
- GtkCssProvider *provider;
+ GtkCssStyleSheet *stylesheet;
const gchar data[] =
"levelbar block.my-offset {"
" background: magenta;"
"}";
- provider = gtk_css_provider_new ();
- gtk_css_provider_load_from_data (provider, data, -1);
+ 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 (provider),
+ GTK_STYLE_PROVIDER (stylesheet),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
}
diff --git a/tests/testlist.c b/tests/testlist.c
index 8e3f8b9007..b0a6527d9c 100644
--- a/tests/testlist.c
+++ b/tests/testlist.c
@@ -250,7 +250,7 @@ single_click_clicked (GtkButton *check, gpointer data)
int
main (int argc, char *argv[])
{
- GtkCssProvider *provider;
+ GtkCssStyleSheet *stylesheet;
GtkWidget *window, *hbox, *vbox, *list, *row, *row3, *row_vbox, *row_hbox, *l;
GtkWidget *check, *button, *combo, *scrolled;
@@ -260,10 +260,10 @@ main (int argc, char *argv[])
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_add (GTK_CONTAINER (window), hbox);
- provider = gtk_css_provider_new ();
- gtk_css_provider_load_from_data (provider, css, -1);
+ 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 (provider),
+ GTK_STYLE_PROVIDER (stylesheet),
GTK_STYLE_PROVIDER_PRIORITY_USER);
diff --git a/tests/testlist3.c b/tests/testlist3.c
index 59120cc6bb..acb8216ee0 100644
--- a/tests/testlist3.c
+++ b/tests/testlist3.c
@@ -143,13 +143,13 @@ main (int argc, char *argv[])
GtkWidget *hbox, *vbox, *combo, *button;
gint i;
gchar *text;
- GtkCssProvider *provider;
+ GtkCssStyleSheet *stylesheet;
gtk_init ();
- provider = gtk_css_provider_new ();
- gtk_css_provider_load_from_data (provider, css, -1);
- gtk_style_context_add_provider_for_display (gdk_display_get_default (), GTK_STYLE_PROVIDER (provider),
800);
+ 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);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size (GTK_WINDOW (window), -1, 300);
diff --git a/tests/testmodelbutton.c b/tests/testmodelbutton.c
index bea494faa6..7d49c5ed8a 100644
--- a/tests/testmodelbutton.c
+++ b/tests/testmodelbutton.c
@@ -15,7 +15,7 @@ on_application_activate (GApplication *gapplication,
void *user_data)
{
GtkApplication *application = GTK_APPLICATION (gapplication);
- GtkCssProvider *css_provider = gtk_css_provider_new ();
+ GtkCssStyleSheet *stylesheet = gtk_css_style_sheet_new ();
GdkDisplay *display = gdk_display_get_default ();
GSimpleAction *action;
@@ -24,7 +24,7 @@ on_application_activate (GApplication *gapplication,
GtkWidget *model_button;
GtkWidget *widget;
- gtk_css_provider_load_from_data (css_provider,
+ gtk_css_style_sheet_load_from_data (stylesheet,
"window > box { padding: 0.5em; }"
"window > box > * { margin: 0.5em; }"
/* :iconic == FALSE */
@@ -36,7 +36,7 @@ on_application_activate (GApplication *gapplication,
, -1);
g_assert (GDK_IS_DISPLAY (display));
gtk_style_context_add_provider_for_display (display,
- GTK_STYLE_PROVIDER (css_provider),
+ GTK_STYLE_PROVIDER (stylesheet),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
action = g_simple_action_new ("beep", NULL);
diff --git a/tests/testoutsetshadowdrawing.c b/tests/testoutsetshadowdrawing.c
index 96462a3310..a5ebb44b41 100644
--- a/tests/testoutsetshadowdrawing.c
+++ b/tests/testoutsetshadowdrawing.c
@@ -82,14 +82,14 @@ main (int argc, char **argv)
GtkWidget *top;
GtkWidget *bottom;
GtkWidget *w;
- GtkCssProvider *provider;
+ GtkCssStyleSheet *stylesheet;
gtk_init ();
- provider = gtk_css_provider_new ();
- gtk_css_provider_load_from_data (provider, css, -1);
+ 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 (provider),
+ GTK_STYLE_PROVIDER (stylesheet),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
diff --git a/tests/testoverlay.c b/tests/testoverlay.c
index b73b0fc783..1c81eb6b37 100644
--- a/tests/testoverlay.c
+++ b/tests/testoverlay.c
@@ -492,17 +492,17 @@ main (int argc, char *argv[])
GtkWidget *win6;
GtkWidget *win7;
GtkWidget *win8;
- GtkCssProvider *css_provider;
+ GtkCssStyleSheet *css_style_sheet;
gtk_init ();
if (g_getenv ("RTL"))
gtk_widget_set_default_direction (GTK_TEXT_DIR_RTL);
- css_provider = gtk_css_provider_new ();
- gtk_css_provider_load_from_data (css_provider, css, -1);
+ 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_provider),
+ GTK_STYLE_PROVIDER (css_style_sheet),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
win1 = test_nonzerox ();
diff --git a/tests/testoverlaystyleclass.c b/tests/testoverlaystyleclass.c
index 37a857d265..8d5f84e8fe 100644
--- a/tests/testoverlaystyleclass.c
+++ b/tests/testoverlaystyleclass.c
@@ -43,13 +43,13 @@ int
main (int argc, char *argv[])
{
GtkWidget *win, *overlay, *grid, *main_child, *child, *label, *sw;
- GtkCssProvider *provider;
+ GtkCssStyleSheet *stylesheet;
gchar *str;
gtk_init ();
- provider = gtk_css_provider_new ();
- gtk_css_provider_load_from_data (provider,
+ stylesheet = gtk_css_style_sheet_new ();
+ gtk_css_style_sheet_load_from_data (stylesheet,
"label { border: 3px solid black; border-radius: 5px; padding: 2px; }"
".top { border-top-style: none; border-top-right-radius: 0px;
border-top-left-radius: 0px; }"
".bottom { border-bottom-style: none; border-bottom-right-radius: 0px;
border-bottom-left-radius: 0px; }"
@@ -57,7 +57,7 @@ main (int argc, char *argv[])
".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 (provider),
+ GTK_STYLE_PROVIDER (stylesheet),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
diff --git a/tests/testwidgetfocus.c b/tests/testwidgetfocus.c
index 0ee9e7903c..7004e88475 100644
--- a/tests/testwidgetfocus.c
+++ b/tests/testwidgetfocus.c
@@ -270,14 +270,14 @@ main()
{
GtkWidget *window;
GtkWidget *widget;
- GtkCssProvider *provider;
+ GtkCssStyleSheet *stylesheet;
gtk_init ();
- provider = gtk_css_provider_new ();
- gtk_css_provider_load_from_data (provider, css, -1);
+ 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 (provider),
+ GTK_STYLE_PROVIDER (stylesheet),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
diff --git a/tests/testwidgettransforms.c b/tests/testwidgettransforms.c
index d8cf78fc6c..416ff9d29d 100644
--- a/tests/testwidgettransforms.c
+++ b/tests/testwidgettransforms.c
@@ -286,14 +286,14 @@ main (int argc, char **argv)
GtkWidget *box;
GtkWidget *titlebar;
GtkWidget *toggle_button;
- GtkCssProvider *provider;
+ GtkCssStyleSheet *stylesheet;
gtk_init ();
- provider = gtk_css_provider_new ();
- gtk_css_provider_load_from_data (provider, css, -1);
+ 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 (provider),
+ GTK_STYLE_PROVIDER (stylesheet),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
diff --git a/testsuite/css/api.c b/testsuite/css/api.c
index c44caa2e4e..251c65f262 100644
--- a/testsuite/css/api.c
+++ b/testsuite/css/api.c
@@ -21,16 +21,16 @@
#include <gtk/gtk.h>
static void
-gtk_css_provider_load_data_not_null_terminated (void)
+gtk_css_style_sheet_load_data_not_null_terminated (void)
{
- GtkCssProvider *p;
+ GtkCssStyleSheet *s;
const gchar data[3] = {'*', '{', '}'};
- p = gtk_css_provider_new();
+ s = gtk_css_style_sheet_new();
- gtk_css_provider_load_from_data(p, data, sizeof (data));
+ gtk_css_style_sheet_load_from_data (s, data, sizeof (data));
- g_object_unref (p);
+ g_object_unref (s);
}
@@ -39,8 +39,8 @@ main (int argc, char *argv[])
{
gtk_test_init (&argc, &argv, NULL);
- g_test_add_func ("/gtk_css_provider_load_data/not_null_terminated",
- gtk_css_provider_load_data_not_null_terminated);
+ g_test_add_func ("/gtk_css_style_sheet_load_data/not_null_terminated",
+ gtk_css_style_sheet_load_data_not_null_terminated);
return g_test_run ();
}
diff --git a/testsuite/css/change/test-css-change.c b/testsuite/css/change/test-css-change.c
index add2227f65..35b7ce7dcf 100644
--- a/testsuite/css/change/test-css-change.c
+++ b/testsuite/css/change/test-css-change.c
@@ -118,7 +118,7 @@ load_ui_file (GFile *file, gboolean generate)
GtkWidget *window;
char *output, *diff;
char *ui_file, *css_file, *reference_file;
- GtkCssProvider *provider;
+ GtkCssStyleSheet *stylesheet;
GError *error = NULL;
ui_file = g_file_get_path (file);
@@ -126,10 +126,10 @@ load_ui_file (GFile *file, gboolean generate)
css_file = test_get_other_file (ui_file, ".css");
g_assert (css_file != NULL);
- provider = gtk_css_provider_new ();
- gtk_css_provider_load_from_path (provider, css_file);
+ stylesheet = gtk_css_style_sheet_new ();
+ gtk_css_style_sheet_load_from_path (stylesheet, css_file);
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
- GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER (stylesheet),
GTK_STYLE_PROVIDER_PRIORITY_FORCE);
builder = gtk_builder_new_from_file (ui_file);
@@ -169,8 +169,8 @@ load_ui_file (GFile *file, gboolean generate)
out:
gtk_style_context_remove_provider_for_display (gdk_display_get_default (),
- GTK_STYLE_PROVIDER (provider));
- g_object_unref (provider);
+ GTK_STYLE_PROVIDER (stylesheet));
+ g_object_unref (stylesheet);
g_free (output);
g_free (ui_file);
diff --git a/testsuite/css/parser/test-css-parser.c b/testsuite/css/parser/test-css-parser.c
index b2c4f69746..77ff75c71b 100644
--- a/testsuite/css/parser/test-css-parser.c
+++ b/testsuite/css/parser/test-css-parser.c
@@ -134,7 +134,7 @@ append_error_value (GString *string,
}
static void
-parsing_error_cb (GtkCssProvider *provider,
+parsing_error_cb (GtkCssStyleSheet *stylesheet,
GtkCssSection *section,
const GError *error,
GString *errors)
@@ -164,7 +164,7 @@ parsing_error_cb (GtkCssProvider *provider,
static void
parse_css_file (GFile *file, gboolean generate)
{
- GtkCssProvider *provider;
+ GtkCssStyleSheet *stylesheet;
char *css, *css_file, *reference_file, *errors_file;
GString *errors;
GBytes *diff;
@@ -173,14 +173,14 @@ parse_css_file (GFile *file, gboolean generate)
css_file = g_file_get_path (file);
errors = g_string_new ("");
- provider = gtk_css_provider_new ();
- g_signal_connect (provider,
+ stylesheet = gtk_css_style_sheet_new ();
+ g_signal_connect (stylesheet,
"parsing-error",
G_CALLBACK (parsing_error_cb),
errors);
- gtk_css_provider_load_from_path (provider, css_file);
+ gtk_css_style_sheet_load_from_path (stylesheet, css_file);
- css = gtk_css_provider_to_string (provider);
+ css = gtk_css_style_sheet_to_string (stylesheet);
if (generate)
{
diff --git a/testsuite/css/style/test-css-style.c b/testsuite/css/style/test-css-style.c
index 6e6a59466e..ad434d10b6 100644
--- a/testsuite/css/style/test-css-style.c
+++ b/testsuite/css/style/test-css-style.c
@@ -135,7 +135,7 @@ load_ui_file (GFile *file, gboolean generate)
char *output;
GBytes *diff;
char *ui_file, *css_file, *reference_file;
- GtkCssProvider *provider;
+ GtkCssStyleSheet *stylesheet;
GError *error = NULL;
ui_file = g_file_get_path (file);
@@ -143,10 +143,10 @@ load_ui_file (GFile *file, gboolean generate)
css_file = test_get_other_file (ui_file, ".css");
g_assert (css_file != NULL);
- provider = gtk_css_provider_new ();
- gtk_css_provider_load_from_path (provider, css_file);
+ stylesheet = gtk_css_style_sheet_new ();
+ gtk_css_style_sheet_load_from_path (stylesheet, css_file);
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
- GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER (stylesheet),
GTK_STYLE_PROVIDER_PRIORITY_FORCE);
builder = gtk_builder_new_from_file (ui_file);
@@ -184,8 +184,8 @@ load_ui_file (GFile *file, gboolean generate)
out:
gtk_style_context_remove_provider_for_display (gdk_display_get_default (),
- GTK_STYLE_PROVIDER (provider));
- g_object_unref (provider);
+ GTK_STYLE_PROVIDER (stylesheet));
+ g_object_unref (stylesheet);
g_free (output);
g_free (ui_file);
diff --git a/testsuite/gtk/cssstylesheet.c b/testsuite/gtk/cssstylesheet.c
new file mode 100644
index 0000000000..b5dafbe73f
--- /dev/null
+++ b/testsuite/gtk/cssstylesheet.c
@@ -0,0 +1,46 @@
+#include <gtk/gtk.h>
+
+static void
+assert_section_is_not_null (GtkCssStyleSheet *stylesheet,
+ GtkCssSection *section,
+ const GError *error,
+ gpointer unused)
+{
+ g_assert (section != NULL);
+}
+
+static void
+test_section_in_load_from_data (void)
+{
+ GtkCssStyleSheet *stylesheet;
+
+ stylesheet = gtk_css_style_sheet_new ();
+ g_signal_connect (stylesheet, "parsing-error",
+ G_CALLBACK (assert_section_is_not_null), NULL);
+ gtk_css_style_sheet_load_from_data (stylesheet, "random garbage goes here", -1);
+ g_object_unref (stylesheet);
+}
+
+static void
+test_section_load_nonexisting_file (void)
+{
+ GtkCssStyleSheet *stylesheet;
+
+ stylesheet = gtk_css_style_sheet_new ();
+ g_signal_connect (stylesheet, "parsing-error",
+ G_CALLBACK (assert_section_is_not_null), NULL);
+ gtk_css_style_sheet_load_from_path (stylesheet, "this/path/does/absolutely/not/exist.css");
+ g_object_unref (stylesheet);
+}
+
+int
+main (int argc, char *argv[])
+{
+ gtk_init ();
+ g_test_init (&argc, &argv, NULL);
+
+ g_test_add_func ("/cssstylesheet/section-in-load-from-data", test_section_in_load_from_data);
+ g_test_add_func ("/cssstylesheet/load-nonexisting-file", test_section_load_nonexisting_file);
+
+ return g_test_run ();
+}
diff --git a/testsuite/gtk/meson.build b/testsuite/gtk/meson.build
index 4255d8817f..300ab7a328 100644
--- a/testsuite/gtk/meson.build
+++ b/testsuite/gtk/meson.build
@@ -22,7 +22,7 @@ tests = [
'../../gtk/gtkconstraintexpression.c',
], ['-DGTK_COMPILATION', '-UG_ENABLE_DEBUG']
],
- ['cssprovider'],
+ ['cssstylesheet'],
['rbtree-crash', ['../../gtk/gtkrbtree.c'], ['-DGTK_COMPILATION', '-UG_ENABLE_DEBUG']],
['defaultvalue'],
['entry'],
diff --git a/testsuite/gtk/theme-validate.c b/testsuite/gtk/theme-validate.c
index e2e51e5852..a5f22137d6 100644
--- a/testsuite/gtk/theme-validate.c
+++ b/testsuite/gtk/theme-validate.c
@@ -9,7 +9,7 @@ struct _Theme
};
static void
-theme_parsing_error (GtkCssProvider *provider,
+theme_parsing_error (GtkCssStyleSheet *stylesheet,
GtkCssSection *section,
const GError *error,
gpointer unused)
@@ -29,13 +29,13 @@ static void
test_theme (gconstpointer data)
{
const Theme *theme = data;
- GtkCssProvider *provider;
+ GtkCssStyleSheet *stylesheet;
- provider = gtk_css_provider_new ();
- g_signal_connect (provider, "parsing-error",
+ stylesheet = gtk_css_style_sheet_new ();
+ g_signal_connect (stylesheet, "parsing-error",
G_CALLBACK (theme_parsing_error), NULL);
- gtk_css_provider_load_named (provider, theme->name, theme->variant);
- g_object_unref (provider);
+ gtk_css_style_sheet_load_named (stylesheet, theme->name, theme->variant);
+ g_object_unref (stylesheet);
}
int
diff --git a/testsuite/reftests/gtk-reftest.c b/testsuite/reftests/gtk-reftest.c
index f54244db3e..96283c141b 100644
--- a/testsuite/reftests/gtk-reftest.c
+++ b/testsuite/reftests/gtk-reftest.c
@@ -223,8 +223,8 @@ add_extra_css (const char *testname,
if (css_file == NULL)
return NULL;
- provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
- gtk_css_provider_load_from_path (GTK_CSS_PROVIDER (provider),
+ 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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]