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

  • idKindFromString(idKind: string): IdKind
  • idKindToString(idKind: IdKind): string
  • infGetDriverVersion(keyfile: GLib.KeyFile, timestamp: number): string
  • Parses the DriverVer string into a recognisable version and timestamp;

    Parameters

    • keyfile: GLib.KeyFile

      a #GKeyFile

    • timestamp: number

      the returned driverver timestamp, or %NULL

    Returns 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

  • Repairs an .inf file and opens it as a keyfile.

    Parameters

    • keyfile: GLib.KeyFile

      a #GKeyFile

    • filename: string

      the .inf file to open

    • flags: InfLoadFlags

      #AsInfLoadFlags, e.g. %AS_INF_LOAD_FLAG_NONE

    Returns boolean

  • kudoKindFromString(kudoKind: string): KudoKind
  • kudoKindToString(kudoKind: KudoKind): string
  • Converts an XML description into a printable form.

    Parameters

    • markup: string

      the text to copy.

    • format: MarkupConvertFormat

      the #AsMarkupConvertFormat, e.g. %AS_MARKUP_CONVERT_FORMAT_MARKDOWN

    Returns string

  • Converts an XML description into a printable form.

    Parameters

    • markup: string

      the text to copy.

    • format: MarkupConvertFormat

      the #AsMarkupConvertFormat, e.g. %AS_MARKUP_CONVERT_FORMAT_MARKDOWN

    • flags: MarkupConvertFlag

      the #AsMarkupConvertFlag, e.g. %AS_MARKUP_CONVERT_FLAG_IGNORE_ERRORS

    Returns string

  • markupConvertSimple(markup: string): string
  • Converts an XML description into a printable form.

    Parameters

    • markup: string

      the text to copy.

    Returns string

  • Imports text and converts to AppStream markup.

    Parameters

    • text: string

      the text to import.

    • format: MarkupConvertFormat

      the #AsMarkupConvertFormat, e.g. %AS_MARKUP_CONVERT_FORMAT_SIMPLE

    Returns string

  • markupStrsplitWords(text: string, lineLen: 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.

    • lineLen: number

      the maximum length of the output line

    Returns string[]

  • markupValidate(markup: string): boolean
  • nodeGetAttribute(node: GLib.Node, key: string): string
  • nodeGetAttributeAsInt(node: GLib.Node, key: string): number
  • nodeGetAttributeAsUint(node: GLib.Node, key: string): number
  • nodeGetLocalizedBest(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

  • nodeInsertHash(parent: GLib.Node, name: string, attrKey: string, hash: HashTable<string | number | symbol, string | number | boolean>, insertFlags: 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".

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

    • insertFlags: NodeInsertFlags

      any %AsNodeInsertFlags.

    Returns void

  • nodeInsertLocalized(parent: GLib.Node, name: string, localized: HashTable<string | number | symbol, string | number | boolean>, insertFlags: 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.

    • insertFlags: NodeInsertFlags

      any %AsNodeInsertFlags.

    Returns void

  • utilsAppstreamIdBuild(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

  • utilsAppstreamIdValid(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

  • utilsFindIconFilename(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

  • utilsFindIconFilenameFull(destdir: string, search: string, flags: UtilsFindIconFlag): string
  • Finds an icon filename from a filesystem root.

    Parameters

    • destdir: string

      the destdir.

    • search: string

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

    • flags: UtilsFindIconFlag

      A #AsUtilsFindIconFlag bitfield

    Returns string

  • utilsGuidFromData(namespaceId: string, data: number, dataLen: 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

    • namespaceId: string

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

    • data: number

      data to hash

    • dataLen: number

      length of data

    Returns string

  • utilsGuidFromString(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

  • utilsGuidIsValid(guid: string): boolean
  • Checks the source string is a valid string GUID descriptor.

    Parameters

    • guid: string

      string to check

    Returns boolean

  • utilsInstallFilename(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

  • utilsIsBlacklistedId(desktopId: string): boolean
  • Searches the known list of blacklisted desktop IDs.

    Parameters

    • desktopId: string

      a desktop ID, e.g. "gimp.desktop"

    Returns boolean

  • utilsIsCategoryId(categoryId: string): boolean
  • Searches the known list of registered category IDs.

    Parameters

    • categoryId: string

      a desktop ID, e.g. "AudioVideoEditing"

    Returns boolean

  • utilsIsEnvironmentId(environmentId: string): boolean
  • Searches the known list of registered environment IDs.

    Parameters

    • environmentId: string

      a desktop ID, e.g. "GNOME"

    Returns boolean

  • utilsIsSpdxLicense(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

  • utilsIsSpdxLicenseId(licenseId: string): boolean
  • Searches the known list of SPDX license IDs.

    Parameters

    • licenseId: string

      a single SPDX license ID, e.g. "CC-BY-3.0"

    Returns boolean

  • utilsIsStockIconName(name: string): boolean
  • utilsLicenseToSpdx(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

  • utilsSearchTokenValid(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

  • utilsSearchTokenize(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[]

  • utilsSpdxLicenseDetokenize(licenseTokens: string): string
  • De-tokenizes the SPDX licenses into a string.

    Parameters

    • licenseTokens: string

      license tokens, typically from as_utils_spdx_license_tokenize()

    Returns string

  • utilsSpdxLicenseTokenize(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[]

  • utilsStringReplace(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

    • bundleKind: 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

  • utilsUniqueIdEqual(uniqueId1: string, uniqueId2: string): boolean
  • Checks two unique IDs for equality allowing globs to match.

    Parameters

    • uniqueId1: string

      a unique ID

    • uniqueId2: string

      another unique ID

    Returns boolean

  • utilsUniqueIdHash(uniqueId: 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

    • uniqueId: string

      a unique ID

    Returns number

  • utilsUniqueIdMatch(uniqueId1: string, uniqueId2: string, matchFlags: UniqueIdMatchFlags): boolean
  • Checks two unique IDs for equality allowing globs to match, whilst also allowing clients to whitelist sections that have to match.

    Parameters

    • uniqueId1: string

      a unique ID

    • uniqueId2: string

      another unique ID

    • matchFlags: UniqueIdMatchFlags

      a #AsUniqueIdMatchFlags bitfield, e.g. %AS_UNIQUE_ID_MATCH_FLAG_ID

    Returns boolean

  • utilsUniqueIdValid(uniqueId: string): boolean
  • Checks if a unique ID is valid i.e. has the correct number of sections.

    Parameters

    • uniqueId: string

      a unique ID

    Returns boolean

  • utilsVercmp(versionA: string, versionB: string): number
  • Compares version numbers for sorting.

    Parameters

    • versionA: string

      the release version, e.g. 1.2.3

    • versionB: string

      the release version, e.g. 1.2.3.1

    Returns number

  • Compares version numbers for sorting.

    Parameters

    • versionA: string

      the release version, e.g. 1.2.3

    • versionB: string

      the release version, e.g. 1.2.3.1

    • flags: VersionCompareFlag

      some #AsVersionCompareFlag

    Returns number

  • Returns a dotted decimal version string from a 16 bit number.

    Parameters

    • val: number

      A uint16le version number

    • flags: VersionParseFlag

      flags used for formatting, e.g. %AS_VERSION_PARSE_FLAG_USE_TRIPLET

    Returns string

  • Returns a dotted decimal version string from a 32 bit number.

    Parameters

    • val: number

      A uint32le version number

    • flags: VersionParseFlag

      flags used for formatting, e.g. %AS_VERSION_PARSE_FLAG_USE_TRIPLET

    Returns string

  • utilsVersionParse(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