From 4333a5132a85e4936f5bcd0a825a66e80e9d03ff Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 16 Sep 2023 16:31:33 +0300 Subject: [PATCH 02/19] gtk4: Apply theme to all dialogs See osdn #48634 Signed-off-by: Marko Lindqvist --- client/gui-gtk-4.0/themes.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/client/gui-gtk-4.0/themes.c b/client/gui-gtk-4.0/themes.c index fb5f11fa7e..3b0b3c98e0 100644 --- a/client/gui-gtk-4.0/themes.c +++ b/client/gui-gtk-4.0/themes.c @@ -47,7 +47,8 @@ void gui_load_theme(const char *directory, const char *theme_name) if (fc_css_provider == NULL) { fc_css_provider = gtk_css_provider_new(); - gtk_style_context_add_provider(gtk_widget_get_style_context(toplevel), + gtk_style_context_add_provider_for_display( + gtk_widget_get_display(toplevel), GTK_STYLE_PROVIDER(fc_css_provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); } @@ -66,10 +67,10 @@ void gui_clear_theme(void) { bool theme_loaded; - /* try to load user defined theme */ + /* Try to load user defined theme */ theme_loaded = load_theme(GUI_GTK_OPTION(default_theme_name)); - /* no user defined theme loaded -> try to load Freeciv default theme */ + /* No user defined theme loaded -> try to load Freeciv default theme */ if (!theme_loaded) { theme_loaded = load_theme(GUI_GTK_DEFAULT_THEME_NAME); if (theme_loaded) { @@ -77,7 +78,7 @@ void gui_clear_theme(void) } } - /* still no theme loaded -> load system default theme */ + /* Still no theme loaded -> load system default theme */ if (!theme_loaded) { static GtkCssProvider *default_provider = NULL; -- 2.40.1