Gjsify LogoGjsify Logo

Index

Enumerations

Classes

Interfaces

Type Aliases

Variables

Functions

Type Aliases

AppSourceKind: AppStreamGlib.FormatKind
ImageAlphaFlags: number
Node: GLib.Node

Variables

APP_SUBSUME_FLAG_DEDUPE: number
APP_SUBSUME_FLAG_MERGE: number
IMAGE_ALPHA_FLAG_BOTTOM: number
IMAGE_ALPHA_FLAG_INTERNAL: number
IMAGE_ALPHA_FLAG_LEFT: number
IMAGE_ALPHA_FLAG_NONE: number
IMAGE_ALPHA_FLAG_RIGHT: number
IMAGE_ALPHA_FLAG_TOP: number
IMAGE_LARGE_HEIGHT: number
IMAGE_LARGE_WIDTH: number
IMAGE_NORMAL_HEIGHT: number
IMAGE_NORMAL_WIDTH: number
IMAGE_THUMBNAIL_HEIGHT: number
IMAGE_THUMBNAIL_WIDTH: number

Functions

  • id_kind_from_string(id_kind: string): IdKind
  • id_kind_to_string(id_kind: IdKind): string
  • inf_get_driver_version(keyfile: GLib.KeyFile, timestamp: number): string
  • Repairs .inf file data and opens it as a keyfile.

    Important: The group and keynames are all forced to lower case as INF files are specified as case insensitive and GKeyFile is case sensitive. Any backslashes or spaces in the key name are also converted to '_'.

    Parameters

    • keyfile: GLib.KeyFile

      a #GKeyFile

    • data: string

      the .inf file date to parse

    • flags: InfLoadFlags

      #AsInfLoadFlags, e.g. %AS_INF_LOAD_FLAG_NONE

    Returns boolean

  • kudo_kind_from_string(kudo_kind: string): KudoKind
  • kudo_kind_to_string(kudo_kind: KudoKind): string
  • markup_convert_simple(markup: string): string
  • markup_strsplit_words(text: string, line_len: number): string[]
  • Splits up a long line into an array of smaller strings, each being no longer than line_len. Words are not split.

    Parameters

    • text: string

      the text to split.

    • line_len: number

      the maximum length of the output line

    Returns string[]

  • markup_validate(markup: string): boolean
  • node_error_quark(): Quark
  • node_get_attribute(node: GLib.Node, key: string): string
  • node_get_attribute_as_int(node: GLib.Node, key: string): number
  • node_get_attribute_as_uint(node: GLib.Node, key: string): number
  • node_get_comment(node: GLib.Node): string
  • node_get_localized_best(node: GLib.Node, key: string): string
  • Denormalize AppData data like this:

    |[

    Hi

    Czesc

    • First
    • Pierwszy



    into a hash that contains:

    |[
    "C" -> "<p>Hi</p><ul><li>First</li></ul>"
    "pl" -> "<p>Czesc</p><ul><li>Pierwszy</li></ul>"

    Parameters

    Returns HashTable

  • node_insert_hash(parent: GLib.Node, name: string, attr_key: string, hash: HashTable<string | number | symbol, string | number | boolean>, insert_flags: NodeInsertFlags): void
  • Inserts a hash table of data into the DOM.

    Parameters

    • parent: GLib.Node

      a parent #AsNode.

    • name: string

      the tag name, e.g. "id".

    • attr_key: string

      the key to use as the attribute in the XML, e.g. "key".

    • hash: HashTable<string | number | symbol, string | number | boolean>

      the hash table with the key as the key to use in the XML.

    • insert_flags: NodeInsertFlags

      any %AsNodeInsertFlags.

    Returns void

  • node_insert_localized(parent: GLib.Node, name: string, localized: HashTable<string | number | symbol, string | number | boolean>, insert_flags: NodeInsertFlags): void
  • Inserts a localized key into the DOM.

    Parameters

    • parent: GLib.Node

      a parent #AsNode.

    • name: string

      the tag name, e.g. "id".

    • localized: HashTable<string | number | symbol, string | number | boolean>

      the hash table of data, with the locale as the key.

    • insert_flags: NodeInsertFlags

      any %AsNodeInsertFlags.

    Returns void

  • utils_appstream_id_build(str: string): string
  • Fixes a string to be a valid AppStream ID.

    This function replaces any invalid chars with an underscore.

    Parameters

    • str: string

      a string to build the AppStream ID from

    Returns string

  • utils_appstream_id_valid(str: string): boolean
  • Checks to see if a string is a valid AppStream ID. A valid AppStream ID only contains alphanumeric chars, dots and dashes.

    Parameters

    • str: string

      a string

    Returns boolean

  • utils_error_quark(): Quark
  • utils_find_icon_filename(destdir: string, search: string): string
  • Finds an icon filename from a filesystem root.

    Parameters

    • destdir: string

      the destdir.

    • search: string

      the icon search name, e.g. "microphone.svg"

    Returns string

  • utils_find_icon_filename_full(destdir: string, search: string, flags: UtilsFindIconFlag): string
  • utils_guid_from_data(namespace_id: string, data: number, data_len: number): string
  • Returns a GUID for some data. This uses a hash and so even small differences in the data will produce radically different return values.

    The implementation is taken from RFC4122, Section 4.1.3; specifically using a type-5 SHA-1 hash.

    Parameters

    • namespace_id: string

      A namespace ID, e.g. "6ba7b810-9dad-11d1-80b4-00c04fd430c8"

    • data: number

      data to hash

    • data_len: number

      length of data

    Returns string

  • utils_guid_from_string(str: string): string
  • Returns a GUID for a given string. This uses a hash and so even small differences in the str will produce radically different return values.

    The implementation is taken from RFC4122, Section 4.1.3; specifically using a type-5 SHA-1 hash with a DNS namespace. The same result can be obtained with this simple python program:

    #!/usr/bin/python import uuid print uuid.uuid5(uuid.NAMESPACE_DNS, 'python.org')

    Parameters

    • str: string

      A source string to use as a key

    Returns string

  • utils_guid_is_valid(guid: string): boolean
  • utils_install_filename(location: UtilsLocation, filename: string, origin: string, destdir: string): boolean
  • Installs an AppData, MetaInfo, AppStream XML or AppStream Icon metadata file.

    Parameters

    • location: UtilsLocation

      the #AsUtilsLocation, e.g. %AS_UTILS_LOCATION_CACHE

    • filename: string

      the full path of the file to install

    • origin: string

      the origin to use for the installation, or %NULL

    • destdir: string

      the destdir to use, or %NULL

    Returns boolean

  • utils_is_blacklisted_id(desktop_id: string): boolean
  • utils_is_category_id(category_id: string): boolean
  • utils_is_environment_id(environment_id: string): boolean
  • utils_is_spdx_license(license: string): boolean
  • Checks the licence string to check it being a valid licence. NOTE: SPDX licences can't typically contain brackets.

    Parameters

    • license: string

      a SPDX license string, e.g. "CC-BY-3.0 and GFDL-1.3"

    Returns boolean

  • utils_is_spdx_license_id(license_id: string): boolean
  • utils_is_stock_icon_name(name: string): boolean
  • utils_license_to_spdx(license: string): string
  • Converts a non-SPDX license into an SPDX format string where possible.

    Parameters

    • license: string

      a not-quite SPDX license string, e.g. "GPLv3+"

    Returns string

  • utils_search_token_valid(token: string): boolean
  • Checks the search token if it is valid. Valid tokens are at least 3 chars in length, not common words like "and", and do not contain markup.

    Parameters

    • token: string

      the search token

    Returns boolean

  • utils_search_tokenize(search: string): string[]
  • Splits up a string into tokens and returns tokens that are suitable for searching. This includes taking out common words and casefolding the returned search tokens.

    Parameters

    • search: string

      the search string

    Returns string[]

  • utils_spdx_license_detokenize(license_tokens: string): string
  • De-tokenizes the SPDX licenses into a string.

    Parameters

    • license_tokens: string

      license tokens, typically from as_utils_spdx_license_tokenize()

    Returns string

  • utils_spdx_license_tokenize(license: string): string[]
  • Tokenizes the SPDX license string (or any simarly formatted string) into parts. Any licence parts of the string e.g. "LGPL-2.0+" are prefexed with "", the conjunctive replaced with "&" and the disjunctive replaced with "|". Brackets are added as indervidual tokens and other strings are appended into single tokens where possible.

    Parameters

    • license: string

      a license string, e.g. "LGPLv2+ and (QPL or GPLv2) and MIT"

    Returns string[]

  • utils_string_replace(string: GLib.String, search: string, replace: string): number
  • Performs multiple search and replace operations on the given string.

    Parameters

    • string: GLib.String

      The #GString to operate on

    • search: string

      The text to search for

    • replace: string

      The text to use for substitutions

    Returns number

  • Builds a valid unique ID using available data.

    Parameters

    • scope: AppScope

      a #AsAppScope e.g. %AS_APP_SCOPE_SYSTEM

    • bundle_kind: AppStreamGlib.BundleKind

      System, e.g. 'package' or 'flatpak'

    • origin: string

      Origin, e.g. 'fedora' or 'gnome-apps-nightly'

    • kind: AppKind

      #AsAppKind, e.g. %AS_APP_KIND_DESKTOP

    • id: string

      AppStream ID, e.g. 'gimp.desktop'

    • branch: string

      Branch, e.g. '3-20' or 'master'

    Returns string

  • utils_unique_id_equal(unique_id1: string, unique_id2: string): boolean
  • Checks two unique IDs for equality allowing globs to match.

    Parameters

    • unique_id1: string

      a unique ID

    • unique_id2: string

      another unique ID

    Returns boolean

  • utils_unique_id_hash(unique_id: string): number
  • Converts a unique-id to a hash value.

    This function implements the widely used DJB hash on the ID subset of the unique-id string.

    It can be passed to g_hash_table_new() as the hash_func parameter, when using non-NULL strings or unique_ids as keys in a GHashTable.

    Parameters

    • unique_id: string

      a unique ID

    Returns number

  • utils_unique_id_match(unique_id1: string, unique_id2: string, match_flags: UniqueIdMatchFlags): boolean
  • Checks two unique IDs for equality allowing globs to match, whilst also allowing clients to whitelist sections that have to match.

    Parameters

    • unique_id1: string

      a unique ID

    • unique_id2: string

      another unique ID

    • match_flags: UniqueIdMatchFlags

      a #AsUniqueIdMatchFlags bitfield, e.g. %AS_UNIQUE_ID_MATCH_FLAG_ID

    Returns boolean

  • utils_unique_id_valid(unique_id: string): boolean
  • utils_vercmp(version_a: string, version_b: string): number
  • Compares version numbers for sorting.

    Parameters

    • version_a: string

      the release version, e.g. 1.2.3

    • version_b: string

      the release version, e.g. 1.2.3.1

    Returns number

  • utils_vercmp_full(version_a: string, version_b: string, flags: VersionCompareFlag): number
  • utils_version_parse(version: string): string
  • Returns a dotted decimal version string from a version string. The supported formats are:

    • Dotted decimal, e.g. "1.2.3"
    • Base 16, a hex number with a 0x prefix, e.g. "0x10203"
    • Base 10, a string containing just [0-9], e.g. "66051"
    • Date in YYYYMMDD format, e.g. 20150915

    Anything with a '.' or that doesn't match [0-9] or 0x[a-f,0-9] is considered a string and returned without modification.

    Parameters

    • version: string

      A version number

    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