[sysprof/wip/gtk4-port: 113/125] css: adjust priority and remove old css




commit 906691b46797fe00a7de53d73852058e7eef5bd3
Author: Christian Hergert <chergert redhat com>
Date:   Fri Oct 1 15:01:31 2021 -0700

    css: adjust priority and remove old css
    
    Also set "devel" css when necessary.

 src/libsysprof-ui/sysprof-theme-manager.c |  2 +-
 src/sysprof/sysprof-application.c         | 30 ++++++++++++++++++------------
 src/sysprof/sysprof.gresource.xml         |  1 -
 src/sysprof/theme/shared.css              | 13 -------------
 4 files changed, 19 insertions(+), 27 deletions(-)
---
diff --git a/src/libsysprof-ui/sysprof-theme-manager.c b/src/libsysprof-ui/sysprof-theme-manager.c
index 4389d296..3c07b27d 100644
--- a/src/libsysprof-ui/sysprof-theme-manager.c
+++ b/src/libsysprof-ui/sysprof-theme-manager.c
@@ -123,7 +123,7 @@ sysprof_theme_manager_do_reload (gpointer data)
               gtk_css_provider_load_from_resource (theme_resource->provider, theme_resource->resource);
               gtk_style_context_add_provider_for_display (gdk_display_get_default (),
                                                           GTK_STYLE_PROVIDER (theme_resource->provider),
-                                                          GTK_STYLE_PROVIDER_PRIORITY_APPLICATION - 1);
+                                                          GTK_STYLE_PROVIDER_PRIORITY_THEME+1);
             }
         }
       else
diff --git a/src/sysprof/sysprof-application.c b/src/sysprof/sysprof-application.c
index 22b0b16b..d0d045ee 100644
--- a/src/sysprof/sysprof-application.c
+++ b/src/sysprof/sysprof-application.c
@@ -110,9 +110,6 @@ static void
 sysprof_application_startup (GApplication *application)
 {
   g_autoptr(GtkCssProvider) provider = NULL;
-#ifdef DEVELOPMENT_BUILD
-  g_autoptr(GtkCssProvider) adwaita = NULL;
-#endif
 
   g_assert (SYSPROF_IS_APPLICATION (application));
 
@@ -122,15 +119,7 @@ sysprof_application_startup (GApplication *application)
   gtk_css_provider_load_from_resource (provider, "/org/gnome/sysprof/theme/shared.css");
   gtk_style_context_add_provider_for_display (gdk_display_get_default (),
                                               GTK_STYLE_PROVIDER (provider),
-                                              GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
-
-#ifdef DEVELOPMENT_BUILD
-  adwaita = gtk_css_provider_new ();
-  gtk_css_provider_load_from_resource (adwaita, "/org/gnome/sysprof/theme/Adwaita-shared.css");
-  gtk_style_context_add_provider_for_display (gdk_display_get_default (),
-                                              GTK_STYLE_PROVIDER (adwaita),
-                                              GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
-#endif
+                                              GTK_STYLE_PROVIDER_PRIORITY_THEME+1);
 
   for (guint i = 0; default_accels[i].action_name; i++)
     gtk_application_set_accels_for_action (GTK_APPLICATION (application),
@@ -138,14 +127,31 @@ sysprof_application_startup (GApplication *application)
                                            default_accels[i].accels);
 }
 
+static void
+sysprof_application_window_added (GtkApplication *application,
+                                  GtkWindow      *window)
+{
+  g_assert (SYSPROF_IS_APPLICATION (application));
+  g_assert (GTK_IS_WINDOW (window));
+
+#ifdef DEVELOPMENT_BUILD
+  gtk_widget_add_css_class (GTK_WIDGET (window), "devel");
+#endif
+
+  GTK_APPLICATION_CLASS (sysprof_application_parent_class)->window_added (application, window);
+}
+
 static void
 sysprof_application_class_init (SysprofApplicationClass *klass)
 {
   GApplicationClass *app_class = G_APPLICATION_CLASS (klass);
+  GtkApplicationClass *gtk_app_class = GTK_APPLICATION_CLASS (klass);
 
   app_class->open = sysprof_application_open;
   app_class->startup = sysprof_application_startup;
   app_class->activate = sysprof_application_activate;
+
+  gtk_app_class->window_added = sysprof_application_window_added;
 }
 
 static void
diff --git a/src/sysprof/sysprof.gresource.xml b/src/sysprof/sysprof.gresource.xml
index a9a20482..faee1ac4 100644
--- a/src/sysprof/sysprof.gresource.xml
+++ b/src/sysprof/sysprof.gresource.xml
@@ -7,7 +7,6 @@
 
     <!-- Theme overrides -->
     <file compressed="true">theme/shared.css</file>
-    <file compressed="true">theme/Adwaita-shared.css</file>
   </gresource>
 
   <gresource prefix="/org/gnome/sysprof/ui">
diff --git a/src/sysprof/theme/shared.css b/src/sysprof/theme/shared.css
index 66495490..878dcb69 100644
--- a/src/sysprof/theme/shared.css
+++ b/src/sysprof/theme/shared.css
@@ -1,16 +1,3 @@
-popover list row {
-  padding: 6px 10px 6px 10px;
-  border-bottom: 1px solid alpha(@borders, 0.2);
-}
-
-popover list row:last-child {
-  border-bottom: none;
-}
-
-popover scrolledwindow {
-  border-top: 1px solid alpha(@borders, 0.75);
-}
-
 visualizers list {
   background: @theme_bg_color;
 }


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