Gjsify LogoGjsify Logo

Index

Enumerations

Classes

Interfaces

Functions

Functions

  • 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.

    Returns Tepl.Encoding[]

  • fileLoaderErrorQuark(): Quark
  • fileSaverErrorQuark(): Quark
  • finalize(): void
  • 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.

    Returns void

  • init(): void
  • 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().

    Returns void

  • When a %G_IO_ERROR_CANT_CREATE_BACKUP error occurs while saving location, offer two possible actions:

    • Save anyway: %GTK_RESPONSE_YES.
    • Don't save: %GTK_RESPONSE_CANCEL.

    Parameters

    • location: Gio.File

      the #GFile for which the backup failed to be created.

    • error: GLib.Error

      must be a %G_IO_ERROR_CANT_CREATE_BACKUP.

    Returns Tepl.InfoBar

  • ioErrorInfoBarExternallyModified(location: Gio.File, documentModified: boolean): Tepl.InfoBar
  • Creates a warning about location having changed on disk. The possible actions:

    • Depending on document_modified, "Reload" or "Drop changes and reload": %GTK_RESPONSE_OK.
    • A close button as added with gtk_info_bar_set_show_close_button().

    Parameters

    • location: Gio.File

      the #GFile for which there has been an external modification.

    • documentModified: boolean

      whether the document (e.g. the #GtkTextBuffer) has unsaved modifications.

    Returns Tepl.InfoBar

  • Creates a warning about location being already open in another window, offering two possible actions:

    • Edit anyway: %GTK_RESPONSE_YES.
    • Don't edit: %GTK_RESPONSE_CANCEL.

    Parameters

    • location: Gio.File

      the #GFile already open in another window.

    Returns Tepl.InfoBar

  • For file saving, creates a warning about invalid characters that can corrupt the file. Possible actions:

    • Save anyway: %GTK_RESPONSE_YES.
    • Don't save: %GTK_RESPONSE_CANCEL.

    Parameters

    • location: Gio.File

      where to save the document.

    Returns Tepl.InfoBar

  • 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.

    Parameters

    Returns string

  • 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.

    Parameters

    Returns void

  • metadataManagerInit(metadataPath: string): void
  • 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().

    Parameters

    • metadataPath: string

      the filename where the metadata is stored.

    Returns void

  • metadataManagerShutdown(): void
  • 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.

    Returns void

  • Synchronously creates parent directories of file, so that file can be saved.

    Parameters

    Returns boolean

  • utilsDecodeUri(uri: string): [boolean, string, string, string, string, string]
  • 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().

    Parameters

    • uri: string

      the uri to decode

    Returns [boolean, string, string, string, string, string]

  • utilsGetFileExtension(filename: string): string
  • Examples:

    • "file.pdf" returns ".pdf".
    • "file.PDF" returns ".pdf".
    • "file.tar.gz" returns ".gz".
    • "path/to/file.pdf" returns ".pdf".
    • "file" (without an extension) returns "" (the empty string).

    Parameters

    • filename: string

      a filename.

    Returns string

  • utilsGetFileShortname(filename: string): string
  • 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.

    Parameters

    • filename: string

      a filename.

    Returns string

  • utilsReplaceHomeDirWithTilde(filename: string): string
  • Replaces the home directory with a tilde, if the home directory is present in the filename.

    Parameters

    • filename: string

      the filename.

    Returns string

  • utilsStrEndTruncate(str: string, truncateLength: number): string
  • Like tepl_utils_str_middle_truncate() but the “…” character is at the end.

    Parameters

    • str: string

      a UTF-8 string.

    • truncateLength: number

      truncate the string at that length, in UTF-8 characters (not bytes).

    Returns string

  • utilsStrMiddleTruncate(str: string, truncateLength: number): string
  • 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.

    Parameters

    • str: string

      a UTF-8 string.

    • truncateLength: number

      truncate the string at that length, in UTF-8 characters (not bytes).

    Returns string

  • utilsStrReplace(string: string, search: string, replacement: string): string
  • 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

    Parameters

    • string: string
    • search: string
    • replacement: string

    Returns string

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method