From 2eeb6f04a7e9a241bd33426b84b623ca9c434180 Mon Sep 17 00:00:00 2001 From: David Capello Date: Thu, 10 Jul 2025 18:13:10 -0300 Subject: [PATCH] Fix "buttononly" bool attribute for widget --- src/app/widget_loader.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/app/widget_loader.cpp b/src/app/widget_loader.cpp index 6d2e3b0d1..b1ee96cff 100644 --- a/src/app/widget_loader.cpp +++ b/src/app/widget_loader.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2019-2024 Igara Studio S.A. +// Copyright (C) 2019-2025 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of @@ -257,11 +257,9 @@ Widget* WidgetLoader::convertXmlElementToWidget(const XMLElement* elem, ((ExprEntry*)widget)->setDecimals(strtol(decimals, nullptr, 10)); } if (elem_name == "filename") { - const char* button_only = elem->Attribute("button_only"); - const app::FilenameField::Type type = ((button_only != nullptr && - strtol(button_only, nullptr, 10) == 1) ? - app::FilenameField::Type::ButtonOnly : - app::FilenameField::Type::EntryAndButton); + const bool buttononly = bool_attr(elem, "buttononly", false); + const app::FilenameField::Type type = (buttononly ? app::FilenameField::Type::ButtonOnly : + app::FilenameField::Type::EntryAndButton); widget = new app::FilenameField(type, ""); }