From 771ceb1a22e90bb119a11b33bfc644d9ad3330d5 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Mon, 4 Sep 2023 10:15:06 +0300 Subject: [PATCH 8/8] gtk: Apply theme to all dialogs See osdn #48580 Signed-off-by: Marko Lindqvist --- client/gui-gtk-3.0/themes.c | 9 +++++---- client/gui-gtk-3.22/themes.c | 9 +++++---- client/gui-gtk-4.0/themes.c | 9 +++++---- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/client/gui-gtk-3.0/themes.c b/client/gui-gtk-3.0/themes.c index 57d50ddfdc..0c2516a1cd 100644 --- a/client/gui-gtk-3.0/themes.c +++ b/client/gui-gtk-3.0/themes.c @@ -48,7 +48,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_screen( + gtk_widget_get_screen(toplevel), GTK_STYLE_PROVIDER(fc_css_provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); } @@ -73,10 +74,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) { @@ -84,7 +85,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; diff --git a/client/gui-gtk-3.22/themes.c b/client/gui-gtk-3.22/themes.c index d54c45f6f4..98b673637c 100644 --- a/client/gui-gtk-3.22/themes.c +++ b/client/gui-gtk-3.22/themes.c @@ -48,7 +48,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_screen( + gtk_widget_get_screen(toplevel), GTK_STYLE_PROVIDER(fc_css_provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); } @@ -71,10 +72,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) { @@ -82,7 +83,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; 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