Top | ![]() |
![]() |
![]() |
![]() |
GtkSourceSnippetContextGtkSourceSnippetContext — Context for expanding GtkSourceSnippetChunk |
This class is currently used primary as a hashtable. However, the longer term goal is to have it hold onto a GjsContext as well as other languages so that GtkSourceSnippetChunk can expand themselves by executing script within the context.
The GtkSourceSnippet will build the context and then expand each of the chunks during the insertion/edit phase.
void
gtk_source_snippet_context_clear_variables
(GtkSourceSnippetContext *self
);
Removes all variables from the context.
Since: 5.0
gchar * gtk_source_snippet_context_expand (GtkSourceSnippetContext *self
,const gchar *input
);
const gchar * gtk_source_snippet_context_get_variable (GtkSourceSnippetContext *self
,const gchar *key
);
Gets the current value for a variable named key
.
Since: 5.0
GtkSourceSnippetContext *
gtk_source_snippet_context_new (void
);
Creates a new GtkSourceSnippetContext.
Generally, this isn't needed unless you are controlling the expansion of snippets manually.
Since: 5.0
void gtk_source_snippet_context_set_constant (GtkSourceSnippetContext *self
,const gchar *key
,const gchar *value
);
Sets a constatnt within the context. This is similar to
a variable set with gtk_source_snippet_context_set_variable()
but is expected to not change during use of the snippet.
Examples would be the date or users name.
Since: 5.0
void gtk_source_snippet_context_set_line_prefix (GtkSourceSnippetContext *self
,const gchar *line_prefix
);
void gtk_source_snippet_context_set_tab_width (GtkSourceSnippetContext *self
,gint tab_width
);
void gtk_source_snippet_context_set_use_spaces (GtkSourceSnippetContext *self
,gboolean use_spaces
);
void gtk_source_snippet_context_set_variable (GtkSourceSnippetContext *self
,const gchar *key
,const gchar *value
);
Sets a variable within the context.
This variable may be overridden by future updates to the context.
Since: 5.0
“changed”
signalvoid user_function (GtkSourceSnippetContext *sourcesnippetcontext, gpointer user_data)
The "changed" signal is emitted when a change has been discovered in one of the chunks of the snippet which has caused a variable or other dynamic data within the context to have changed.
Flags: Run First
Since: 5.0