From 3950204760a5887b4af73a2f731d59d59efbab1a Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Wed, 9 Jun 2021 01:20:36 +0200 Subject: [DRun] Do not use show-icons options, handle no-icon desktopfile better. --- source/dialogs/drun.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/source/dialogs/drun.c b/source/dialogs/drun.c index 2bb12009..b8500f96 100644 --- a/source/dialogs/drun.c +++ b/source/dialogs/drun.c @@ -610,12 +610,7 @@ static void read_desktop_file ( DRunModePrivateData *pd, const char *root, const else { pd->entry_list[pd->cmd_list_length].comment = NULL; } - if ( config.show_icons ) { - pd->entry_list[pd->cmd_list_length].icon_name = g_key_file_get_locale_string ( kf, DRUN_GROUP_NAME, "Icon", NULL, NULL ); - } - else{ - pd->entry_list[pd->cmd_list_length].icon_name = NULL; - } + pd->entry_list[pd->cmd_list_length].icon_name = g_key_file_get_locale_string ( kf, DRUN_GROUP_NAME, "Icon", NULL, NULL ); pd->entry_list[pd->cmd_list_length].icon = NULL; // Keep keyfile around. @@ -1265,20 +1260,19 @@ static cairo_surface_t *_get_icon ( const Mode *sw, unsigned int selected_line, } g_return_val_if_fail ( pd->entry_list != NULL, NULL ); DRunModeEntry *dr = &( pd->entry_list[selected_line] ); - if ( dr->icon_name == NULL ) { - return NULL; - } - if ( dr->icon_fetch_uid > 0 ) { + if ( dr->icon_name != NULL ) { + if ( dr->icon_fetch_uid > 0 ) { + cairo_surface_t *icon = rofi_icon_fetcher_get ( dr->icon_fetch_uid ); + if ( icon ) { + return icon; + } + return fallback_icon ( pd, height ); + } + dr->icon_fetch_uid = rofi_icon_fetcher_query ( dr->icon_name, height ); cairo_surface_t *icon = rofi_icon_fetcher_get ( dr->icon_fetch_uid ); if ( icon ) { return icon; } - return fallback_icon ( pd, height ); - } - dr->icon_fetch_uid = rofi_icon_fetcher_query ( dr->icon_name, height ); - cairo_surface_t *icon = rofi_icon_fetcher_get ( dr->icon_fetch_uid ); - if ( icon ) { - return icon; } return fallback_icon ( pd, height ); } -- cgit v1.2.3