29 #define G_LOG_DOMAIN "Helpers.IconFetcher"
40 #include "nkutils-xdg-theme.h"
86 g_free ( entry->
name );
88 for ( GList *iter = g_list_first ( entry->
sizes ); iter; iter = g_list_next ( iter ) ) {
91 cairo_surface_destroy ( sentry->
surface );
95 g_list_free ( entry->
sizes );
103 static const gchar *
const icon_fallback_themes[] = {
134 g_debug (
"starting up icon fetching thread." );
138 const gchar *themes[] = {
143 const gchar *icon_path;
144 gchar *icon_path_ = NULL;
146 if ( g_path_is_absolute ( sentry->
entry->
name ) ) {
151 if ( icon_path_ == NULL ) {
152 g_debug (
"failed to get icon %s(%d): n/a", sentry->
entry->
name, sentry->
size );
156 g_debug (
"found icon %s(%d): %s", sentry->
entry->
name, sentry->
size, icon_path );
159 cairo_surface_t *icon_surf = NULL;
160 if ( g_str_has_suffix ( icon_path,
".png" ) ) {
161 icon_surf = cairo_image_surface_create_from_png ( icon_path );
163 else if ( g_str_has_suffix ( icon_path,
".svg" ) ) {
167 g_debug (
"icon type not yet supported: %s", icon_path );
171 if ( cairo_surface_status ( icon_surf ) != CAIRO_STATUS_SUCCESS ) {
172 g_debug (
"icon failed to open: %s(%d): %s", sentry->
entry->
name, sentry->
size, icon_path );
173 cairo_surface_destroy ( icon_surf );
178 g_free ( icon_path_ );
184 g_debug (
"Query: %s(%d)", name, size );
186 if ( entry == NULL ) {
188 entry->
name = g_strdup ( name );
192 for ( GList *iter = g_list_first ( entry->
sizes ); iter; iter = g_list_next ( iter ) ) {
194 if ( sentry->
size == size ) {
203 sentry->
entry = entry;
206 entry->
sizes = g_list_prepend ( entry->
sizes, sentry );
211 g_thread_pool_push (
tpool, sentry, NULL );