Functions

desktop_get_media_key_string (type)

desktop_prepend_terminal_to_vector (argc, argv)

desktop_thumbnail_cache_check_permissions (factory, quick)

desktop_thumbnail_cache_fix_permissions ()

desktop_thumbnail_has_uri (pixbuf, uri)

desktop_thumbnail_is_valid (pixbuf, uri, mtime)

desktop_thumbnail_md5 (uri)

desktop_thumbnail_path_for_uri (uri, size)

desktop_thumbnail_scale_down_pixbuf (pixbuf, dest_width, dest_height)

get_all_locales ()

get_country_from_code (code, translation)

get_country_from_locale (locale, translation)

get_input_source_from_locale (locale)

get_language_from_code (code, translation)

get_language_from_locale (locale, translation)

get_translated_modifier (modifier, translation)

language_has_translations (code)

normalize_locale (locale)

parse_locale (locale)

rr_error_quark ()

start_systemd_scope (name, pid, description, connection, cancellable, callback, *user_data)

start_systemd_scope_finish (res)

Details

CinnamonDesktop.desktop_get_media_key_string(type)
Parameters:

type (int) – The CDesktopEnums.MediaKeyType

Returns:

the string corresponding to the provided media key type or None

Return type:

str

Returns the Gio.Settings key string of the given media key type.

CinnamonDesktop.desktop_prepend_terminal_to_vector(argc, argv)
Parameters:
  • argc (int) – a pointer to the vector size

  • argv (str) – a pointer to the vector

Prepends a terminal (either the one configured as default in the user’s GNOME setup, or one of the common xterm emulators) to the passed in vector, modifying it in the process. The vector should be allocated with GLib.malloc, as this will GLib.free the original vector. Also all elements must have been allocated separately. That is the standard glib/GNOME way of doing vectors however. If the integer that argc points to is negative, the size will first be computed. Also note that passing in pointers to a vector that is empty, will just create a new vector for you.

CinnamonDesktop.desktop_thumbnail_cache_check_permissions(factory, quick)
Parameters:
Return type:

bool

CinnamonDesktop.desktop_thumbnail_cache_fix_permissions()
CinnamonDesktop.desktop_thumbnail_has_uri(pixbuf, uri)
Parameters:
Returns:

True if the thumbnail is for uri

Return type:

bool

Returns whether the thumbnail has the correct uri embedded in the Thumb::URI option in the png.

New in version 2.2.

CinnamonDesktop.desktop_thumbnail_is_valid(pixbuf, uri, mtime)
Parameters:
Returns:

True if the thumbnail has the right uri and mtime

Return type:

bool

Returns whether the thumbnail has the correct uri and mtime embedded in the png options.

New in version 2.2.

CinnamonDesktop.desktop_thumbnail_md5(uri)
Parameters:

uri (str) – an uri

Returns:

A string with the MD5 digest of the uri string.

Return type:

str

Calculates the MD5 checksum of the uri. This can be useful if you want to manually handle thumbnail files.

New in version 2.2.

Deprecated since version 2.22: Use GLib.Checksum instead

CinnamonDesktop.desktop_thumbnail_path_for_uri(uri, size)
Parameters:
Returns:

an absolute filename

Return type:

str

Returns the filename that a thumbnail of size size for uri would have.

New in version 2.2.

CinnamonDesktop.desktop_thumbnail_scale_down_pixbuf(pixbuf, dest_width, dest_height)
Parameters:
Returns:

a scaled pixbuf

Return type:

GdkPixbuf.Pixbuf

Scales the pixbuf to the desired size. This function is a lot faster than gdk-pixbuf when scaling down by large amounts.

New in version 2.2.

CinnamonDesktop.get_all_locales()
Returns:

a newly allocated None-terminated string array containing the all locales. Free with GLib.strfreev().

Return type:

[str]

Gets all locales.

New in version 3.8.

CinnamonDesktop.get_country_from_code(code, translation)
Parameters:
  • code (str) – an ISO 3166 code string

  • translation (str or None) – a locale string

Returns:

the country name. Caller takes ownership.

Return type:

str

Gets the country name for code. If translation is provided the returned string is translated accordingly.

New in version 3.8.

CinnamonDesktop.get_country_from_locale(locale, translation)
Parameters:
  • locale (str) – a locale string

  • translation (str or None) – a locale string

Returns:

the country description. Caller takes ownership.

Return type:

str

Gets the country description for locale. If translation is provided the returned string is translated accordingly.

New in version 3.8.

CinnamonDesktop.get_input_source_from_locale(locale)
Parameters:

locale (str) – a locale string

Returns:

True if a input source exists or False otherwise.

type:

location to store the input source type

id:

location to store the input source identifier

Return type:

(bool, type: str, id: str)

Gets the default input source’s type and identifier for a given locale.

New in version 3.8.

CinnamonDesktop.get_language_from_code(code, translation)
Parameters:
  • code (str) – an ISO 639 code string

  • translation (str or None) – a locale string

Returns:

the language name. Caller takes ownership.

Return type:

str

Gets the language name for code. If translation is provided the returned string is translated accordingly.

New in version 3.8.

CinnamonDesktop.get_language_from_locale(locale, translation)
Parameters:
  • locale (str) – a locale string

  • translation (str or None) – a locale string

Returns:

the language description. Caller takes ownership.

Return type:

str

Gets the language description for locale. If translation is provided the returned string is translated accordingly.

New in version 3.8.

CinnamonDesktop.get_translated_modifier(modifier, translation)
Parameters:
  • modifier (str) – the modifier part of a locale name

  • translation (str or None) – a locale string

Returns:

the translated modifier string. Caller takes ownership.

Return type:

str

Gets a translation of the raw modifier string. If translation is provided the returned string is translated accordingly.

New in version 3.34.

CinnamonDesktop.language_has_translations(code)
Parameters:

code (str) – an ISO 639 code string

Returns:

True if there are translations for language code.

Return type:

bool

Returns True if there are translations for language code.

New in version 3.8.

CinnamonDesktop.normalize_locale(locale)
Parameters:

locale (str) – a locale string

Returns:

normalized locale string. Caller takes ownership.

Return type:

str

Gets the normalized locale string in the form [language’_country [.codeset]’[modifier]] for name.

New in version 3.8.

CinnamonDesktop.parse_locale(locale)
Parameters:

locale (str) – a locale string

Returns:

True if parsing was successful.

language_codep:

location to store the language code, or None

country_codep:

location to store the country code, or None

codesetp:

location to store the codeset, or None

modifierp:

location to store the modifier, or None

Return type:

(bool, language_codep: str, country_codep: str or None, codesetp: str or None, modifierp: str or None)

Extracts the various components of a locale string in XPG format. ([language’_country [.codeset]’[modifier]]). See http://en.wikipedia.org/wiki/Locale.

New in version 3.8.

CinnamonDesktop.rr_error_quark()
Returns:

a #GQuark used to identify errors coming from the GnomeRR API.

Return type:

int

Returns the #GQuark that will be used for GLib.Error values returned by the GnomeRR API.

CinnamonDesktop.start_systemd_scope(name, pid, description, connection, cancellable, callback, *user_data)
Parameters:

If the current process is running inside a user systemd instance, then move the launched PID into a transient scope. The given name will be used to create a unit name. It should be the application ID for desktop files or the executable in all other cases.

It is advisable to use this function every time where the started application can be considered reasonably independent of the launching application. Placing it in a scope creates proper separation between the programs rather than being considered a single entity by systemd.

It is always safe to call this function. Note that a successful return code does not imply that a unit has been created. It solely means that no error condition was hit sending the request.

If connection is None then g_dbus_get() will be called internally.

Note that most callers will not need to handle errors. As such, it is normal to pass a None callback.

CinnamonDesktop.start_systemd_scope_finish(res)
Parameters:

res (Gio.AsyncResult) – A Gio.AsyncResult

Raises:

GLib.Error

Returns:

False on error, True otherwise

Return type:

bool

Finish an asynchronous operation to create a transient scope that was started with CinnamonDesktop.start_systemd_scope().

Note that a successful return code does not imply that a unit has been created. It solely means that no error condition was hit sending the request.