rofi 1.7.5
IconFetcher
Collaboration diagram for IconFetcher:

Functions

void rofi_icon_fetcher_init (void)
 
void rofi_icon_fetcher_destroy (void)
 
uint32_t rofi_icon_fetcher_query (const char *name, const int size)
 
uint32_t rofi_icon_fetcher_query_advanced (const char *name, const int wsize, const int hsize)
 
cairo_surface_t * rofi_icon_fetcher_get (const uint32_t uid)
 
gboolean rofi_icon_fetcher_file_is_image (const char *const path)
 

Detailed Description

Small helper of to fetch icons. This makes use of the 'view' threadpool.

Function Documentation

◆ rofi_icon_fetcher_destroy()

void rofi_icon_fetcher_destroy ( void )

Destroy and free the memory used by the icon fetcher.

Definition at line 149 of file rofi-icon-fetcher.c.

References free_wrapper(), IconFetcher::icon_cache, IconFetcher::icon_cache_uid, rofi_icon_fetcher_data, IconFetcher::supported_extensions, and IconFetcher::xdg_context.

Referenced by cleanup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rofi_icon_fetcher_file_is_image()

gboolean rofi_icon_fetcher_file_is_image ( const char *const path)
Parameters
paththe image path to check.

Checks if a file is a supported image. (by looking at extension).

Returns
true if image, false otherwise.

Definition at line 265 of file rofi-icon-fetcher.c.

References rofi_icon_fetcher_data, and IconFetcher::supported_extensions.

Referenced by _get_icon().

Here is the caller graph for this function:

◆ rofi_icon_fetcher_get()

cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid)
Parameters
uidThe unique id representing the matching request.

If the surface is used, the user should reference the surface.

Returns
the surface with the icon, NULL when not found.

Definition at line 443 of file rofi-icon-fetcher.c.

References IconFetcher::icon_cache_uid, rofi_icon_fetcher_data, and IconFetcherEntry::surface.

Referenced by _get_icon(), _get_icon(), dmenu_get_icon(), icon_draw(), mode_get_icon(), rofi_theme_get_image_inside(), and script_get_icon().

Here is the caller graph for this function:

◆ rofi_icon_fetcher_init()

void rofi_icon_fetcher_init ( void )

Initialize the icon fetcher.

Definition at line 111 of file rofi-icon-fetcher.c.

References config, IconFetcher::icon_cache, IconFetcher::icon_cache_uid, Settings::icon_theme, rofi_icon_fetch_entry_free(), rofi_icon_fetcher_data, IconFetcher::supported_extensions, and IconFetcher::xdg_context.

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rofi_icon_fetcher_query()

uint32_t rofi_icon_fetcher_query ( const char * name,
const int size )
Parameters
nameThe name of the icon to fetch.
sizeThe size of the icon to fetch.

Query the icon-theme for icon with name and size. The returned icon will be the best match for the requested size, it should still be resized to the actual size.

name can also be a full path, if prefixed with file://.

Returns
the uid identifying the request.

Definition at line 406 of file rofi-icon-fetcher.c.

References _thread_state::callback, IconFetcherEntry::entry, IconFetcherEntry::hsize, IconFetcher::icon_cache, IconFetcher::icon_cache_uid, IconFetcher::last_uid, IconFetcherNameEntry::name, rofi_icon_fetcher_data, rofi_icon_fetcher_worker(), IconFetcherNameEntry::sizes, IconFetcherEntry::state, IconFetcherEntry::surface, tpool, IconFetcherEntry::uid, and IconFetcherEntry::wsize.

Referenced by _get_icon(), _get_icon(), dmenu_get_icon(), icon_create(), mode_get_icon(), and script_get_icon().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rofi_icon_fetcher_query_advanced()

uint32_t rofi_icon_fetcher_query_advanced ( const char * name,
const int wsize,
const int hsize )
Parameters
nameThe name of the icon to fetch.
wsizeThe width of the icon to fetch.
hsizeThe height of the icon to fetch.

Query the icon-theme for icon with name and size. The returned icon will be the best match for the requested size, it should still be resized to the actual size. For icons it will take the min of wsize and hsize.

name can also be a full path, if prefixed with file://.

Returns
the uid identifying the request.

Definition at line 369 of file rofi-icon-fetcher.c.

References _thread_state::callback, IconFetcherEntry::entry, IconFetcherEntry::hsize, IconFetcher::icon_cache, IconFetcher::icon_cache_uid, IconFetcher::last_uid, IconFetcherNameEntry::name, rofi_icon_fetcher_data, rofi_icon_fetcher_worker(), IconFetcherNameEntry::sizes, IconFetcherEntry::state, IconFetcherEntry::surface, tpool, IconFetcherEntry::uid, and IconFetcherEntry::wsize.

Referenced by rofi_theme_get_image_inside().

Here is the call graph for this function:
Here is the caller graph for this function: