GtkSourceSnippetChunk

GtkSourceSnippetChunk — An chunk of text within the source snippet

Functions

Properties

GtkSourceSnippetContext * context Read / Write
int focus-position Read / Write
char * spec Read / Write
char * text Read / Write
gboolean text-set Read / Write
char * tooltip-text Read / Write

Types and Values

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── GtkSourceSnippetChunk

Includes

#include <gtksourceview/gtksource.h>

Description

The GtkSourceSnippetChunk represents a single chunk of text that may or may not be an edit point within the snippet. Chunks that are an edit point (also called a tab stop) have the “focus-position” property set.

Functions

gtk_source_snippet_chunk_copy ()

GtkSourceSnippetChunk *
gtk_source_snippet_chunk_copy (GtkSourceSnippetChunk *chunk);

Copies the source snippet.

Parameters

Returns

A GtkSourceSnippetChunk.

[transfer full]

Since: 5.0


gtk_source_snippet_chunk_get_context ()

GtkSourceSnippetContext *
gtk_source_snippet_chunk_get_context (GtkSourceSnippetChunk *chunk);

Gets the context for the snippet insertion.

Parameters

Returns

A GtkSourceSnippetContext.

[transfer none]

Since: 5.0


gtk_source_snippet_chunk_get_focus_position ()

gint
gtk_source_snippet_chunk_get_focus_position
                               (GtkSourceSnippetChunk *chunk);

Gets the “focus-position”.

The focus-position is used to determine how many tabs it takes for the snippet to advanced to this chunk.

A focus-position of zero will be the last focus position of the snippet and snippet editing ends when it has been reached.

A focus-position of -1 means the chunk cannot be focused by the user.

Parameters

Returns

the focus-position

Since: 5.0


gtk_source_snippet_chunk_get_spec ()

const gchar *
gtk_source_snippet_chunk_get_spec (GtkSourceSnippetChunk *chunk);

Gets the specification for the chunk.

The specification is evaluated for variables when other chunks are edited within the snippet context. If the user has changed the text, the “text” and “text-set” properties are updated.

Parameters

Returns

the specification, if any.

[transfer none][nullable]

Since: 5.0


gtk_source_snippet_chunk_get_text ()

const gchar *
gtk_source_snippet_chunk_get_text (GtkSourceSnippetChunk *chunk);

Gets the “text” property.

The text property is updated when the user edits the text of the chunk. If it has not been edited, the “spec” property is returned.

Parameters

Returns

the text of the chunk.

[not nullable]

Since: 5.0


gtk_source_snippet_chunk_get_text_set ()

gboolean
gtk_source_snippet_chunk_get_text_set (GtkSourceSnippetChunk *chunk);

Gets the “text-set” property.

This is typically set when the user has edited a snippet chunk.

Parameters

Since: 5.0


gtk_source_snippet_chunk_new ()

GtkSourceSnippetChunk *
gtk_source_snippet_chunk_new (void);

Create a new GtkSourceSnippetChunk that can be added to a GtkSourceSnippet.

Since: 5.0


gtk_source_snippet_chunk_set_context ()

void
gtk_source_snippet_chunk_set_context (GtkSourceSnippetChunk *chunk,
                                      GtkSourceSnippetContext *context);

gtk_source_snippet_chunk_set_focus_position ()

void
gtk_source_snippet_chunk_set_focus_position
                               (GtkSourceSnippetChunk *chunk,
                                gint focus_position);

Sets the “focus-position” property.

The focus-position is used to determine how many tabs it takes for the snippet to advanced to this chunk.

A focus-position of zero will be the last focus position of the snippet and snippet editing ends when it has been reached.

A focus-position of -1 means the chunk cannot be focused by the user.

Parameters

chunk

a GtkSourceSnippetChunk

 

focus_position

the focus-position

 

Since: 5.0


gtk_source_snippet_chunk_set_spec ()

void
gtk_source_snippet_chunk_set_spec (GtkSourceSnippetChunk *chunk,
                                   const gchar *spec);

Sets the specification for the chunk.

The specification is evaluated for variables when other chunks are edited within the snippet context. If the user has changed the text, the “text” and “text-set” properties are updated.

Parameters

chunk

a GtkSourceSnippetChunk

 

spec

the new specification for the chunk

 

Since: 5.0


gtk_source_snippet_chunk_set_text ()

void
gtk_source_snippet_chunk_set_text (GtkSourceSnippetChunk *chunk,
                                   const gchar *text);

Sets the text for the snippet chunk.

This is usually used by the snippet engine to update the text, but may be useful when creating custom snippets to avoid expansion of any specification.

Parameters

chunk

a GtkSourceSnippetChunk

 

text

the text of the property

 

Since: 5.0


gtk_source_snippet_chunk_set_text_set ()

void
gtk_source_snippet_chunk_set_text_set (GtkSourceSnippetChunk *chunk,
                                       gboolean text_set);

Sets the “text-set” property.

This is typically set when the user has edited a snippet chunk by the snippet engine.

Parameters

chunk

a GtkSourceSnippetChunk

 

text_set

the property value

 

Since: 5.0

Types and Values

GtkSourceSnippetChunk

typedef struct _GtkSourceSnippetChunk GtkSourceSnippetChunk;

Property Details

The “context” property

  “context”                  GtkSourceSnippetContext *

The snippet context.

Owner: GtkSourceSnippetChunk

Flags: Read / Write


The “focus-position” property

  “focus-position”           int

The focus position for the chunk.

Owner: GtkSourceSnippetChunk

Flags: Read / Write

Allowed values: >= -1

Default value: -1


The “spec” property

  “spec”                     char *

The specification to expand using the context.

Owner: GtkSourceSnippetChunk

Flags: Read / Write

Default value: NULL


The “text” property

  “text”                     char *

The text for the chunk.

Owner: GtkSourceSnippetChunk

Flags: Read / Write

Default value: NULL


The “text-set” property

  “text-set”                 gboolean

If the text property has been manually set.

Owner: GtkSourceSnippetChunk

Flags: Read / Write

Default value: FALSE


The “tooltip-text” property

  “tooltip-text”             char *

The tooltip text for the chunk.

Owner: GtkSourceSnippetChunk

Flags: Read / Write

Default value: NULL