[gnome-builder] theme: fallback to shared.css if no theme resource was discovered



commit b23b5288289637ff6942d4bcc7cd18e0ca09ef67
Author: Christian Hergert <christian hergert me>
Date:   Thu May 21 16:24:12 2015 -0700

    theme: fallback to shared.css if no theme resource was discovered
    
    If we failed to locate a theme specific resource, fallback to our base
    shared.css with mostly theme agnostic additions.

 src/css/gb-css-provider.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/src/css/gb-css-provider.c b/src/css/gb-css-provider.c
index a9a5bc1..540ce2c 100644
--- a/src/css/gb-css-provider.c
+++ b/src/css/gb-css-provider.c
@@ -45,6 +45,8 @@ gb_css_provider_update (GbCssProvider *self)
   g_autofree gchar *theme_name = NULL;
   g_autofree gchar *resource_path = NULL;
   gboolean prefer_dark_theme = FALSE;
+  gsize len = 0;
+  guint32 flags = 0;
 
   IDE_ENTRY;
 
@@ -60,6 +62,12 @@ gb_css_provider_update (GbCssProvider *self)
                                    theme_name,
                                    prefer_dark_theme ? "-dark" : "");
 
+  if (!g_resources_get_info (resource_path, G_RESOURCE_LOOKUP_FLAGS_NONE, &len, &flags, NULL))
+    {
+      g_free (resource_path);
+      resource_path = g_strdup ("/org/gnome/builder/theme/shared.css");
+    }
+
   gtk_css_provider_load_from_resource (GTK_CSS_PROVIDER (self), resource_path);
 
   IDE_EXIT;


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