GtkSource – 5
Description: Reference for GtkSource-5

### Namespace

# GtkSource – 5

A GNOME library that extends GtkTextView

Version | 5.16.0
Authors | The GtkSourceView Authors
License | LGPL-2.1-or-later
Website | https://gitlab.gnome.org/GNOME/gtksourceview/
Source | https://gitlab.gnome.org/GNOME/gtksourceview/

#### Build

C headers | `gtksourceview/gtksource.h`
pkg-config files | `gtksourceview-5`

#### Dependencies

GLib—2.0 | The base type system library
| Browse documentation
GObject—2.0 | The base type system library
| Browse documentation
Gio—2.0 | GObject Interfaces and Objects, Networking, IPC, and I/O
| Browse documentation
GdkPixbuf—2.0 | Image loading library
| Browse documentation
Pango—1.0 | Text shaping and rendering
| Browse documentation
Gdk—4.0 | The GTK windowing system abstraction
| Browse documentation
Gtk—4.0 | The GTK toolkit
| Browse documentation

#### Additional documentation

- Overview
- Language Definition v2.0 Introduction
- Language Definition v2.0 Reference
- Language Definition v2.0 Tutorial
- Snippet Definition Reference
- Style Scheme Definition Reference
- GtkSourceView 3 -> 4 Migration Guide
- GtkSourceView 4 -> 5 Migration Guide
- Classes Hierarchy

#### Classes

Buffer | Subclass of `GtkTextBuffer`.
Completion | Main Completion Object.
CompletionCell | Widget for single cell of completion proposal.
CompletionContext | The context of a completion.
CompletionSnippets | A `GtkSourceCompletionProvider` for the completion of snippets.
CompletionWords | A `GtkSourceCompletionProvider` for the completion of words.
File | On-disk representation of a `GtkSourceBuffer`.
FileLoader | Load a file into a GtkSourceBuffer.
FileSaver | Save a `GtkSourceBuffer` into a file.
Gutter | Gutter object for `GtkSourceView`.
GutterLines | Collected information about visible lines.
GutterRenderer | Gutter cell renderer.
GutterRendererPixbuf | Renders a pixbuf in the gutter.
GutterRendererText | Renders text in the gutter.
Hover | Interactive tooltips.
HoverContext | Context for populating `GtkSourceHoverDisplay` contents.
HoverDisplay | Display for interactive tooltips.
Language | Represents a syntax highlighted language.
LanguageManager | Provides access to `GtkSourceLanguage`s.
Map | Widget that displays a map for a specific `GtkSourceView`.
Mark | Mark object for `GtkSourceBuffer`.
MarkAttributes | The source mark attributes object.
PrintCompositor | Compose a `GtkSourceBuffer` for printing.
Region | Region utility.
SearchContext | Search context.
SearchSettings | Search settings.
Snippet | Quick insertion code snippets.
SnippetChunk | A chunk of text within the source snippet.
SnippetContext | Context for expanding `GtkSourceSnippetChunk`.
SnippetManager | Provides access to `GtkSourceSnippet`.
SpaceDrawer | Represent white space characters with symbols.
Style | Represents a style.
StyleScheme | Controls the appearance of `GtkSourceView`.
StyleSchemeChooserButton | A button to launch a style scheme selection dialog.
StyleSchemeChooserWidget | A widget for choosing style schemes.
StyleSchemeManager | Provides access to `GtkSourceStyleScheme`s.
StyleSchemePreview | A preview widget for `GtkSourceStyleScheme`. since: 5.4
Tag | A tag that can be applied to text in a `GtkSourceBuffer`.
View | Subclass of `GtkTextView`.
VimIMContext | Vim emulation. since: 5.4

#### Interfaces

CompletionProposal | Interface for completion proposals.
CompletionProvider | Completion provider interface.
HoverProvider | Interface to populate interactive tooltips.
Indenter | Auto-indentation interface.
StyleSchemeChooser | Interface implemented by widgets for choosing style schemes.

#### Structs

Encoding | Character encoding.
RegionIter | An opaque datatype.

#### Enumerations

BackgroundPatternType |
BracketMatchType |
ChangeCaseType |
CompletionActivation |
CompletionColumn |
CompressionType |
GutterRendererAlignmentMode | The alignment mode of the renderer, when a cell spans multiple lines (due to text wrapping).
NewlineType |
SmartHomeEndType |
ViewGutterPosition |

#### Bitfields

FileSaverFlags | Flags to define the behavior of a `GtkSourceFileSaverFlags`.
SortFlags |
SpaceLocationFlags | `GtkSourceSpaceLocationFlags` contains flags for white space locations.
SpaceTypeFlags | `GtkSourceSpaceTypeFlags` contains flags for white space types.

#### Error Domains

FileLoaderError | An error code used with the `GTK_SOURCE_FILE_LOADER_ERROR` domain.
FileSaverError | An error code used with the `GTK_SOURCE_FILE_SAVER_ERROR` domain.

#### Callbacks

MountOperationFactory | Type definition for a function that will be called to create a `GMountOperation`. This is useful for creating a `GtkMountOperation`.
SchedulerCallback | This function is called incrementally to process additional background work. A deadline is provided which can be checked using `g_get_monotonic_time()` so that additional work can be processed each frame. since: 5.2

#### Functions

check_version | Like GTK_SOURCE_CHECK_VERSION, but the check for gtk_source_check_version is at runtime instead of compile time. This is useful for compiling against older versions of GtkSourceView, but using features from newer versions.
finalize | Free the resources allocated by GtkSourceView. For example it unrefs the singleton objects.
get_major_version | Returns the major version number of the GtkSourceView library. (e.g. in GtkSourceView version 3.20.0 this is 3.).
get_micro_version | Returns the micro version number of the GtkSourceView library. (e.g. in GtkSourceView version 3.20.0 this is 0.).
get_minor_version | Returns the minor version number of the GtkSourceView library. (e.g. in GtkSourceView version 3.20.0 this is 20.).
init | Initializes the GtkSourceView library (e.g. for the internationalization).
scheduler_add | Simplified version of `gtk_source_scheduler_add_full()`. since: 5.2
scheduler_add_full | Adds a new callback that will be executed as time permits on the main thread. since: 5.2
scheduler_remove | Removes a scheduler callback previously registered with `gtk_source_scheduler_add()` or `gtk_source_scheduler_add_full()`. since: 5.2
utils_escape_search_text | Use this function to escape the following characters: `\n`, `\r`, `\t` and `\`.
utils_unescape_search_text | Use this function before `gtk_source_search_settings_set_search_text()`, to unescape the following sequences of characters: `\n`, `\r`, `\t` and `\\`. The purpose is to easily write those characters in a search entry.

#### Function Macros

CHECK_VERSION | Macro to test the version of GtkSourceView being compiled against.

#### Constants

MAJOR_VERSION | Like gtk_source_get_major_version(), but from the headers used at application compile time, rather than from the library linked against at application run time.
MICRO_VERSION | Like gtk_source_get_micro_version(), but from the headers used at application compile time, rather than from the library linked against at application run time.
MINOR_VERSION | Like gtk_source_get_minor_version(), but from the headers used at application compile time, rather than from the library linked against at application run time.