Make use of templated XDP::ReadSetting

This commit is contained in:
Ilya Fedin 2023-09-18 15:54:59 +04:00 committed by John Preston
parent 9bf89715b1
commit ba73905c11

View file

@ -102,24 +102,18 @@ TitleControls::Layout TitleControlsLayout() {
#endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION #endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION
const auto portalResult = []() -> std::optional<TitleControls::Layout> { const auto portalResult = []() -> std::optional<TitleControls::Layout> {
try { namespace XDP = base::Platform::XDP;
using namespace base::Platform::XDP;
const auto decorationLayout = ReadSetting( const auto decorationLayout = XDP::ReadSetting<Glib::ustring>(
"org.gnome.desktop.wm.preferences", "org.gnome.desktop.wm.preferences",
"button-layout"); "button-layout");
if (!decorationLayout.has_value()) { if (!decorationLayout.has_value()) {
return std::nullopt; return std::nullopt;
}
return GtkKeywordsToTitleControlsLayout(
QString::fromStdString(
decorationLayout->get_dynamic<Glib::ustring>()));
} catch (...) {
} }
return std::nullopt; return GtkKeywordsToTitleControlsLayout(
QString::fromStdString(*decorationLayout));
}(); }();
if (portalResult.has_value()) { if (portalResult.has_value()) {