From af81a54adf040b2cb1bc52c0f480205310f8fec2 Mon Sep 17 00:00:00 2001 From: Quentin Glidic Date: Fri, 20 Oct 2017 22:53:15 +0200 Subject: [PATCH] drun: Load absolute path icons properly This was lost in the rework commit 4d8784cf85a5108340a2b2a684e2bd1d9f77269d and never added back. Fixes #701 Signed-off-by: Quentin Glidic --- source/dialogs/drun.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/source/dialogs/drun.c b/source/dialogs/drun.c index b9129f17..33ce69f8 100644 --- a/source/dialogs/drun.c +++ b/source/dialogs/drun.c @@ -516,13 +516,20 @@ 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 ) { - 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 ); + 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" ) ) { @@ -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 (); }