summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Blanchard <tchaik@gmx.com>2019-03-17 13:00:32 +0000
committerMartin Blanchard <tchaik@gmx.com>2019-03-17 13:30:01 +0000
commitc7de780ebe9dcf32db95f9462d0cb805a83e0665 (patch)
tree4c79725a4392d65aa14549f20f50685196f71782
parent1cc72f649b4e0d5ff74f3e346bf3e008b8f4ef4e (diff)
downloadgedit-tchaik/adwaita-css-fallback.tar.gz
theme: Always use Adwaita specifics as fallbacktchaik/adwaita-css-fallback
Load shared and OS specific CSS resources first and fallback to Adwaita if no other theme specifics are found.
-rw-r--r--gedit/gedit-app.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/gedit/gedit-app.c b/gedit/gedit-app.c
index 24693e585..a09709ed4 100644
--- a/gedit/gedit-app.c
+++ b/gedit/gedit-app.c
@@ -678,6 +678,7 @@ theme_changed (GtkSettings *settings,
GeditApp *app)
{
GeditAppPrivate *priv;
+ GtkCssProvider *theme_provider;
priv = gedit_app_get_instance_private (app);
@@ -697,7 +698,13 @@ theme_changed (GtkSettings *settings,
g_clear_object (&priv->theme_provider);
}
- priv->theme_provider = load_css_from_resource (theme_css, FALSE);
+ theme_provider = load_css_from_resource (theme_css, FALSE);
+ if (theme_provider == NULL)
+ {
+ theme_provider = load_css_from_resource ("gedit.adwaita.css", TRUE);
+ }
+
+ priv->theme_provider = theme_provider;
g_free (theme_css);
}
@@ -754,7 +761,6 @@ static void
gedit_app_startup (GApplication *application)
{
GeditAppPrivate *priv;
- GtkCssProvider *css_provider;
GtkSourceStyleSchemeManager *manager;
#ifndef ENABLE_GVFS_METADATA
const gchar *cache_dir;
@@ -769,8 +775,6 @@ gedit_app_startup (GApplication *application)
gedit_debug_init ();
gedit_debug_message (DEBUG_APP, "Startup");
- setup_theme_extensions (GEDIT_APP (application));
-
#ifndef ENABLE_GVFS_METADATA
cache_dir = gedit_dirs_get_user_cache_dir ();
metadata_filename = g_build_filename (cache_dir, "gedit-metadata.xml", NULL);
@@ -838,8 +842,9 @@ gedit_app_startup (GApplication *application)
/* Load custom css */
g_object_unref (load_css_from_resource ("gedit-style.css", TRUE));
- css_provider = load_css_from_resource ("gedit-style-os.css", FALSE);
- g_clear_object (&css_provider);
+ g_object_unref (load_css_from_resource ("gedit-style-os.css", FALSE));
+
+ setup_theme_extensions (GEDIT_APP (application));
/*
* We use the default gtksourceview style scheme manager so that plugins