[anjuta] sourceview: Implement ianjuta_editor_cell_get_attribute() properly (#586457)



commit 59447b86513eeee804117f98f2e1b42457a5351b
Author: Johannes Schmid <jhs gnome org>
Date:   Sun Jan 10 14:13:05 2010 +0100

    sourceview: Implement ianjuta_editor_cell_get_attribute() properly (#586457)

 configure.in                         |    2 +-
 plugins/sourceview/sourceview-cell.c |   12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/configure.in b/configure.in
index 2eade99..3f6184f 100644
--- a/configure.in
+++ b/configure.in
@@ -39,7 +39,7 @@ SVN_MAJOR=1
 SVN_MINOR=5
 SVN_PATCH=0
 SUBVERSION_REQUIRED=$SVN_MAJOR.$SVN_MINOR.$SVN_PATCH
-GTKSOURCEVIEW_REQUIRED=2.8.0
+GTKSOURCEVIEW_REQUIRED=2.9.3
 LIBWNCK_REQUIRED=2.12
 GDA_REQUIRED=4.0.0
 UNIQUE_REQUIRED=1.0.0
diff --git a/plugins/sourceview/sourceview-cell.c b/plugins/sourceview/sourceview-cell.c
index 1bd8b08..2ea3ea0 100644
--- a/plugins/sourceview/sourceview-cell.c
+++ b/plugins/sourceview/sourceview-cell.c
@@ -32,6 +32,7 @@
 
 #include <gtk/gtk.h>
 #include <string.h>
+#include <gtksourceview/gtksourcebuffer.h>
 
 static void sourceview_cell_class_init(SourceviewCellClass *klass);
 static void sourceview_cell_instance_init(SourceviewCell *sp);
@@ -138,6 +139,17 @@ static IAnjutaEditorAttribute
 icell_get_attribute (IAnjutaEditorCell* icell, GError **e)
 {
 	IAnjutaEditorAttribute attrib = IANJUTA_EDITOR_TEXT;
+	SourceviewCell* cell = SOURCEVIEW_CELL(icell);
+	GtkTextIter iter;
+	gtk_text_buffer_get_iter_at_mark (cell->priv->buffer, &iter, cell->priv->mark);
+
+	if (gtk_source_buffer_iter_has_context_class (GTK_SOURCE_BUFFER(cell->priv->buffer), &iter, "string"))
+		attrib = IANJUTA_EDITOR_STRING;
+	else if (gtk_source_buffer_iter_has_context_class (GTK_SOURCE_BUFFER(cell->priv->buffer), &iter, "comment"))
+		attrib = IANJUTA_EDITOR_COMMENT;
+	else if (gtk_source_buffer_iter_has_context_class (GTK_SOURCE_BUFFER(cell->priv->buffer), &iter, "keyword"))
+		attrib = IANJUTA_EDITOR_KEYWORD;
+	
 	return attrib;
 }
 



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