Top |
TeplBufferTeplBuffer — Subclass of GtkSourceBuffer |
char * | tepl-full-title | Read |
char * | tepl-short-title | Read |
char * | tepl-style-scheme-id | Read / Write |
GEnum ╰── TeplSelectionType GObject ╰── GtkTextBuffer ╰── GtkSourceBuffer ╰── TeplBuffer
TeplBuffer is a subclass of GtkSourceBuffer, to add more features useful for a text editor.
It also adds an association to a TeplFile that can be retrieved with
tepl_buffer_get_file()
. The association cannot change. The same for
TeplMetadata with tepl_buffer_get_metadata()
.
The properties and signals have the tepl namespace, to avoid potential conflicts in the future if the property or signal is moved to GtkSourceBuffer.
TeplFile *
tepl_buffer_get_file (TeplBuffer *buffer
);
Returns the TeplFile of buffer
. The returned object is guaranteed to be the
same for the lifetime of buffer
.
TeplBuffer creates the TeplFile with tepl_abstract_factory_create_file()
.
Since: 1.0
TeplMetadata *
tepl_buffer_get_metadata (TeplBuffer *buffer
);
Returns the TeplMetadata of buffer
. The returned object is guaranteed to be
the same for the lifetime of buffer
.
Since: 5.0
void
tepl_buffer_load_metadata_from_metadata_manager
(TeplBuffer *buffer
);
Calls tepl_metadata_manager_copy_from()
for “location” (if not NULL
)
to the associated TeplMetadata of buffer
.
Since: 5.0
void
tepl_buffer_save_metadata_into_metadata_manager
(TeplBuffer *buffer
);
Calls tepl_metadata_manager_merge_into()
for “location” (if not
NULL
) from the associated TeplMetadata of buffer
.
Since: 5.0
gboolean
tepl_buffer_is_untouched (TeplBuffer *buffer
);
Returns whether buffer
is untouched.
This function is for example useful to know if we can re-use this buffer to load a file, instead of opening a new tab or window.
For this function to return TRUE
, the buffer
must be empty, non-modified,
the undo/redo GtkSourceBuffer history must be empty, and the
“location” must be NULL
.
Since: 1.0
gchar *
tepl_buffer_get_short_title (TeplBuffer *buffer
);
Returns a title suitable for a tab label. It contains (in that order):
'*' if the buffer is modified;
the “short-name”.
Since: 3.0
gchar *
tepl_buffer_get_full_title (TeplBuffer *buffer
);
Returns a title suitable for a GtkWindow title. It contains (in that order):
the “tepl-short-title”;
the directory path in parenthesis if the “location” isn't
NULL
.
Since: 3.0
void tepl_buffer_provide_style_scheme_id_gsetting (TeplBuffer *buffer
,GSettings *settings
,const gchar *setting_key
,gboolean bind_to_property
);
A convenience function to provide a GSettings key corresponding to the “tepl-style-scheme-id” property.
Once this function is called, calling tepl_buffer_set_style_scheme_id()
or
setting the property will benefit from a fallback mechanism that takes the
default value of the GSettings key (see g_settings_get_default_value()
).
If bind_to_property
is TRUE
, then this function additionally binds the
GSettings key to the property with the G_SETTINGS_BIND_GET
flag.
buffer |
a TeplBuffer. |
|
settings |
a GSettings object. |
|
setting_key |
a GSettings key of type string. |
|
bind_to_property |
whether to bind the GSettings key to the property. |
Since: 6.4
gchar *
tepl_buffer_get_style_scheme_id (TeplBuffer *buffer
);
Since: 2.0
void tepl_buffer_set_style_scheme_id (TeplBuffer *buffer
,const gchar *style_scheme_id
);
Sets the “tepl-style-scheme-id” property.
The GtkSourceStyleScheme is taken from the default
GtkSourceStyleSchemeManager as returned by
gtk_source_style_scheme_manager_get_default()
.
Since 6.4, if there are no GtkSourceStyleScheme for style_scheme_id
, there
is a fallback mechanism that takes the default value of the provided
GSettings key (see tepl_buffer_provide_style_scheme_id_gsetting()
); if the
GSettings key was not provided, it takes a recommended GtkSourceStyleScheme
provided by GtkSourceView (see the documentation of
gtk_source_buffer_set_style_scheme()
).
If more flexibility is desired, don't use the “tepl-style-scheme-id” property, use the GtkSourceBuffer API instead.
Since: 2.0
TeplSelectionType
tepl_buffer_get_selection_type (TeplBuffer *buffer
);
Since: 1.0
“tepl-full-title”
property “tepl-full-title” char *
The full title. See tepl_buffer_get_full_title()
.
Owner: TeplBuffer
Flags: Read
Default value: NULL
Since: 3.0
“tepl-short-title”
property “tepl-short-title” char *
The short title. See tepl_buffer_get_short_title()
.
Owner: TeplBuffer
Flags: Read
Default value: NULL
Since: 3.0
“tepl-style-scheme-id”
property “tepl-style-scheme-id” char *
The “style-scheme” ID, as a string. This property is useful for binding it to a GSettings key.
When the “style-scheme” is NULL
,
“tepl-style-scheme-id” contains the empty string.
Owner: TeplBuffer
Flags: Read / Write
Default value: ""
Since: 2.0
“tepl-cursor-moved”
signalvoid user_function (TeplBuffer *buffer, gpointer user_data)
The ::tepl-cursor-moved signal is emitted when the insert mark is moved explicitely or when the buffer changes (insert/delete).
A typical use-case for this signal is to update the cursor position in a statusbar.
buffer |
the TeplBuffer emitting the signal. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run First
Since: 2.0