Callbacks

CheckMetadataEarlyFn (cres, unit, *user_data)

TranslateDesktopTextFn (de, text, *user_data)

Details

AppStreamCompose.CheckMetadataEarlyFn(cres, unit, *user_data)
Parameters:

Function which is called after all metainfo and related data (e.g. desktop-entry files) has been loaded, but *before* any expensive operations such as screenshot downloads or font searches are performed.

This function can be useful to filter out unwanted components early in the process and avoid unneeded downloads and other data processing. By the time this function is called, the component’s global ID should be finalized and should not change any longer.

Please note that this function may be called from any thread, and thread safety needs to be taken care of by the callee.

Added in version 0.15.1.

AppStreamCompose.TranslateDesktopTextFn(de, text, *user_data)
Parameters:
  • de (GLib.KeyFile) – A pointer to the desktop-entry data we are reading.

  • text (str) – The string to translate.

  • user_data (object or None) – Additional data.

Returns:

A new GLib.PtrArray containing the translation mapping.

Return type:

[str]

Function which is called while parsing a desktop-entry file to allow external translations of string values. This is used in e.g. the Ubuntu distribution.

The return value must contain a list of strings with the locale name in even indices, and the text translated to the preceding locale in the following odd indices.

Added in version 0.14.2.