[gnome-builder] editor: start playing with a new style scheme



commit eb6c1094d868f4c061d19a0150247d4d2d520ab7
Author: Christian Hergert <christian hergert me>
Date:   Wed Nov 12 21:53:53 2014 -0800

    editor: start playing with a new style scheme

 data/data.mk             |    5 ++
 data/styles/builder.xml  |  132 ++++++++++++++++++++++++++++++++++++++++++++++
 src/app/gb-application.c |   15 +++++-
 src/gnome-builder.mk     |    1 +
 4 files changed, 152 insertions(+), 1 deletions(-)
---
diff --git a/data/data.mk b/data/data.mk
index 9f0848b..2678992 100644
--- a/data/data.mk
+++ b/data/data.mk
@@ -10,3 +10,8 @@ service_in_files = data/org.gnome.Builder.service.in
 service_DATA = $(service_in_files:.service.in=.service)
 EXTRA_DIST += $(service_in_files)
 CLEANFILES += $(service_DATA)
+
+# GtkSourceView Style Scheme
+styledir = $(datadir)/gtksourceview-3.0/styles/
+style_DATA = data/styles/builder.xml
+EXTRA_DIST += $(style_DATA)
diff --git a/data/styles/builder.xml b/data/styles/builder.xml
new file mode 100644
index 0000000..05b0969
--- /dev/null
+++ b/data/styles/builder.xml
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ This file is part of Builder
+
+  Copyright (C) 2014 Christian Hergert <christian hergert me>
+                                                                      
+  This program is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+                                                                      
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+                                                                      
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+-->
+<style-scheme id="builder" _name="Builder" version="1.0">
+  <author>Christian Hergert</author>
+  <_description>The default color scheme for Builder.</_description>
+
+  <!-- Tango Palette -->
+  <color name="bg1" value="#f6f7f8"/>
+  <color name="bg2" value="#f0f1f2"/>
+  <color name="og1" value="#d75d1b"/>
+  <color name="gr1" value="#709831"/>
+  <color name="brown1" value="#a67f59"/>
+  <color name="blue1" value="#708090"/>
+  <color name="blue2" value="#0077aa"/>
+  <color name="purple1" value="#990055"/>
+  <color name="pink1" value="#dd4a68"/>
+  <color name="green1" value="#669900"/>
+  <color name="text1" value="#4d4e53"/>
+  <color name="line1" value="#a2a3a3"/>
+
+  <color name="butter1"                     value="#fce94f"/>
+  <color name="butter2"                     value="#edd400"/>
+  <color name="butter3"                     value="#c4a000"/>
+  <color name="chameleon1"                  value="#8ae234"/>
+  <color name="chameleon2"                  value="#73d216"/>
+  <color name="chameleon3"                  value="#4e9a06"/>
+  <color name="orange1"                     value="#fcaf3e"/>
+  <color name="orange2"                     value="#f57900"/>
+  <color name="orange3"                     value="#ce5c00"/>
+  <color name="skyblue1"                    value="#729fcf"/>
+  <color name="skyblue2"                    value="#3465a4"/>
+  <color name="skyblue3"                    value="#204a87"/>
+  <color name="plum1"                       value="#ad7fa8"/>
+  <color name="plum2"                       value="#75507b"/>
+  <color name="plum3"                       value="#5c3566"/>
+  <color name="chocolate1"                  value="#e9b96e"/>
+  <color name="chocolate2"                  value="#c17d11"/>
+  <color name="chocolate3"                  value="#8f5902"/>
+  <color name="scarletred1"                 value="#ef2929"/>
+  <color name="scarletred2"                 value="#cc0000"/>
+  <color name="scarletred3"                 value="#a40000"/>
+  <color name="aluminium1"                  value="#eeeeec"/>
+  <color name="aluminium2"                  value="#d3d7cf"/>
+  <color name="aluminium3"                  value="#babdb6"/>
+  <color name="aluminium4"                  value="#888a85"/>
+  <color name="aluminium5"                  value="#555753"/>
+  <color name="aluminium6"                  value="#2e3436"/>
+
+  <!-- Global Settings -->
+  <style name="text"                        foreground="text1" background="bg1"/>
+  <style name="cursor"                      foreground="aluminium4"/>
+  <style name="current-line"                background="aluminium1"/>
+  <style name="draw-spaces"                 foreground="aluminium3"/>
+  <style name="line-numbers"                foreground="line1" background="bg1"/>
+
+  <!-- Bracket Matching -->
+  <style name="bracket-match"               foreground="aluminium3" background="aluminium1" bold="true"/>
+  <style name="bracket-mismatch"            foreground="aluminium1" background="scarletred3" bold="true"/>
+
+  <!-- Right Margin -->
+  <style name="right-margin"                foreground="aluminium3" background="bg2"/>
+
+  <!-- Search Matching -->
+  <style name="search-match"                background="butter1"/>
+
+  <!-- Comments -->
+  <style name="def:comment"                 foreground="blue1"/>
+  <style name="def:shebang"                 foreground="blue1" bold="true"/>
+  <style name="def:doc-comment-element"     italic="true"/>
+
+  <!-- Constants -->
+  <style name="def:constant"                foreground="blue2"/>
+  <style name="def:special-char"            foreground="skyblue3"/>
+
+  <!-- Identifiers -->
+  <style name="def:identifier"              foreground="skyblue2"/>
+
+  <!-- Statements -->
+  <style name="def:statement"               foreground="green1" bold="true"/>
+
+  <!-- Types -->
+  <style name="def:type"                    foreground="gr1" bold="true"/>
+
+  <!-- Others -->
+  <style name="def:preprocessor"            foreground="pink1"/>
+  <style name="def:error"                   background="scarletred2" bold="true"/>
+  <style name="def:warning"                 background="plum1"/>
+  <style name="def:note"                    background="orange1" bold="true"/>
+  <style name="def:underlined"              italic="true" underline="true"/>
+
+  <!-- Language specific -->
+  <style name="diff:added-line"             foreground="chameleon3"/>
+  <style name="diff:removed-line"           foreground="plum3"/>
+  <style name="diff:changed-line"           use-style="def:preprocessor"/>
+  <style name="diff:diff-file"              use-style="def:type"/>
+  <style name="diff:location"               use-style="def:statement"/>
+  <style name="diff:special-case"           use-style="def:constant"/>
+
+  <style name="xml:tags"                    foreground="chameleon3"/>
+  <style name="xml:namespace"               bold="true"/>
+
+  <style name="js:object"                   foreground="chameleon3" bold="true"/>
+  <style name="js:constructors"             foreground="chameleon3"/>
+
+  <style name="latex:display-math"          foreground="plum3"/>
+  <style name="latex:command"               foreground="chameleon3" bold="true"/>
+  <style name="latex:include"               use-style="def:preprocessor"/>
+  <style name="latex:special-char"          use-style="def:constant"/>
+
+  <style name="sh:variable"                 foreground="plum3"/>
+  <style name="sh:variable-definition"      foreground="chameleon3"/>
+
+</style-scheme>
diff --git a/src/app/gb-application.c b/src/app/gb-application.c
index 13f7d6a..5201e91 100644
--- a/src/app/gb-application.c
+++ b/src/app/gb-application.c
@@ -17,13 +17,13 @@
  */
 
 #define G_LOG_DOMAIN "app"
-#define ADWAITA_CSS  "resource:///org/gnome/builder/css/builder.Adwaita.css"
 
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
 
 #include <glib/gi18n.h>
+#include <gtksourceview/gtksource.h>
 
 #include "gb-application.h"
 #include "gb-editor-file-marks.h"
@@ -34,12 +34,24 @@
 #include "gb-resources.h"
 #include "gb-workbench.h"
 
+#define ADWAITA_CSS  "resource:///org/gnome/builder/css/builder.Adwaita.css"
 #define LANGUAGE_SCHEMA "org.gnome.builder.editor.language"
 #define LANGUAGE_PATH "/org/gnome/builder/editor/language/"
+#define GSV_PATH "resource:///org/gnome/builder/styles/"
 
 G_DEFINE_TYPE (GbApplication, gb_application, GTK_TYPE_APPLICATION)
 
 static void
+gb_application_setup_search_paths (void)
+{
+  GtkSourceStyleSchemeManager *mgr;
+
+  mgr = gtk_source_style_scheme_manager_get_default ();
+  gtk_source_style_scheme_manager_append_search_path (
+      mgr, PACKAGE_DATADIR"/gtksourceview-3.0/styles/");
+}
+
+static void
 gb_application_install_language_defaults (GbApplication *self)
 {
   gchar *defaults_installed_path;
@@ -512,6 +524,7 @@ gb_application_startup (GApplication *app)
   gb_application_register_keybindings (self);
   gb_application_register_theme_overrides (self);
   gb_application_load_file_marks (self);
+  gb_application_setup_search_paths ();
 
   EXIT;
 }
diff --git a/src/gnome-builder.mk b/src/gnome-builder.mk
index eb2b730..483bc69 100644
--- a/src/gnome-builder.mk
+++ b/src/gnome-builder.mk
@@ -177,6 +177,7 @@ libgnome_builder_la_LIBADD = \
        -lm
 
 libgnome_builder_la_CFLAGS = \
+       -DPACKAGE_DATADIR="\"$(datadir)\"" \
        $(DEVHELP_CFLAGS) \
        $(GGIT_CFLAGS) \
        $(GIO_CFLAGS) \


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