[gnome-builder] source-view: move definition tag creation to IdeBuffer
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] source-view: move definition tag creation to IdeBuffer
- Date: Tue, 8 Mar 2016 06:40:26 +0000 (UTC)
commit 436a2a3eb6c196908e8f15366e7df1ac023e9fe4
Author: Christian Hergert <christian hergert me>
Date: Mon Mar 7 22:39:49 2016 -0800
source-view: move definition tag creation to IdeBuffer
This should only be done once per buffer anyway, and we want to sync the
style when the style scheme changes.
libide/ide-buffer.c | 29 +++++++++++++++++++++++++++++
libide/ide-source-view.c | 4 ----
2 files changed, 29 insertions(+), 4 deletions(-)
---
diff --git a/libide/ide-buffer.c b/libide/ide-buffer.c
index 53f17ef..9f2a9d3 100644
--- a/libide/ide-buffer.c
+++ b/libide/ide-buffer.c
@@ -56,6 +56,7 @@
#define TAG_DEPRECATED "diagnostician::deprecated"
#define TAG_NOTE "diagnostician::note"
#define TAG_SNIPPET_TAB_STOP "snippet::tab-stop"
+#define TAG_DEFINITION "action::hover-definition"
typedef struct
{
@@ -920,6 +921,24 @@ ide_buffer_notify_language (IdeBuffer *self,
}
static void
+apply_style (GtkTextTag *tag,
+ const gchar *first_property,
+ ...)
+{
+ va_list args;
+
+ g_assert (!tag || GTK_IS_TEXT_TAG (tag));
+ g_assert (first_property != NULL);
+
+ if (tag == NULL)
+ return;
+
+ va_start (args, first_property);
+ g_object_set_valist (G_OBJECT (tag), first_property, args);
+ va_end (args);
+}
+
+static void
ide_buffer_notify_style_scheme (IdeBuffer *self,
GParamSpec *pspec,
gpointer unused)
@@ -940,6 +959,13 @@ ide_buffer_notify_style_scheme (IdeBuffer *self,
ide_source_style_scheme_apply_style (style_scheme,
TAG_SNIPPET_TAB_STOP,
GET_TAG (TAG_SNIPPET_TAB_STOP));
+
+ if (!ide_source_style_scheme_apply_style (style_scheme,
+ TAG_DEFINITION,
+ GET_TAG (TAG_DEFINITION)))
+ apply_style (GET_TAG (TAG_DEFINITION),
+ "underline", PANGO_UNDERLINE_SINGLE,
+ NULL);
}
#undef GET_TAG
@@ -1011,6 +1037,9 @@ ide_buffer_constructed (GObject *object)
NULL);
gtk_text_buffer_create_tag (GTK_TEXT_BUFFER (self), TAG_SNIPPET_TAB_STOP,
NULL);
+ gtk_text_buffer_create_tag (GTK_TEXT_BUFFER (self), TAG_DEFINITION,
+ "underline", PANGO_UNDERLINE_SINGLE,
+ NULL);
g_signal_connect_object (gtk_text_buffer_get_tag_table (GTK_TEXT_BUFFER (self)),
"tag-added",
diff --git a/libide/ide-source-view.c b/libide/ide-source-view.c
index 0fb67b4..5ef80b5 100644
--- a/libide/ide-source-view.c
+++ b/libide/ide-source-view.c
@@ -1502,10 +1502,6 @@ ide_source_view_bind_buffer (IdeSourceView *self,
priv->buffer = buffer;
- gtk_text_buffer_create_tag (GTK_TEXT_BUFFER (priv->buffer), TAG_DEFINITION,
- "underline", PANGO_UNDERLINE_SINGLE,
- NULL);
-
ide_source_view_reset_definition_highlight (self);
ide_buffer_hold (buffer);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]