? bug171734.patch
? bug307456.patch
? bug310249.patch
? bug311517.patch
? fold_v1.patch
? fold_v2.patch
? fold_v2.patch.comments
? fold_v2.patch.comments2
? gtksourceview-1.3.92.tar.gz
? gtksourceview-1.3.93.tar.gz
? gtksourceview/current_line.comments
? tests/test-fold
Index: gtksourceview/gtksourcebuffer.c
===================================================================
RCS file: /cvs/gnome/gtksourceview/gtksourceview/gtksourcebuffer.c,v
retrieving revision 1.39
diff -u -p -r1.39 gtksourcebuffer.c
--- gtksourceview/gtksourcebuffer.c	21 Jun 2005 17:29:28 -0000	1.39
+++ gtksourceview/gtksourcebuffer.c	1 Sep 2005 17:12:00 -0000
@@ -75,6 +75,8 @@
 typedef struct _SyntaxDelimiter      SyntaxDelimiter;
 typedef struct _PatternMatch         PatternMatch;
 
+static GQuark is_marker_tag_quark = 0;
+
 /* Signals */
 enum {
 	CAN_UNDO = 0,
@@ -109,12 +111,8 @@ struct _PatternMatch
 
 struct _GtkSourceBufferPrivate 
 {
-	gint                   highlight:1;
-	gint                   check_brackets:1;
-
 	GtkTextTag            *bracket_match_tag;
 	GtkTextMark           *bracket_mark;
-	guint                  bracket_found:1;
 	
 	GArray                *markers;
 
@@ -139,6 +137,14 @@ struct _GtkSourceBufferPrivate 
 	GtkSourceLanguage     *language;
 
 	GtkSourceUndoManager  *undo_manager;
+
+	guint                  bracket_found:1;
+		
+	gint		       deleting_text:1;
+	
+	gint                   highlight:1;
+	gint                   check_brackets:1;
+
 };
 
 
@@ -214,13 +220,19 @@ static void      ensure_highlighted     
 static gboolean	 gtk_source_buffer_find_bracket_match_real (GtkTextIter          *orig, 
 							    gint                  max_chars);
 
-static void	 gtk_source_buffer_remove_all_source_tags (GtkSourceBuffer   *buffer,
-					  		const GtkTextIter *start,
-					  		const GtkTextIter *end);
-
-static void	sync_with_tag_table 			(GtkSourceBuffer *buffer);
-
-
+static void	 gtk_source_buffer_remove_all_source_tags (GtkSourceBuffer       *buffer,
+					  		const GtkTextIter        *start,
+					  		const GtkTextIter        *end);
+
+static void	 gtk_source_buffer_remove_all_marker_tags (GtkSourceBuffer       *buffer,
+					  		const GtkTextIter        *start,
+					  		const GtkTextIter        *end);
+
+static void	sync_with_tag_table 			(GtkSourceBuffer         *buffer);
+
+static void	update_markers_line 			(GtkSourceBuffer         *source_buffer,
+							 gint                     start_offset,
+							 gint                     end_offset);
 GType
 gtk_source_buffer_get_type (void)
 {
@@ -243,6 +255,8 @@ gtk_source_buffer_get_type (void)
 						   "GtkSourceBuffer",
 						   &our_info, 
 						   0);
+						   
+		is_marker_tag_quark = g_quark_from_static_string ("gtk-source-buffer-is-marker-tag-flag");
 	}
 	
 	return our_type;
@@ -389,11 +403,13 @@ gtk_source_buffer_init (GtkSourceBuffer 
 					     sizeof (SyntaxDelimiter));
 	priv->highlight_requests = gtk_text_region_new (GTK_TEXT_BUFFER (buffer));
 	priv->worker_handler = 0;
+	
+	priv->deleting_text = FALSE;
 
 	/* initially the buffer is empty so it's entirely analyzed */
 	priv->worker_last_offset = -1;
 	priv->worker_batch_size = INITIAL_WORKER_BATCH;
-	
+
 	g_signal_connect (G_OBJECT (buffer),
 			  "mark_set",
 			  G_CALLBACK (gtk_source_buffer_move_cursor),
@@ -414,8 +430,7 @@ gtk_source_buffer_init (GtkSourceBuffer 
 static void 
 tag_added_or_removed_cb (GtkTextTagTable *table, GtkTextTag *tag, GtkSourceBuffer *buffer)
 {
-	sync_with_tag_table (buffer);
-	
+	sync_with_tag_table (buffer);	
 }
 
 
@@ -804,7 +819,8 @@ gtk_source_buffer_real_insert_text (GtkT
 				    gint           len)
 {
 	gint start_offset;
-
+	gint chars;
+	
 	g_return_if_fail (GTK_IS_SOURCE_BUFFER (buffer));
 	g_return_if_fail (iter != NULL);
 	g_return_if_fail (text != NULL);
@@ -825,12 +841,18 @@ gtk_source_buffer_real_insert_text (GtkT
 				       gtk_text_buffer_get_insert (buffer),
 				       NULL);
 
+	chars = g_utf8_strlen (text, len);
+	
+	update_markers_line (GTK_SOURCE_BUFFER (buffer), 
+			     start_offset,
+			     start_offset + chars);
+			       
 	if (!GTK_SOURCE_BUFFER (buffer)->priv->highlight)
 		return;
 
 	update_syntax_regions (GTK_SOURCE_BUFFER (buffer), 
 			       start_offset,
-			       g_utf8_strlen (text, len));
+			       chars);
 
 }
 
@@ -850,6 +872,10 @@ gtk_source_buffer_real_delete_range (Gtk
 	g_return_if_fail (gtk_text_iter_get_buffer (start) == buffer);
 	g_return_if_fail (gtk_text_iter_get_buffer (end) == buffer);
 
+	/* Setting deleting_text to TRUE we avoid to execute update_markers_line
+	 * several times while deleting text */
+	GTK_SOURCE_BUFFER (buffer)->priv->deleting_text = TRUE;
+	
 	gtk_text_iter_order (start, end);
 	delta = gtk_text_iter_get_offset (start) - 
 			gtk_text_iter_get_offset (end);
@@ -894,6 +920,12 @@ gtk_source_buffer_real_delete_range (Gtk
 						       &iter);
 		g_slist_free (markers);
 	}
+	
+	GTK_SOURCE_BUFFER (buffer)->priv->deleting_text = FALSE;
+
+	update_markers_line (GTK_SOURCE_BUFFER (buffer), 
+			     gtk_text_iter_get_offset (start),
+			     gtk_text_iter_get_offset (start) + ABS (delta));
 
 	if (!GTK_SOURCE_BUFFER (buffer)->priv->highlight) 
 		return;
@@ -1506,6 +1538,190 @@ gtk_source_buffer_set_highlight (GtkSour
 	g_object_notify (G_OBJECT (buffer), "highlight");
 }
 
+static gchar *
+get_marker_tag_name (const gchar *marker_type)
+{
+	gchar *tag_name;
+	
+	tag_name = g_strdup_printf ("GtkSourceBuffer:tag_for_markers_of_type_%s",
+				    (marker_type == NULL) ? "" : marker_type);
+	
+	return tag_name;
+}
+
+/* TODO: Documentation */
+void
+gtk_source_buffer_set_marker_background_color (GtkSourceBuffer *buffer,
+					       const gchar     *marker_type,
+					       const GdkColor  *color)
+{
+	GtkTextTagTable *table;
+	gchar           *tag_name;
+	GtkTextTag      *tag; 
+	
+	g_return_if_fail (GTK_SOURCE_BUFFER (buffer));
+	g_return_if_fail (marker_type != NULL);
+	
+	tag_name = get_marker_tag_name (marker_type);
+
+	table = gtk_text_buffer_get_tag_table (GTK_TEXT_BUFFER (buffer));
+
+	tag = gtk_text_tag_table_lookup (table, tag_name);
+		     
+	if (color != NULL)
+	{
+		if (tag == NULL)
+		{
+			tag = gtk_text_buffer_create_tag (GTK_TEXT_BUFFER (buffer),
+							  tag_name,
+							  NULL);
+							  
+			g_object_set_qdata (G_OBJECT (tag),
+					    is_marker_tag_quark,
+					    "YES");							  
+		}
+							  
+		g_object_set (tag, "paragraph-background-gdk", color, NULL);
+	}
+	else
+	{	
+		if (tag != NULL)
+			gtk_text_tag_table_remove (table,
+						   tag);
+	}
+	
+	g_free (tag_name);
+}
+
+/* TODO: Documentation */
+GdkColor *
+gtk_source_view_get_marker_background_color (GtkSourceBuffer *buffer,
+					     const gchar     *marker_type)
+{
+	GtkTextTagTable *table;
+	gchar           *tag_name;
+	GtkTextTag      *tag; 
+	GdkColor        *color;
+	
+	g_return_val_if_fail (GTK_SOURCE_BUFFER (buffer), NULL);
+	g_return_val_if_fail (marker_type != NULL, NULL);
+	
+	tag_name = get_marker_tag_name (marker_type);
+
+	table = gtk_text_buffer_get_tag_table (GTK_TEXT_BUFFER (buffer));
+
+	tag = gtk_text_tag_table_lookup (table, tag_name);
+	g_free (tag_name);
+	
+	if (tag == NULL)
+		return NULL;
+		
+	g_object_get (tag, "paragraph-background-gdk", &color, NULL);
+	
+	return color;
+}
+
+
+static void
+update_markers_line (GtkSourceBuffer *source_buffer,
+                     gint             start_offset,
+                     gint             end_offset)
+{
+	GSList *mlist,  *l;
+	GtkTextTagTable *table;
+	GtkTextIter      start;
+	GtkTextIter      end;
+	GtkTextBuffer   *buffer;
+
+	if (source_buffer->priv->deleting_text)
+		return;
+	
+	/*
+	g_print ("update_markers_line: [%d - %d] ->", 
+			start_offset,
+			end_offset);
+	*/
+	
+	buffer = GTK_TEXT_BUFFER (source_buffer);
+	
+	gtk_text_buffer_get_iter_at_offset (buffer, &start, start_offset);
+	gtk_text_buffer_get_iter_at_offset (buffer, &end, end_offset);
+	
+	gtk_text_iter_order (&start, &end);
+	
+	gtk_text_iter_set_line_offset (&start, 0);
+			
+	if (!gtk_text_iter_ends_line (&end))
+		gtk_text_iter_forward_to_line_end (&end);
+	else if (gtk_text_iter_starts_line (&end))
+		gtk_text_iter_forward_visible_line (&end);
+
+	/*
+	g_print ("[%d - %d]\n", 
+			gtk_text_iter_get_offset (&start),
+			gtk_text_iter_get_offset (&end));
+	*/
+	
+	/* We first remove all the tags in the [start, end] region that
+	 * were added to color the line of a marker */
+	
+	gtk_source_buffer_remove_all_marker_tags (source_buffer,
+						  &start,
+						  &end);
+	
+	mlist = gtk_source_buffer_get_markers_in_region (source_buffer,
+							 &start,
+							 &end);
+	
+	if (mlist == NULL)
+		return;
+		
+	table = gtk_text_buffer_get_tag_table (buffer);
+							
+	/* For every marker in region [start, end], iff the background color
+	 * for its marker type was set, we apply the appropriate tag to the
+	 * line containing the marker */
+	 
+	l = mlist;
+	while (l != NULL)
+	{
+		GtkTextTag  *tag;
+		gchar       *tag_name;
+		GtkTextIter tag_start;
+		GtkTextIter tag_end;
+		
+		tag_name = get_marker_tag_name (
+				gtk_source_marker_get_marker_type_const (GTK_SOURCE_MARKER (l->data)));
+				
+		tag = gtk_text_tag_table_lookup (table, tag_name);
+		g_free (tag_name);
+		
+		if (tag != NULL)
+		{
+			gtk_source_buffer_get_iter_at_marker (source_buffer,
+							      &tag_start,
+							      GTK_SOURCE_MARKER (l->data));
+
+			tag_end = tag_start;
+			
+			gtk_text_iter_set_line_offset (&tag_start, 0);
+			
+			if (!gtk_text_iter_ends_line (&tag_end))
+				gtk_text_iter_forward_to_line_end (&tag_end);
+			else if (gtk_text_iter_starts_line (&tag_end))
+				gtk_text_iter_forward_visible_line (&tag_end);
+				
+			gtk_text_buffer_apply_tag (buffer,
+						   tag,
+						   &tag_start,
+						   &tag_end);	     
+		}
+
+		l = g_slist_next (l);
+	}							 
+}
+
+
 /* Idle worker code ------------ */
 
 static gboolean
@@ -2710,7 +2926,7 @@ _gtk_source_buffer_highlight_region (Gtk
 	g_return_if_fail (source_buffer != NULL);
 	g_return_if_fail (start != NULL);
        	g_return_if_fail (end != NULL);
-
+	
 	if (!source_buffer->priv->highlight)
 		return;
 
@@ -2885,6 +3101,129 @@ gtk_source_buffer_remove_all_source_tags
 	g_slist_free (tags);
 }
 
+static void
+gtk_source_buffer_remove_all_marker_tags (GtkSourceBuffer   *buffer,
+					  const GtkTextIter *start,
+					  const GtkTextIter *end)
+{
+	GtkTextIter first, second, tmp;
+	GSList *tags;
+	GSList *tmp_list;
+	GSList *tmp_list2;
+	GSList *prev;
+	GtkTextTag *tag;
+  
+	/*
+	g_return_if_fail (GTK_IS_SOURCE_BUFFER (buffer));
+	g_return_if_fail (start != NULL);
+	g_return_if_fail (end != NULL);
+	g_return_if_fail (gtk_text_iter_get_buffer (start) == GTK_TEXT_BUFFER (buffer));
+	g_return_if_fail (gtk_text_iter_get_buffer (end) == GTK_TEXT_BUFFER (buffer));
+	*/
+	
+	first = *start;
+	second = *end;
+
+	gtk_text_iter_order (&first, &second);
+
+	/* Get all tags turned on at the start */
+	tags = NULL;
+	tmp_list = gtk_text_iter_get_tags (&first);
+	tmp_list2 = tmp_list;
+	
+	while (tmp_list2 != NULL)
+	{
+		/* Check if it is a marker tag */
+		if (g_object_get_qdata (G_OBJECT (tmp_list2->data), is_marker_tag_quark) != NULL)
+		{
+			tags = g_slist_prepend (tags, tmp_list2->data);
+		}
+
+		tmp_list2 = g_slist_next (tmp_list2);
+	}
+	
+	g_slist_free (tmp_list);
+	
+	/* Find any that are toggled on within the range */
+	tmp = first;
+	while (gtk_text_iter_forward_to_tag_toggle (&tmp, NULL))
+	{
+		GSList *toggled;
+		
+		if (gtk_text_iter_compare (&tmp, &second) >= 0)
+			break; /* past the end of the range */
+      
+		toggled = gtk_text_iter_get_toggled_tags (&tmp, TRUE);
+
+		/* We could end up with a really big-ass list here.
+		 * Fix it someday.
+		 */
+		tmp_list2 = toggled;
+		while (tmp_list2 != NULL)
+		{
+			if (g_object_get_qdata (G_OBJECT (tmp_list2->data), is_marker_tag_quark) != NULL)
+			{
+				tags = g_slist_prepend (tags, tmp_list2->data);
+			}
+
+			tmp_list2 = g_slist_next (tmp_list2);
+		}
+
+		g_slist_free (toggled);
+	}
+  
+	/* Sort the list */
+	tags = g_slist_sort (tags, pointer_cmp);
+
+	/* Strip duplicates */
+	tag = NULL;
+	prev = NULL;
+	tmp_list = tags;
+
+	while (tmp_list != NULL)
+	{
+		if (tag == tmp_list->data)
+		{
+			/* duplicate */
+			if (prev)
+				prev->next = tmp_list->next;
+
+			tmp_list->next = NULL;
+
+			g_slist_free (tmp_list);
+
+			tmp_list = prev->next;
+			/* prev is unchanged */
+		}
+		else
+		{
+			/* not a duplicate */
+			tag = GTK_TEXT_TAG (tmp_list->data);
+			prev = tmp_list;
+			tmp_list = tmp_list->next;
+		}
+	}
+
+	g_slist_foreach (tags, (GFunc) g_object_ref, NULL);
+  
+	tmp_list = tags;
+	while (tmp_list != NULL)
+	{
+		tag = GTK_TEXT_TAG (tmp_list->data);
+
+		gtk_text_buffer_remove_tag (GTK_TEXT_BUFFER (buffer), 
+					    tag,
+					    &first,
+					    &second);
+      
+		tmp_list = tmp_list->next;
+	}
+
+	g_slist_foreach (tags, (GFunc) g_object_unref, NULL);
+  
+	g_slist_free (tags);
+}
+
 /**
  * gtk_source_buffer_set_language:
  * @buffer: a #GtkSourceBuffer.
@@ -3251,12 +3590,17 @@ gtk_source_buffer_create_marker (GtkSour
 						 TRUE);
 	if (text_mark)
 	{
+		gint offset;
+		
 		g_object_ref (text_mark);
 
 		gtk_source_marker_set_marker_type (GTK_SOURCE_MARKER (text_mark), type);
 		markers_insert (buffer, GTK_SOURCE_MARKER (text_mark));
 		_gtk_source_marker_changed (GTK_SOURCE_MARKER (text_mark));
 
+		offset = gtk_text_iter_get_offset (where);
+		update_markers_line (buffer, offset, offset);
+		
 		return GTK_SOURCE_MARKER (text_mark);
 	}
 
@@ -3299,6 +3643,7 @@ gtk_source_buffer_move_marker (GtkSource
 			       const GtkTextIter *where)
 {
 	gint index;
+	GtkTextIter old_iter;
 	
 	g_return_if_fail (buffer != NULL && marker != NULL);
 	g_return_if_fail (GTK_IS_SOURCE_BUFFER (buffer));
@@ -3306,6 +3651,13 @@ gtk_source_buffer_move_marker (GtkSource
 	g_return_if_fail (!gtk_text_mark_get_deleted (GTK_TEXT_MARK (marker)));
 	g_return_if_fail (where != NULL);
 
+	gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (buffer),
+					  &old_iter,
+					  GTK_TEXT_MARK (marker));
+
+	if (gtk_text_iter_equal (&old_iter, where))
+		return;
+		
 	index = markers_lookup (buffer, marker);
 	
 	g_return_if_fail (index >= 0);
@@ -3324,6 +3676,19 @@ gtk_source_buffer_move_marker (GtkSource
 
 	/* FIXME: emit even the line number hasn't changed? - Gustavo */
 	_gtk_source_marker_changed (marker);
+	
+	if (gtk_text_iter_get_line (&old_iter) != gtk_text_iter_get_line (where))
+	{
+		gint offset;
+		
+		/* Remove the line from the old position */
+		offset = gtk_text_iter_get_offset (&old_iter);
+		update_markers_line (buffer, offset, offset);
+
+		/* Add the line in the new position */
+		offset = gtk_text_iter_get_offset (where);
+		update_markers_line (buffer, offset, offset);
+	}		
 }
 
 /**
@@ -3341,6 +3706,8 @@ gtk_source_buffer_delete_marker (GtkSour
 				 GtkSourceMarker *marker)
 {
 	gint index;
+	GtkTextIter iter;
+	gint offset;
 	
 	g_return_if_fail (buffer != NULL && marker != NULL);
 	g_return_if_fail (GTK_IS_SOURCE_BUFFER (buffer));
@@ -3355,9 +3722,16 @@ gtk_source_buffer_delete_marker (GtkSour
 	_gtk_source_marker_unlink (marker);
 	g_array_remove_index (buffer->priv->markers, index);
 
+	gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (buffer),
+					  &iter,
+					  GTK_TEXT_MARK (marker));
+	offset = gtk_text_iter_get_offset (&iter);
+						  
 	g_object_unref (marker);
 	gtk_text_buffer_delete_mark (GTK_TEXT_BUFFER (buffer),
 				     GTK_TEXT_MARK (marker));
+				     
+	update_markers_line (buffer, offset, offset);
 }
 
 /**
Index: gtksourceview/gtksourcebuffer.h
===================================================================
RCS file: /cvs/gnome/gtksourceview/gtksourceview/gtksourcebuffer.h,v
retrieving revision 1.18
diff -u -p -r1.18 gtksourcebuffer.h
--- gtksourceview/gtksourcebuffer.h	6 Jun 2003 08:54:36 -0000	1.18
+++ gtksourceview/gtksourcebuffer.h	1 Sep 2005 17:12:00 -0000
@@ -140,6 +140,14 @@ GtkSourceMarker         *gtk_source_buff
 								 GtkTextIter            *iter);
 GtkSourceMarker         *gtk_source_buffer_get_prev_marker      (GtkSourceBuffer        *buffer,
 								 GtkTextIter            *iter);
+			 
+void			 gtk_source_buffer_set_marker_background_color 
+								(GtkSourceBuffer        *buffer,
+								 const gchar            *marker_type,
+								 const GdkColor         *color);
+GdkColor		*gtk_source_view_get_marker_background_color
+								(GtkSourceBuffer        *buffer,
+								 const gchar            *marker_type);
 
 /* INTERNAL private stuff - not even exported from the library on
  * many platforms
Index: gtksourceview/gtksourcemarker.c
===================================================================
RCS file: /cvs/gnome/gtksourceview/gtksourceview/gtksourcemarker.c,v
retrieving revision 1.3
diff -u -p -r1.3 gtksourcemarker.c
--- gtksourceview/gtksourcemarker.c	24 Jan 2005 16:40:33 -0000	1.3
+++ gtksourceview/gtksourcemarker.c	1 Sep 2005 17:12:00 -0000
@@ -68,7 +68,7 @@ gtk_source_marker_set_marker_type (GtkSo
  * 
  * Gets the marker type of this @marker.
  * 
- * Return value: the marker type.
+ * Return value: a newly allocated copy of the marker type.
  **/
 gchar *
 gtk_source_marker_get_marker_type (GtkSourceMarker *marker)
@@ -80,6 +80,25 @@ gtk_source_marker_get_marker_type (GtkSo
 }
 
 /**
+ * gtk_source_marker_get_marker_type_const:
+ * @marker: a #GtkSourceMarker.
+ * 
+ * Gets the marker type of this @marker.
+ * 
+ * Return value: the marker type.
+ *
+ * Since: 2.0
+ **/
+G_CONST_RETURN gchar *
+gtk_source_marker_get_marker_type_const (GtkSourceMarker *marker)
+{
+	g_return_val_if_fail (marker != NULL, NULL);
+	g_return_val_if_fail (GTK_IS_SOURCE_MARKER (marker), NULL);
+	
+	return g_object_get_qdata (G_OBJECT (marker), quark_marker_type);
+}
+
+/**
  * gtk_source_marker_get_line:
  * @marker: a #GtkSourceMarker.
  * 
@@ -159,7 +178,7 @@ _gtk_source_marker_changed (GtkSourceMar
 					  &iter,
 					  GTK_TEXT_MARK (marker));
 	gtk_text_iter_set_line_offset (&iter, 0);
-
+	
 	g_signal_emit_by_name (buffer, "marker_updated", &iter);
 }
 
Index: gtksourceview/gtksourcemarker.h
===================================================================
RCS file: /cvs/gnome/gtksourceview/gtksourceview/gtksourcemarker.h,v
retrieving revision 1.2
diff -u -p -r1.2 gtksourcemarker.h
--- gtksourceview/gtksourcemarker.h	2 May 2003 17:27:52 -0000	1.2
+++ gtksourceview/gtksourcemarker.h	1 Sep 2005 17:12:00 -0000
@@ -40,6 +40,8 @@ GType                 gtk_source_marker_
 void                  gtk_source_marker_set_marker_type (GtkSourceMarker *marker,
 							 const gchar     *type);
 gchar                *gtk_source_marker_get_marker_type (GtkSourceMarker *marker);
+G_CONST_RETURN gchar *gtk_source_marker_get_marker_type_const 
+							(GtkSourceMarker *marker);
 gint                  gtk_source_marker_get_line        (GtkSourceMarker *marker);
 G_CONST_RETURN gchar *gtk_source_marker_get_name        (GtkSourceMarker *marker);
 GtkSourceBuffer      *gtk_source_marker_get_buffer      (GtkSourceMarker *marker);
Index: tests/test-widget.c
===================================================================
RCS file: /cvs/gnome/gtksourceview/tests/test-widget.c,v
retrieving revision 1.11
diff -u -p -r1.11 test-widget.c
--- tests/test-widget.c	8 Jan 2005 22:02:30 -0000	1.11
+++ tests/test-widget.c	1 Sep 2005 17:12:00 -0000
@@ -755,6 +755,8 @@ create_view_window (GtkSourceBuffer *buf
 	GtkActionGroup *action_group;
 	GtkUIManager *ui_manager;
 	GError *error;
+	GdkColor color;
+	GdkColor *pcolor;
 
 	g_return_val_if_fail (GTK_IS_SOURCE_BUFFER (buffer), NULL);
 	g_return_val_if_fail (from == NULL || GTK_IS_SOURCE_VIEW (from), NULL);
@@ -891,6 +893,42 @@ create_view_window (GtkSourceBuffer *buf
 		error->message);
 		g_error_free (error);		
 	}
+	
+	gdk_color_parse ("green", &color);
+	gtk_source_buffer_set_marker_background_color (buffer,
+						       MARKER_TYPE_1,
+						       &color);
+
+	pcolor = gtk_source_view_get_marker_background_color (buffer, 
+							      MARKER_TYPE_1);
+
+	g_printf ("Color marker 1: #%04x%04x%04x <-> #%04x%04x%04x\n",
+		  color.red,
+		  color.green,
+		  color.blue,
+		  pcolor->red,
+		  pcolor->green,
+		  pcolor->blue);
+
+	gdk_color_free (pcolor);
+
+	gdk_color_parse ("red", &color);
+	gtk_source_buffer_set_marker_background_color (buffer,
+						       MARKER_TYPE_2,
+						       &color);
+
+	pcolor = gtk_source_view_get_marker_background_color (buffer, 
+							      MARKER_TYPE_2);
+
+	g_printf ("Color marker 2: #%04x%04x%04x <-> #%04x%04x%04x\n",
+		  color.red,
+		  color.green,
+		  color.blue,
+		  pcolor->red,
+		  pcolor->green,
+		  pcolor->blue);
+
+	gdk_color_free (pcolor);
 	
 	gtk_widget_show_all (vbox);
 
