# GtkSourceView 3 -> 4 Porting Guide

## GTK+ dependency

Both GtkSourceView 3 and GtkSourceView 4 depend on GTK+ 3. GtkSourceView 5 depends on GTK+ 4. Before porting an application to GTK+ 4, it is therefore recommended to first port to GtkSourceView 4 and then to GTK+ 4 and GtkSourceView 5.

## Preparation in GtkSourceView 3

GtkSourceView 3.24 is the latest stable GtkSourceView 3 version. You should use this version without using any deprecated API.

## New pkg-config name

For GtkSourceView 4, the pkg-config name is: `gtksourceview-4`

To compile a program that uses GtkSourceView 4, you can for example use the following command:

`$ gcc hello.c `pkg-config --cflags --libs gtksourceview-4` -o hello`

## A set of intermediate tarballs to ease the transition

When porting to GtkSourceView 4, instead of doing everything in one step, you can compile intermediate 3.99.x tarballs of GtkSourceView, so that you can compile your code regularly and run the tests. Not doing all at once in one big commit, but instead doing smaller and testable commits.

## GtkSourceView 3.99.1

- All the deprecated APIs have been removed.

- Only `<gtksourceview/gtksource.h>` can be included directly. There were already warnings about it in GtkSourceView 3. The warnings have been changed to errors.

- Only the version 2 of the GtkSourceView language definition file format is supported (for *.lang files, used for syntax highlighting). The support for the version 1 has been dropped.

## GtkSourceView 3.99.2

- `gtk_source_completion_item_new2()` has been renamed to gtk_source_completion_item_new().

- `gtk_source_search_context_forward2()` has been renamed to gtk_source_search_context_forward().

- `gtk_source_search_context_forward_finish2()` has been renamed to gtk_source_search_context_forward_finish().

- `gtk_source_search_context_backward2()` has been renamed to gtk_source_search_context_backward().

- `gtk_source_search_context_backward_finish2()` has been renamed to gtk_source_search_context_backward_finish().

- `gtk_source_search_context_replace2()` has been renamed to gtk_source_search_context_replace().

- The GtkSourceSearchContext:settings property is now construct-only.

## GtkSourceView 3.99.3

No API changes.

## GtkSourceView 3.99.4

- The API of the GtkSourceView::move-lines keybinding signal has been simplified: the `copy` parameter was deprecated and has been removed; and the `count` parameter has been replaced by the `down` boolean.