[gnome-panel] theme: add fallback css for GpImageMenuItem



commit e6f1541149bb380e66578e0c8a2a29a9dae3fd36
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Fri Apr 20 13:22:36 2018 +0300

    theme: add fallback css for GpImageMenuItem

 data/theme/Makefile.am          |    1 +
 data/theme/fallback.css         |   32 ++++++++++++++++++++++++++++++++
 gnome-panel/main.c              |   23 ++++++++++++-----------
 gnome-panel/panel.gresource.xml |    1 +
 4 files changed, 46 insertions(+), 11 deletions(-)
---
diff --git a/data/theme/Makefile.am b/data/theme/Makefile.am
index e2e06b0..6acf821 100644
--- a/data/theme/Makefile.am
+++ b/data/theme/Makefile.am
@@ -7,6 +7,7 @@ SUBDIRS = \
 
 EXTRA_DIST = \
        common.css \
+       fallback.css \
        $(NULL)
 
 -include $(top_srcdir)/git.mk
diff --git a/data/theme/fallback.css b/data/theme/fallback.css
new file mode 100644
index 0000000..c170c43
--- /dev/null
+++ b/data/theme/fallback.css
@@ -0,0 +1,32 @@
+.gp-image-menu-item > image {
+  min-height: 16px;
+  min-width: 16px;
+}
+
+.gp-image-menu-item > image:dir(ltr) {
+  margin-right: 5px;
+}
+
+.gp-image-menu-item > image:dir(rtl) {
+  margin-left: 5px;
+}
+
+panel-toplevel.left gp-applet > menubar > .gp-image-menu-item > image:dir(ltr) {
+  margin-right: 0px;
+  margin-top: 5px;
+}
+
+panel-toplevel.left gp-applet > menubar > .gp-image-menu-item > image:dir(rtl) {
+  margin-left: 0px;
+  margin-bottom: 5px;
+}
+
+panel-toplevel.right gp-applet > menubar > .gp-image-menu-item > image:dir(ltr) {
+  margin-right: 0px;
+  margin-bottom: 5px;
+}
+
+panel-toplevel.right gp-applet > menubar > .gp-image-menu-item > image:dir(rtl) {
+  margin-left: 0px;
+  margin-top: 5px;
+}
diff --git a/gnome-panel/main.c b/gnome-panel/main.c
index 3f3ad06..1336202 100644
--- a/gnome-panel/main.c
+++ b/gnome-panel/main.c
@@ -58,22 +58,23 @@ theme_changed (GtkSettings *settings,
       g_clear_object (&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-panel/theme/fallback.css");
+    }
+  else
+    {
+      priority = GTK_STYLE_PROVIDER_PRIORITY_APPLICATION;
+      resource = g_strdup_printf ("/org/gnome/gnome-panel/theme/%s/gnome-panel%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-panel/theme/%s/gnome-panel%s.css",
-                              theme_name, dark_theme ? "-dark" : "");
 
   css = gtk_css_provider_new ();
   provider = GTK_STYLE_PROVIDER (css);
diff --git a/gnome-panel/panel.gresource.xml b/gnome-panel/panel.gresource.xml
index 52de2aa..784b49a 100644
--- a/gnome-panel/panel.gresource.xml
+++ b/gnome-panel/panel.gresource.xml
@@ -6,6 +6,7 @@
     <file alias="HighContrast/gnome-panel.css">../data/theme/HighContrast/gnome-panel.css</file>
     <file alias="HighContrast/gnome-panel-dark.css">../data/theme/HighContrast/gnome-panel-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/panel">
     <file compressed="true">gp-properties-dialog.ui</file>


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