GtkSourceSnippetManager

GtkSourceSnippetManager — Provides access to GtkSourceSnippet

Functions

Properties

GStrv search-path Read / Write

Types and Values

Object Hierarchy

    GObject
    ╰── GtkSourceSnippetManager

Includes

#include <gtksourceview/gtksource.h>

Description

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.

Functions

gtk_source_snippet_manager_get_default ()

GtkSourceSnippetManager *
gtk_source_snippet_manager_get_default
                               (void);

Returns the default GtkSourceSnippetManager instance.

Returns

a GtkSourceSnippetManager which is owned by GtkSourceView library and must not be unref'd.

[transfer none][not nullable]

Since: 5.0


gtk_source_snippet_manager_get_search_path ()

const gchar * const      *
gtk_source_snippet_manager_get_search_path
                               (GtkSourceSnippetManager *self);

Gets the list directories where self looks for snippet files.

Parameters

Returns

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


gtk_source_snippet_manager_get_snippet ()

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.

Parameters

self

a GtkSourceSnippetManager

 

group

a group name or NULL.

[nullable]

language_id

a “id” or NULL.

[nullable]

trigger

the trigger for the snippet

 

Returns

a GtkSourceSnippet or NULL if no matching snippet was found.

[transfer full][nullable]

Since: 5.0


gtk_source_snippet_manager_list_groups ()

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.

Parameters

Returns

An array of strings which should be freed with g_free().

[transfer container][array zero-terminated=1][element-type utf8]

Since: 5.0


gtk_source_snippet_manager_list_matching ()

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.

Parameters

self

a GtkSourceSnippetManager

 

group

a group name or NULL.

[nullable]

language_id

a “id” or NULL.

[nullable]

trigger_prefix

a prefix for a trigger to activate.

[nullable]

Returns

a GListModel of GtkSourceSnippet.

[transfer full]

Since: 5.0


gtk_source_snippet_manager_set_search_path ()

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.

Parameters

self

a GtkSourceSnippetManager

 

dirs

a NULL-terminated array of strings or NULL.

[nullable][array zero-terminated=1]

Since: 5.0

Types and Values

GtkSourceSnippetManager

typedef struct _GtkSourceSnippetManager GtkSourceSnippetManager;

Property Details

The “search-path” property

  “search-path”              GStrv

The "search-path" property contains a list of directories to search for files containing snippets (*.snippets).

Owner: GtkSourceSnippetManager

Flags: Read / Write

Since: 5.0

See Also

GtkSourceSnippet