This site has been retired. For up to date information, see handbook.gnome.org or gitlab.gnome.org.


[Home] [TitleIndex] [WordIndex

GtkSourceView 2.0 will break API and ABI interfaces with previous releases.

This page is meant as a collection of notes describing what is required to make an application use the new version

NOTE: GtkSourceView2.0 is completely parallel installable with previous releases, this mens that your application can continue to use GtkSourceView 1 for the time being without any problems

NOTE 2: GtkSourceView2.0 is still in "beta testing", API and ABI interfaces are still bound to change, but don't let this stop you from starting to port your app to the new version! Instead take this change to let us know which kind of API changes would make your life easier

General

Basic usage should be very similar. Most of the API changes are related to configuration of styles and languages. A particular remark is needed for printing: gtksourceview has totally dropped it's printing support: GtkSourceView 1.0 used gnome-print for printing, which is deprecated, printing should now be implemented using GtkPrint which is part of GTK+.

Changes to the build environment

GtkSourceView uses pkg-config, so if you use autotools all you need to do is something like

PKG_CHECK_MODULES(FOO, [
    gtksourceview-2.0 >= 1.90.0
])

AC_SUBST(FOO_LIBS)
AC_SUBST(FOO_CFLAGS)

(1.90.0 is the current beta version)

API Changes detailed list

Memory management and such

Be careful with return values: lot have changed and lot will change again. For instance, gtk_source_style_scheme_get_style() returns new object; gtk_source_language_manager_list_languages() returns reference to its internal list so you may not modify/free it, while gtk_source_style_manager_list_schemes() returns a new list, every element of which is a new reference, so you have to unref/free everything. It will be fixed, but meanwhile DO read docs.

GtkSourceLanguageManager

GtkSourceLanguagesManager has been renamed to GtkSourceLanguageManager (note the dropped 's', since we were breaking API compat fixing this long standing spellin g mistake sounded like a good idea), some of it's method also changed signature sligtly. Of important note is that the get_language_from_mime_type method has been removed since it was broken by design (you need to take into consideration mime type hierarchy to make a proper choice of the language). At the moment there isn't yet an API to get a language given a mime type or glob, but you can get this kind of property for each language and then implement a custom way to pick the proper language. We'll try to adress this in the future.

Undo/Redo

can-undo, can-redo are now properties of GtkSourceBuffer instead of signals, to update the sensitivity of your menu and toolbar you can connect to the notify signal for those properties

GtkSourceTag

GtkSourceTag is gone, gtksourceview uses plain GtkTextTags now

SmartHomeEnd

the GtkTextView smart-home-end property is now and enum instead of a boolean, allowing to choose among different kind of behavior

More Stuff I forgot

add it here

New Lang file format and styles

A new more expressive language description format has been introduced, see GtkSourceView/NewLangFormat for details. The old format is still supported but we suggest to port any lang file to the new format to take advantage of the new features. To help you with porting a basic conversion script is shipped with gtksourceview sources

Bindings

Also the bindings will need to be updated to the new version of the library, and if possible they should be parallel installable with their respective old version. Python bindings for gtksourceview 2 already exist and are available in the pygtksourceview module on GNOME svn. Other bindings will hopefully follow soon.


2024-10-23 11:37