[gnome-builder] buffer: make warning underline color check dynamic
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] buffer: make warning underline color check dynamic
- Date: Fri, 27 Mar 2015 08:21:46 +0000 (UTC)
commit 13c233e83de893836940e17805540755bc2a3448
Author: Christian Hergert <christian hergert me>
Date: Fri Mar 27 01:08:03 2015 -0700
buffer: make warning underline color check dynamic
libide/ide-buffer.c | 46 +++++++++++++++++++++++++++++++++-------------
1 files changed, 33 insertions(+), 13 deletions(-)
---
diff --git a/libide/ide-buffer.c b/libide/ide-buffer.c
index de0484c..2382a1f 100644
--- a/libide/ide-buffer.c
+++ b/libide/ide-buffer.c
@@ -715,34 +715,54 @@ ide_buffer_mark_set (GtkTextBuffer *buffer,
ide_buffer_emit_cursor_moved (IDE_BUFFER (buffer));
}
+static gboolean
+ide_buffer_check_underline_rgba (void)
+{
+ static gboolean did_check;
+ static gboolean has_underline_rgba;
+
+ if (!did_check)
+ {
+ GObjectClass *type_class;
+ GParamSpec *pspec;
+
+ type_class = g_type_class_ref (GTK_TYPE_TEXT_TAG);
+ pspec = g_object_class_find_property (type_class, "underline-rgba");
+ has_underline_rgba = (pspec != NULL) && (pspec->value_type == GDK_TYPE_RGBA);
+ g_type_class_unref (type_class);
+ did_check = TRUE;
+ }
+
+ return has_underline_rgba;
+}
+
static void
ide_buffer_constructed (GObject *object)
{
IdeBuffer *self = (IdeBuffer *)object;
IdeBufferPrivate *priv = ide_buffer_get_instance_private (self);
-#if GTK_CHECK_VERSION(3, 16, 1)
- GdkRGBA warning_rgba;
-#endif
+ GtkTextTag *warning_tag;
G_OBJECT_CLASS (ide_buffer_parent_class)->constructed (object);
-#if GTK_CHECK_VERSION(3, 16, 1)
- gdk_rgba_parse (&warning_rgba, "#fcaf3e");
-#endif
-
gtk_text_buffer_create_tag (GTK_TEXT_BUFFER (self), TAG_ERROR,
"underline", PANGO_UNDERLINE_ERROR,
NULL);
- gtk_text_buffer_create_tag (GTK_TEXT_BUFFER (self), TAG_WARNING,
- "underline", PANGO_UNDERLINE_ERROR,
-#if GTK_CHECK_VERSION (3, 16, 1)
- "underline-rgba", &warning_rgba,
-#endif
- NULL);
gtk_text_buffer_create_tag (GTK_TEXT_BUFFER (self), TAG_NOTE,
"underline", PANGO_UNDERLINE_SINGLE,
NULL);
+ warning_tag = gtk_text_buffer_create_tag (GTK_TEXT_BUFFER (self), TAG_WARNING,
+ "underline", PANGO_UNDERLINE_ERROR,
+ NULL);
+ if (ide_buffer_check_underline_rgba ())
+ {
+ GdkRGBA warning_rgba;
+
+ gdk_rgba_parse (&warning_rgba, "#fcaf3e");
+ g_object_set (warning_tag, "underline-rgba", &warning_rgba, NULL);
+ }
+
priv->highlight_engine = ide_highlight_engine_new (self);
ide_buffer_reload_highlighter (self);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]