Gjsify LogoGjsify Logo

Index

Enumerations

Classes

Interfaces

Functions

Functions

  • finalize(): void
  • Free the resources allocated by Tepl. For example it unrefs the singleton objects.

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

  • This function will generate CSS suitable for the GTK CSS engine based on the properties of the #PangoFontDescription.

    The returned string contains only the CSS declarations, it is not a complete CSS rule set. So the selector and curly braces are not present. Each declaration, including the last one, ends with a semicolon.

    Parameters

    Returns string

  • utilsBindingTransformFuncSmartBool(binding: Binding, fromValue: any, toValue: any, userData: object): boolean
  • A #GBindingTransformFunc to transform between these two #GValue types:

    • A #GValue of type #gboolean.
    • A #GValue of type #GVariant, with the #GVariant of type boolean.

    For convenience, this function works in both directions (hence the “smart”), it introspects the types of from_value and to_value.

    Note that if from_value and to_value are of the same #GValue type, this function won't work and you shouldn't use a custom #GBindingTransformFunc in the first place.

    Parameters

    • binding: Binding

      a #GBinding.

    • fromValue: any

      the #GValue containing the value to transform.

    • toValue: any

      the #GValue in which to store the transformed value.

    • userData: object

      data passed to the transform function.

    Returns boolean

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

  • The asynchronous version of g_file_query_exists(). When the operation is finished, callback will be called. You can then call tepl_utils_file_query_exists_finish() to get the result of the operation.

    Parameters

    Returns void

  • Finishes the operation started with tepl_utils_file_query_exists_async(). There is no output #GError parameter, so you should check if the operation has been cancelled (in which case %FALSE will be returned).

    Parameters

    Returns boolean

  • 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

  • Removes all rows of list_box, to obtain an empty #GtkListBox.

    Parameters

    Returns void

  • Gets an array of all the #GtkListBoxRow childen of list_box for which filter_func returns %TRUE. The elements in the array are sorted by increasing index order (as returned by gtk_list_box_row_get_index()).

    Parameters

    Returns [Gtk.ListBoxRow[] | null, number]

  • This function has the same semantics as gtk_list_box_get_row_at_index(), but it takes into account only the rows for which filter_func returns %TRUE.

    As an example, if index is 0, it returns the first #GtkListBoxRow for which filter_func returns %TRUE.

    Parameters

    • listBox: Gtk.ListBox

      a #GtkListBox.

    • index: number

      the index of the row, starting at 0. The index is among the filtered rows only.

    • filterFunc: Gtk.ListBoxFilterFunc

      non-%NULL callback function.

    Returns Gtk.ListBoxRow | null

  • Scrolls to a specific #GtkListBoxRow.

    Before using this function, tepl_utils_list_box_setup_scrolling() must have been called.

    Parameters

    Returns void

  • utilsListBoxScrollToSelectedRow(listBox: Gtk.ListBox): void
  • Calls tepl_utils_list_box_scroll_to_row() on the row returned by gtk_list_box_get_selected_row(). This function assumes that there is either zero or one selected row.

    Before using this function, tepl_utils_list_box_setup_scrolling() must have been called.

    Parameters

    Returns void

  • Setup vertical scrolling between list_box and scrolled_window, to be able to use tepl_utils_list_box_scroll_to_row() afterwards.

    This function is intended to be called only once per #GtkListBox, when initializing the list_box and scrolled_window widgets.

    Parameters

    Returns void

  • utilsMarkupEscapeText(src: string): string | null
  • The same as g_markup_escape_text(), but with an implementation that fully supports round-trip integrity. I.e. when #GMarkupParser or any other XML parser will decode/unescape the string, the exact same string as src will be brought back. As long as src is a valid UTF-8 string.

    The other difference with g_markup_escape_text() is that the length parameter is not present for tepl_utils_markup_escape_text().

    g_markup_escape_text() doesn't fully support round-trip integrity

    In fact, g_markup_escape_text() doesn't escape the tabstop, newline and carriage return characters. And the #GMarkupParser correctly processes whitespace and line endings according to the XML rules for normalization of line endings and attribute values.

    For example "\t" (a tab) after a round-trip through g_markup_escape_text() and #GMarkupParser becomes a simple space.

    Parameters

    • src: string

      a nul-terminated UTF-8 string.

    Returns string | null

  • 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