Index: gedit/gedit-view.c
===================================================================
RCS file: /cvs/gnome/gedit/gedit/gedit-view.c,v
retrieving revision 1.52
diff -u -p -r1.52 gedit-view.c
--- gedit/gedit-view.c	5 Mar 2004 21:23:54 -0000	1.52
+++ gedit/gedit-view.c	16 Jul 2004 15:55:45 -0000
@@ -462,6 +462,82 @@ gedit_view_scroll_to_cursor (GeditView *
 				"insert"));
 }
 
+
+static G_CONST_RETURN gchar*
+get_widget_name (GtkWidget *w)
+{
+	const gchar *name;	
+
+	name = gtk_widget_get_name (w);
+	g_return_val_if_fail (name != NULL, NULL);
+
+	if (strcmp (name, g_type_name (GTK_WIDGET_TYPE (w))) == 0)
+	{
+		static guint d = 0;
+		gchar *n;
+
+		n = g_strdup_printf ("%s_%d", name, d);
+		d++;
+		gtk_widget_set_name (w, n);
+		g_free (n);
+
+		name = gtk_widget_get_name (w);
+	}
+
+	return name;
+}
+
+static void 
+gedit_view_modify_cursor_color (GeditView *view, 
+                                GdkColor  *color)
+{
+	static const char cursor_color_rc[] =
+		"style \"svs-cc\"\n"
+		"{\n"
+			"GtkSourceView::cursor-color=\"#%04x%04x%04x\"\n"
+		"}\n"
+		"widget \"*.%s\" style : application \"svs-cc\"\n";
+
+	const gchar *name;
+	gchar *rc_temp;
+
+	gedit_debug (DEBUG_VIEW, "");
+
+	g_return_if_fail (GEDIT_IS_VIEW (view));
+
+	name = get_widget_name (GTK_WIDGET(view->priv->text_view));
+	g_return_if_fail (name != NULL);
+	
+	g_print ("Name: %s\n", name);
+
+	if (color != NULL)
+	{
+		rc_temp = g_strdup_printf (cursor_color_rc,
+					   color->red, 
+					   color->green, 
+					   color->blue,
+					   name);
+	}
+	else
+	{
+		GtkRcStyle *rc_style;
+ 
+ 		rc_style = gtk_widget_get_modifier_style (GTK_WIDGET (view->priv->text_view));
+
+		rc_temp = g_strdup_printf (cursor_color_rc,
+					   rc_style->text [GTK_STATE_NORMAL].red,
+					   rc_style->text [GTK_STATE_NORMAL].green,
+					   rc_style->text [GTK_STATE_NORMAL].blue,
+					   name);
+	}
+
+	g_print (rc_temp);
+	g_print ("\n");
+	gtk_rc_parse_string (rc_temp);
+
+	g_free (rc_temp);
+}
+
 void 
 gedit_view_set_colors (GeditView* view, gboolean def, GdkColor* backgroud, GdkColor* text,
 		GdkColor* selection, GdkColor* sel_text)
@@ -475,10 +551,6 @@ gedit_view_set_colors (GeditView* view, 
 		if (backgroud != NULL)
 			gtk_widget_modify_base (GTK_WIDGET (view->priv->text_view), 
 						GTK_STATE_NORMAL, backgroud);
-
-		if (text != NULL)			
-			gtk_widget_modify_text (GTK_WIDGET (view->priv->text_view), 
-						GTK_STATE_NORMAL, text);
 	
 		if (selection != NULL)
 		{
@@ -497,6 +569,13 @@ gedit_view_set_colors (GeditView* view, 
 			gtk_widget_modify_text (GTK_WIDGET (view->priv->text_view), 
 						GTK_STATE_ACTIVE, sel_text);		
 		}
+
+		if (text != NULL)
+		{			
+			gtk_widget_modify_text (GTK_WIDGET (view->priv->text_view), 
+						GTK_STATE_NORMAL, text);
+			gedit_view_modify_cursor_color (view, text);
+		}
 	}
 	else
 	{
@@ -509,6 +588,10 @@ gedit_view_set_colors (GeditView* view, 
 		rc_style->color_flags [GTK_STATE_ACTIVE] = 0;
 
 		gtk_widget_modify_style (GTK_WIDGET (view->priv->text_view), rc_style);
+		
+		/* It must be called after the text color has been modified */
+		gedit_view_modify_cursor_color (view, NULL);
+
 	}
 }
 
