drun: Load absolute path icons properly

This was lost in the rework commit
4d8784cf85 and never added back.

Fixes #701

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
This commit is contained in:
Quentin Glidic 2017-10-20 22:53:15 +02:00
parent 5f1be779a2
commit af81a54adf
No known key found for this signature in database
GPG key ID: AC203F96E2C34BB7

View file

@ -516,14 +516,21 @@ static void drun_icon_fetch ( gpointer data, gpointer user_data )
if ( dr->icon_name == NULL ) {
return;
}
gchar *icon_path = nk_xdg_theme_get_icon ( pd->xdg_context, themes, NULL, dr->icon_name, dr->icon_size, 1, TRUE );
if ( icon_path == NULL ) {
const gchar *icon_path;
gchar *icon_path_ = NULL;
if ( g_path_is_absolute ( dr->icon_name ) )
icon_path = dr->icon_name;
else {
icon_path = icon_path_ = nk_xdg_theme_get_icon ( pd->xdg_context, themes, NULL, dr->icon_name, dr->icon_size, 1, TRUE );
if ( icon_path_ == NULL ) {
g_debug ( "Failed to get Icon %s(%d): n/a", dr->icon_name, dr->icon_size );
return;
}
else{
g_debug ( "Found Icon %s(%d): %s", dr->icon_name, dr->icon_size, icon_path );
}
}
cairo_surface_t *icon_surf = NULL;
if ( g_str_has_suffix ( icon_path, ".png" ) ) {
icon_surf = cairo_image_surface_create_from_png ( icon_path );
@ -543,7 +550,7 @@ static void drun_icon_fetch ( gpointer data, gpointer user_data )
}
dr->icon = icon_surf;
}
g_free ( icon_path );
g_free ( icon_path_ );
rofi_view_reload ();
}