[gnome-builder] highlight: add some fallback lookup paths for styles that don't exist
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] highlight: add some fallback lookup paths for styles that don't exist
- Date: Fri, 27 Mar 2015 03:52:11 +0000 (UTC)
commit d7bb6623f2c70ae6d0d7b307491cde49b51cd8a8
Author: Christian Hergert <christian hergert me>
Date: Thu Mar 26 20:50:47 2015 -0700
highlight: add some fallback lookup paths for styles that don't exist
libide/ide-highlight-engine.c | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/libide/ide-highlight-engine.c b/libide/ide-highlight-engine.c
index a45a099..441ef22 100644
--- a/libide/ide-highlight-engine.c
+++ b/libide/ide-highlight-engine.c
@@ -63,6 +63,7 @@ sync_tag_style (GtkSourceStyleScheme *style_scheme,
g_autofree gchar *foreground = NULL;
g_autofree gchar *background = NULL;
g_autofree gchar *style_name = NULL;
+ const gchar *colon;
GtkSourceStyle *style;
gboolean foreground_set = FALSE;
gboolean background_set = FALSE;
@@ -83,11 +84,19 @@ sync_tag_style (GtkSourceStyleScheme *style_scheme,
g_object_get (tag, "name", &style_name, NULL);
- if ((style_name == NULL) ||
- (style_scheme == NULL) ||
- !(style = gtk_source_style_scheme_get_style (style_scheme, style_name)))
+ if ((style_name == NULL) || (style_scheme == NULL))
return;
+ style = gtk_source_style_scheme_get_style (style_scheme, style_name);
+ if (style == NULL && (colon = strchr (style_name, ':')))
+ {
+ gchar defname[64];
+ g_snprintf (defname, sizeof defname, "def%s", colon);
+ style = gtk_source_style_scheme_get_style (style_scheme, defname);
+ if (style == NULL)
+ return;
+ }
+
g_object_get (style,
"background", &background,
"background-set", &background_set,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]