XDG Icon and Sound theme

XDG Icon and Sound theme — implementation of lookup algorithm for icon and sound themes

Functions

Types and Values

Description

Functions

nk_xdg_theme_context_new ()

NkXdgThemeContext *
nk_xdg_theme_context_new (const gchar * const *icon_fallback_themes,
                          const gchar * const *sound_fallback_themes);

Creates a new NkXdgThemeContext.

Both icon_fallback_themes and sound_fallback_themes must exists until the NkXdgThemeContext is freed. It is recommended to use static const lists.

In addition to the application fallback themes in arguments, the Desktop Environment and GTK themes will be used.

Here is the full lookup list:

Parameters

icon_fallback_themes

A list of fallback themes for icon lookup.

[array zero-terminated=1]

sound_fallback_themes

A list of fallback themes for sound lookup.

[array zero-terminated=1]

Returns

a new NkXdgThemeContext.

[transfer full]


nk_xdg_theme_context_free ()

void
nk_xdg_theme_context_free (NkXdgThemeContext *context);

Frees context .

Parameters

context

an NkXdgThemeContext

 

nk_xdg_theme_preload_themes_icon ()

void
nk_xdg_theme_preload_themes_icon (NkXdgThemeContext *context,
                                  const gchar * const *themes);

Preloads icon themes metedata.

The preloaded themes will be the one from themes and the one from context (see nk_xdg_theme_context_new()).

Parameters

context

an NkXdgThemeContext

 

themes

a list of themes.

[array zero-terminated=1]

nk_xdg_theme_preload_themes_sound ()

void
nk_xdg_theme_preload_themes_sound (NkXdgThemeContext *context,
                                   const gchar * const *themes);

Preloads sound themes metedata.

The preloaded themes will be the one from themes and the one from context (see nk_xdg_theme_context_new()).

Parameters

context

an NkXdgThemeContext

 

themes

a list of themes.

[array zero-terminated=1]

nk_xdg_theme_get_icon ()

gchar *
nk_xdg_theme_get_icon (NkXdgThemeContext *context,
                       const gchar * const *themes,
                       const gchar *context_name,
                       const gchar *name,
                       gint size,
                       gint scale,
                       gboolean svg);

Searches name in themes and context themes (see nk_xdg_theme_context_new()).

size is directly linked to your usage of the icon. (E.g. 32 for a small toolbar or 256 for an application grid.)

If your output is an HiDPI monitor, *do not* increase the size manually, and instead use a higher scale . scale refers to the pixel density of your display.

If your rendering engine support SVG, you can pass TRUE to svg .

See the Icon theme specification for the full algorithm.

Parameters

context

an NkXdgThemeContext

 

themes

a list of themes.

[array zero-terminated=1]

context_name

the context name

 

name

the name of the icon to search for

 

size

the wanted size of the icon

 

scale

the scale the icon will be used on

 

svg

whether to search for SVG icons or not

 

Returns

the full path to the icon file, or NULL if not found.

[nullable]


nk_xdg_theme_get_sound ()

gchar *
nk_xdg_theme_get_sound (NkXdgThemeContext *context,
                        const gchar * const *themes,
                        const gchar *name,
                        const gchar *profile,
                        const gchar *locale);

Searches name in themes and context themes (see nk_xdg_theme_context_new()).

profile may be "stereo" or "5.1" or any profile the themes are expected to support.

Some sounds may be to be localized, and you may use locale for that. If locale is NULL, the current locale will be used. If localized sound is not found, fallbacks to "C".

See the Sound theme specification for the full algorithm.

Parameters

context

an NkXdgThemeContext

 

themes

a list of themes.

[array zero-terminated=1]

name

the name of the sound to search for

 

profile

the output profile

 

locale

a locale for sound localization.

[nullable]

Returns

the full path to the sound file, or NULL if not found.

[nullable]

Types and Values

NkXdgThemeContext

typedef struct _NkXdgThemeContext NkXdgThemeContext;

An opaque structure holding all the cached information about XDG Icon and Sound themes.