diff options
author | Matthias Clasen <mclasen@redhat.com> | 2022-10-09 14:26:58 +0000 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2022-10-09 14:26:58 +0000 |
commit | b5f7d5712469309744375511c28dd330b5f46998 (patch) | |
tree | a4efca93f21ad3754470a89e8974be55fb05054f /tests/testgtk.c | |
parent | 6a6ef0f437ecdd2677b7b459d921980ddf77ca31 (diff) | |
parent | 0db5c7f421d117021e78741400840c0cf497c0c5 (diff) | |
download | gtk+-b5f7d5712469309744375511c28dd330b5f46998.tar.gz |
Merge branch 'matthiasc/for-main' into 'main'
gtk-demo: Modernize accordion demo
See merge request GNOME/gtk!5105
Diffstat (limited to 'tests/testgtk.c')
-rw-r--r-- | tests/testgtk.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/tests/testgtk.c b/tests/testgtk.c index 6de750e9b3..e7cebbc100 100644 --- a/tests/testgtk.c +++ b/tests/testgtk.c @@ -193,26 +193,30 @@ create_alpha_window (GtkWidget *widget) if (!window) { + static GtkCssProvider *provider = NULL; GtkWidget *content_area; GtkWidget *vbox; GtkWidget *label; GdkDisplay *display; - GtkCssProvider *provider; window = gtk_dialog_new_with_buttons ("Alpha Window", GTK_WINDOW (gtk_widget_get_root (widget)), 0, "_Close", 0, NULL); - provider = gtk_css_provider_new (); - gtk_css_provider_load_from_data (provider, - "dialog {\n" - " background: radial-gradient(ellipse at center, #FFBF00, #FFBF0000);\n" - "}\n", - -1); - gtk_style_context_add_provider (gtk_widget_get_style_context (window), - GTK_STYLE_PROVIDER (provider), - GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); - g_object_unref (provider); + gtk_widget_add_css_class (window, "alpha"); + if (provider == NULL) + { + provider = gtk_css_provider_new (); + gtk_css_provider_load_from_data (provider, + "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_PRIORITY_APPLICATION); + g_object_unref (provider); + } content_area = gtk_dialog_get_content_area (GTK_DIALOG (window)); |