Top | ![]() |
![]() |
![]() |
![]() |
GtkSourceSnippetManagerGtkSourceSnippetManager — Provides access to GtkSourceSnippet |
GtkSourceSnippetManager is an object which processes snippet description files and creates GtkSourceSnippet objects.
Use gtk_source_snippet_manager_get_default()
to retrieve the default
instance of GtkSourceSnippetManager.
Use gtk_source_snippet_manager_get_snippets()
to retrieve snippets for
a given snippets.
GtkSourceSnippetManager *
gtk_source_snippet_manager_get_default
(void
);
Returns the default GtkSourceSnippetManager instance.
a GtkSourceSnippetManager which is owned by GtkSourceView library and must not be unref'd.
[transfer none][not nullable]
Since: 5.0
const gchar * const *
gtk_source_snippet_manager_get_search_path
(GtkSourceSnippetManager *self
);
Gets the list directories where self
looks for snippet files.
NULL
-terminated array
containing a list of snippet files directories.
The array is owned by lm
and must not be modified.
[array zero-terminated=1][transfer none]
Since: 5.0
GtkSourceSnippet * gtk_source_snippet_manager_get_snippet (GtkSourceSnippetManager *self
,const gchar *group
,const gchar *language_id
,const gchar *trigger
);
Queries the known snippets for the first matching group
, language_id
,
and/or trigger
. If group
or language_id
are NULL
, they will be ignored.
self |
||
group |
a group name or |
[nullable] |
language_id |
[nullable] | |
trigger |
the trigger for the snippet |
Since: 5.0
const gchar **
gtk_source_snippet_manager_list_groups
(GtkSourceSnippetManager *self
);
List all the known groups within the snippet manager.
The result should be freed with g_free()
, and the individual strings are
owned by self
and should never be freed by the caller.
An array of strings which should be freed with g_free()
.
[transfer container][array zero-terminated=1][element-type utf8]
Since: 5.0
GListModel * gtk_source_snippet_manager_list_matching (GtkSourceSnippetManager *self
,const gchar *group
,const gchar *language_id
,const gchar *trigger_prefix
);
Queries the known snippets for those matching group
, language_id
, and/or
trigger_prefix
. If any of these are NULL
, they will be ignored when
filtering the available snippets.
The GListModel only contains information about the available snippets until
g_list_model_get_item()
is called for a specific snippet. This helps reduce
the number of GObject's that are created at runtime to those needed by
the calling application.
self |
||
group |
a group name or |
[nullable] |
language_id |
[nullable] | |
trigger_prefix |
a prefix for a trigger to activate. |
[nullable] |
Since: 5.0
void gtk_source_snippet_manager_set_search_path (GtkSourceSnippetManager *self
,const gchar * const *dirs
);
Sets the list of directories in which the GtkSourceSnippetManagerlooks for
snippet files. If dirs
is NULL
, the search path is reset to default.
At the moment this function can be called only before the snippet files are loaded for the first time. In practice to set a custom search path for a GtkSourceSnippetManager, you have to call this function right after creating it.
Since: 5.0