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


[Home] [TitleIndex] [WordIndex

1. GtkSnippets

GtkSnippets is a library to manage snippets for all Gtk applications. We try to have an user database with all snippets and all application can use GtkSnippets to access to the same database. By example you can develop a gedit plugin using this library and an Anjuta plugin. The snippet database is the same for the user and he can use his snippets into gedit and anjuta.

Project homepage: https://sourceforge.net/projects/gtksnippets/

Screencast:

1.1. Internals

There are two libraries:

1.1.1. GSnippets

This library manage the database access. Internally uses sqlite3 in the user home.

This library have a parser to use simple wariables into the snippets content. By example we have this snippet content:

Then you can pass a variable classname=MyClass and the result will be:

You can use GtkSnippetsVarsDialog to easily replace the vars into the snippets content.

1.1.2. GtkSnippets

This library have various widgets to manage the snippets;

Snippets vars replacement

Snippets Manager

In place parser

1.2. Snippets Completion

We have developed an Snippets provider for GtkSourceCompletion. This provider adds snippets support to GtkSourceCompletion. This provider adds a new page into the completion popup with the snippets for this language and you can select it and the snippets content will be added to the current text (or source code).

You can take a look at this screencast to see this in action.

Snippets completion with GtkSourceCompletion


2024-10-23 10:58