[gnome-software/wip/exalm/style-cleanups: 1/25] application: Fix loading high contrast styles




commit e18d0a0cfaa5fb1dc540020ac59e30db7a3b46c9
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Tue Nov 9 18:18:57 2021 +0500

    application: Fix loading high contrast styles
    
    HC is not a theme anymore.

 src/gs-application.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/src/gs-application.c b/src/gs-application.c
index b62931bc1..75f31b2ee 100644
--- a/src/gs-application.c
+++ b/src/gs-application.c
@@ -237,13 +237,11 @@ gs_application_show_first_run_dialog (GsApplication *app)
 }
 
 static void
-theme_changed (GtkSettings *settings, GParamSpec *pspec, GsApplication *app)
+hc_changed (AdwStyleManager *manager, GParamSpec *pspec, GsApplication *app)
 {
        g_autoptr(GFile) file = NULL;
-       g_autofree gchar *theme = NULL;
 
-       g_object_get (settings, "gtk-theme-name", &theme, NULL);
-       if (g_strcmp0 (theme, "HighContrast") == 0) {
+       if (adw_style_manager_get_high_contrast (manager)) {
                file = g_file_new_for_uri ("resource:///org/gnome/Software/gtk-style-hc.css");
        } else {
                file = g_file_new_for_uri ("resource:///org/gnome/Software/gtk-style.css");
@@ -274,9 +272,9 @@ gs_application_initialize_ui (GsApplication *app)
                                                    GTK_STYLE_PROVIDER (app->provider),
                                                    GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
 
-       g_signal_connect (gtk_settings_get_default (), "notify::gtk-theme-name",
-                         G_CALLBACK (theme_changed), app);
-       theme_changed (gtk_settings_get_default (), NULL, app);
+       g_signal_connect (adw_style_manager_get_default (), "notify::high-contrast",
+                         G_CALLBACK (hc_changed), app);
+       hc_changed (adw_style_manager_get_default (), NULL, app);
 
        gs_application_initialize_plugins (app);
 


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