[gnome-flashback] theme: add empty common and fallback css files



commit df00c83d681022169cc49d7873998f13741415ce
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Sun Dec 1 16:56:26 2019 +0200

    theme: add empty common and fallback css files

 data/theme/Adwaita/gnome-flashback-dark.css |  2 ++
 data/theme/Adwaita/gnome-flashback.css      |  2 ++
 data/theme/HighContrast/gnome-flashback.css |  2 ++
 data/theme/Makefile.am                      |  5 +++++
 data/theme/common.css                       |  0
 data/theme/fallback.css                     |  0
 gnome-flashback/flashback.gresource.xml     |  2 ++
 gnome-flashback/gf-application.c            | 23 ++++++++++++-----------
 8 files changed, 25 insertions(+), 11 deletions(-)
---
diff --git a/data/theme/Adwaita/gnome-flashback-dark.css b/data/theme/Adwaita/gnome-flashback-dark.css
index ed37af5..95a494b 100644
--- a/data/theme/Adwaita/gnome-flashback-dark.css
+++ b/data/theme/Adwaita/gnome-flashback-dark.css
@@ -1,3 +1,5 @@
+@import url("resource:///org/gnome/gnome-flashback/theme/common.css");
+
 gf-popup-window {
   background-color: #393f3f;
   color: #eeeeec;
diff --git a/data/theme/Adwaita/gnome-flashback.css b/data/theme/Adwaita/gnome-flashback.css
index 3013e88..6813e85 100644
--- a/data/theme/Adwaita/gnome-flashback.css
+++ b/data/theme/Adwaita/gnome-flashback.css
@@ -1,3 +1,5 @@
+@import url("resource:///org/gnome/gnome-flashback/theme/common.css");
+
 gf-popup-window {
   background-color: #e8e8e7;
   color: #2e3436;
diff --git a/data/theme/HighContrast/gnome-flashback.css b/data/theme/HighContrast/gnome-flashback.css
index e8a4d0b..76da8a4 100644
--- a/data/theme/HighContrast/gnome-flashback.css
+++ b/data/theme/HighContrast/gnome-flashback.css
@@ -1,3 +1,5 @@
+@import url("resource:///org/gnome/gnome-flashback/theme/common.css");
+
 gf-popup-window {
   background-color: #ffffff;
   color: #000000;
diff --git a/data/theme/Makefile.am b/data/theme/Makefile.am
index 9765ab1..6acf821 100644
--- a/data/theme/Makefile.am
+++ b/data/theme/Makefile.am
@@ -5,4 +5,9 @@ SUBDIRS = \
        HighContrast \
        $(NULL)
 
+EXTRA_DIST = \
+       common.css \
+       fallback.css \
+       $(NULL)
+
 -include $(top_srcdir)/git.mk
diff --git a/data/theme/common.css b/data/theme/common.css
new file mode 100644
index 0000000..e69de29
diff --git a/data/theme/fallback.css b/data/theme/fallback.css
new file mode 100644
index 0000000..e69de29
diff --git a/gnome-flashback/flashback.gresource.xml b/gnome-flashback/flashback.gresource.xml
index 2452385..83f2b5b 100644
--- a/gnome-flashback/flashback.gresource.xml
+++ b/gnome-flashback/flashback.gresource.xml
@@ -5,6 +5,8 @@
     <file alias="Adwaita/gnome-flashback-dark.css">../data/theme/Adwaita/gnome-flashback-dark.css</file>
     <file alias="HighContrast/gnome-flashback.css">../data/theme/HighContrast/gnome-flashback.css</file>
     <file 
alias="HighContrast/gnome-flashback-dark.css">../data/theme/HighContrast/gnome-flashback-dark.css</file>
+    <file alias="common.css">../data/theme/common.css</file>
+    <file alias="fallback.css">../data/theme/fallback.css</file>
   </gresource>
   <gresource prefix="/org/gnome/gnome-flashback/ui">
     <file alias="gf-confirm-display-change-dialog.ui" 
compressed="true">../data/ui/gf-confirm-display-change-dialog.ui</file>
diff --git a/gnome-flashback/gf-application.c b/gnome-flashback/gf-application.c
index adce520..80d9d05 100644
--- a/gnome-flashback/gf-application.c
+++ b/gnome-flashback/gf-application.c
@@ -104,22 +104,23 @@ theme_changed (GtkSettings *settings,
       g_clear_object (&application->provider);
     }
 
-  g_object_get (settings, "gtk-theme-name", &theme_name, NULL);
+  g_object_get (settings,
+                "gtk-theme-name", &theme_name,
+                "gtk-application-prefer-dark-theme", &dark_theme,
+                NULL);
 
   if (g_strcmp0 (theme_name, "Adwaita") != 0 &&
       g_strcmp0 (theme_name, "HighContrast") != 0)
     {
-      g_free (theme_name);
-      return;
+      priority = GTK_STYLE_PROVIDER_PRIORITY_FALLBACK;
+      resource = g_strdup ("/org/gnome/gnome-flashback/theme/fallback.css");
+    }
+  else
+    {
+      priority = GTK_STYLE_PROVIDER_PRIORITY_APPLICATION;
+      resource = g_strdup_printf ("/org/gnome/gnome-flashback/theme/%s/gnome-flashback%s.css",
+                                  theme_name, dark_theme ? "-dark" : "");
     }
-
-  g_object_get (settings,
-                "gtk-application-prefer-dark-theme", &dark_theme,
-                NULL);
-
-  priority = GTK_STYLE_PROVIDER_PRIORITY_APPLICATION;
-  resource = g_strdup_printf ("/org/gnome/gnome-flashback/theme/%s/gnome-flashback%s.css",
-                              theme_name, dark_theme ? "-dark" : "");
 
   css = gtk_css_provider_new ();
   application->provider =  GTK_STYLE_PROVIDER (css);


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