Gets the list of default candidate encodings to try when loading a file. See gtk_source_file_loader_set_candidate_encodings().
This function returns a different list depending on the current locale (i.e. language, country and default encoding). The UTF-8 encoding and the current locale encoding are guaranteed to be present in the returned list.
Note that the returned list doesn't contain all encodings known by #TeplEncoding, it is a limited list that contains only the encodings that have the most likelihood to fit for the current locale.
Free the resources allocated by Tepl. For example it unrefs the singleton objects. It also properly shutdowns the metadata manager by calling tepl_metadata_manager_shutdown().
This function also calls amtk_finalize() and gtk_source_finalize().
It is not mandatory to call this function, it's just to be friendlier to memory debugging tools (but if you don't call this function and you use the metadata manager, you should call tepl_metadata_manager_shutdown()). This function is meant to be called at the end of main(). It can be called several times.
Initializes the Tepl library (e.g. for the internationalization).
This function can be called several times, but is meant to be called at the beginning of main(), before any other Tepl function call.
This function also calls amtk_init() and gtk_source_init().
When a %G_IO_ERROR_CANT_CREATE_BACKUP error occurs while saving location,
offer two possible actions:
the #GFile for which the backup failed to be created.
must be a %G_IO_ERROR_CANT_CREATE_BACKUP.
Creates a warning about location
having changed on disk. The possible
actions:
document_modified,
"Reload" or "Drop changes and reload":
%GTK_RESPONSE_OK.the #GFile for which there has been an external modification.
whether the document (e.g. the #GtkTextBuffer) has unsaved modifications.
Gets the indentation, as a string, of the line at iter
. iter
can be
anywhere in the line.
Possible use-case: to implement an action that inserts some text in a #GtkTextBuffer. If the text to insert spans multiple lines, it is usually desired to keep the same indentation level.
Appends #GtkMenuItem's to menu_shell
for the following #GAction's:
"win.tepl-cut"
"win.tepl-copy"
"win.tepl-paste"
"win.tepl-delete"
"win.tepl-select-all"
See the [list of GActions implemented in TeplApplicationWindow][tepl-application-window-gactions]. This function correctly uses the %AMTK_FACTORY_IGNORE_ACCELS_FOR_APP flag to create the #GtkMenuItem's.
This function initializes the metadata manager.
The metadata_path
must be different for each process. It is advised for your
application to rely on #GApplication process uniqueness.
A good place to store the metadata is in a sub-directory of the user data directory. See g_get_user_data_dir().
the filename where the metadata is stored.
This function saves synchronously metadata if they need to be saved, and frees the internal data of the metadata manager.
See also tepl_finalize(), which calls this function.
Synchronously creates parent directories of file,
so that file
can be
saved.
a file
optional #GCancellable object, %NULL to ignore.
Parse and break an uri apart in its individual components like the uri scheme, user info, host, port and path. The return value pointer can be %NULL to ignore certain parts of the uri. If the function returns %TRUE, then all return value pointers should be freed using g_free().
the uri to decode
Examples:
a filename.
Returns filename
without its extension. With the “extension” having the same
definition as in tepl_utils_get_file_extension(); in other words it returns
the other part of filename
.
a filename.
Replaces the home directory with a tilde, if the home directory is present in
the filename
.
the filename.
Like tepl_utils_str_middle_truncate() but the “…” character is at the end.
a UTF-8 string.
truncate the string at that length, in UTF-8 characters (not bytes).
If str
is longer than truncate_length,
then this function returns str
truncated in the middle with a “…” character. Otherwise it just returns a
copy of str
.
a UTF-8 string.
truncate the string at that length, in UTF-8 characters (not bytes).
Replaces all occurences of search
by replacement
.
The function does only one pass, for example: |[ tepl_utils_str_replace ("aaaa", "aa", "a");
returns "aa", not "a".
@param string a string
@param search the search string
@param replacement the replacement string
Gets a list of all encodings known by #TeplEncoding.