/* There is no clean way to set the cursor-color, so we are stuck * with the following hack: set the name of each widget and parse * a gtkrc string. */ static void gtk_modify_cursor_color (GtkWidget *textview, 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; name = get_widget_name (textview); g_return_if_fail (name != NULL); 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 (textview); 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); } gtk_rc_parse_string (rc_temp); gtk_widget_reset_rc_styles (textview); g_free (rc_temp); }
static VALUE rg_reset_rc_styles(VALUE self) { gtk_widget_reset_rc_styles(_SELF(self)); return self; }