From 26a710d6fb0f0459f53d2245d130233b98387e89 Mon Sep 17 00:00:00 2001 From: josteph Date: Wed, 18 Sep 2019 18:59:19 +0000 Subject: [PATCH] unit_recall: Move the image path back to the cfg file --- data/gui/window/unit_recall.cfg | 2 +- src/gui/dialogs/unit_recall.cpp | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/data/gui/window/unit_recall.cfg b/data/gui/window/unit_recall.cfg index 0510966de0dc..f25677083a4c 100644 --- a/data/gui/window/unit_recall.cfg +++ b/data/gui/window/unit_recall.cfg @@ -148,7 +148,7 @@ [image] id = "gold_icon" definition = "default" - # label set from C++ + label = "themes/gold.png" [/image] [/column] diff --git a/src/gui/dialogs/unit_recall.cpp b/src/gui/dialogs/unit_recall.cpp index 193e463d2c9e..6292fa06531a 100644 --- a/src/gui/dialogs/unit_recall.cpp +++ b/src/gui/dialogs/unit_recall.cpp @@ -219,11 +219,7 @@ void unit_recall::pre_show(window& window) column["label"] = maybe_inactive(unit->type_name(), recallable); row_data.emplace("unit_type", column); - column["label"] = - recallable - ? "themes/gold.png" - : "themes/gold.png~GS()"; - row_data.emplace("gold_icon", column); + // gold_icon is handled below column["label"] = recallable @@ -271,8 +267,13 @@ void unit_recall::pre_show(window& window) recallable); row_data.emplace("unit_traits", column); - list.add_row(row_data); filter_options_.push_back(filter_text); + grid& grid = list.add_row(row_data); + if(!recallable) { + image *gold_icon = dynamic_cast(grid.find("gold_icon", false)); + assert(gold_icon); + gold_icon->set_image(gold_icon->get_image() + "~GS()"); + } } list.register_translatable_sorting_option(0, [this](const int i) { return recall_list_[i]->type_name().str(); });