[gnome-builder] minimap: allow overriding the overlay color in style scheme



commit b2b589623dd1bfb8eabfb958fca1f3b175a1d54e
Author: Christian Hergert <christian hergert me>
Date:   Fri Apr 24 18:29:33 2015 -0700

    minimap: allow overriding the overlay color in style scheme

 data/style-schemes/builder.xml |    1 +
 libide/ide-source-map.c        |   43 +++++++++++++++++++--------------------
 2 files changed, 22 insertions(+), 22 deletions(-)
---
diff --git a/data/style-schemes/builder.xml b/data/style-schemes/builder.xml
index cc21146..f427f26 100644
--- a/data/style-schemes/builder.xml
+++ b/data/style-schemes/builder.xml
@@ -72,6 +72,7 @@
   <!-- Global Settings -->
   <style name="text"                        foreground="text1" background="bg1"/>
   <style name="selection"                   background="selection1"/>
+  <style name="map-overlay"                 background="#C1CBD2"/>
   <style name="cursor"                      foreground="aluminium4"/>
   <style name="current-line"                background="#rgba(238,238,236,.75)"/>
   <style name="current-line-number"         background="#rgba(238,238,236,.75)"/>
diff --git a/libide/ide-source-map.c b/libide/ide-source-map.c
index d8399bc..d90c194 100644
--- a/libide/ide-source-map.c
+++ b/libide/ide-source-map.c
@@ -88,32 +88,31 @@ ide_source_map_rebuild_css (IdeSourceMap *self)
 
       if (style_scheme != NULL)
         {
+          g_autofree gchar *background = NULL;
           GtkSourceStyle *style;
 
-          style = gtk_source_style_scheme_get_style (style_scheme, "selection");
+          if (!(style = gtk_source_style_scheme_get_style (style_scheme, "map-overlay")) &&
+              !(style = gtk_source_style_scheme_get_style (style_scheme, "selection")))
+            return;
 
-          if (style != NULL)
+
+          g_object_get (style,
+                        "background", &background,
+                        NULL);
+
+          if (background != NULL)
             {
-              g_autofree gchar *background = NULL;
-
-              g_object_get (style,
-                            "background", &background,
-                            NULL);
-
-              if (background != NULL)
-                {
-                  gchar *css;
-
-                  css = g_strdup_printf ("IdeSourceMap GtkEventBox { "
-                                         "  background-color: %s;"
-                                         "  opacity: 0.75;"
-                                         "  border-top: 1px solid shade(%s,0.9); "
-                                         "  border-bottom: 1px solid shade(%s,0.9); "
-                                         "}\n",
-                                         background, background, background);
-                  gtk_css_provider_load_from_data (self->box_css_provider, css, -1, NULL);
-                  g_free (css);
-                }
+              gchar *css;
+
+              css = g_strdup_printf ("IdeSourceMap GtkEventBox { "
+                                     "  background-color: %s;"
+                                     "  opacity: 0.75;"
+                                     "  border-top: 1px solid shade(%s,0.9); "
+                                     "  border-bottom: 1px solid shade(%s,0.9); "
+                                     "}\n",
+                                     background, background, background);
+              gtk_css_provider_load_from_data (self->box_css_provider, css, -1, NULL);
+              g_free (css);
             }
         }
     }


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