summaryrefslogtreecommitdiff
path: root/app/src/windows/tracker.cpp
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@gmail.com>2024-07-16 16:46:10 +0200
committerFelix Morgner <felix.morgner@gmail.com>2024-07-16 16:46:10 +0200
commitc6e430e13713eea51ecd00fa278f7fa635ad7272 (patch)
treee6eb407892ad5025fc1eb94d4e452cb7d8f00f17 /app/src/windows/tracker.cpp
parentc87ebdbfacdc2e1b5ae50286a5437e7b9eceafa7 (diff)
downloadturns-c6e430e13713eea51ecd00fa278f7fa635ad7272.tar.xz
turns-c6e430e13713eea51ecd00fa278f7fa635ad7272.zip
app: perform some code cleanup
Diffstat (limited to 'app/src/windows/tracker.cpp')
-rw-r--r--app/src/windows/tracker.cpp49
1 files changed, 27 insertions, 22 deletions
diff --git a/app/src/windows/tracker.cpp b/app/src/windows/tracker.cpp
index 21dd21f..60d9f23 100644
--- a/app/src/windows/tracker.cpp
+++ b/app/src/windows/tracker.cpp
@@ -32,36 +32,35 @@ namespace turns::app::windows
, m_title(ADW_WINDOW_TITLE(builder->get_widget<Gtk::Widget>("title")->gobj()))
, m_turn_order{Gtk::make_managed<widgets::turn_order_view>()}
, m_subtitle{Glib::wrap(GTK_WIDGET(m_title)), "subtitle"}
- , m_clear_action{add_action("clear", sigc::mem_fun(*m_turn_order, &widgets::turn_order_view::clear))}
{
m_stack->add(*m_turn_order);
- // clang-format off
- m_clear_action_enabled = Glib::Binding::bind_property(m_turn_order->property_is_empty(),
- m_clear_action->property_enabled(),
- Glib::Binding::Flags::SYNC_CREATE | Glib::Binding::Flags::INVERT_BOOLEAN);
+ auto clear_action = add_action("clear", sigc::mem_fun(*m_turn_order, &widgets::turn_order_view::clear));
+ add_action("add_participant", sigc::mem_fun(*this, &tracker::handle_add_participant));
+ add_action_with_parameter("delete", Glib::VARIANT_TYPE_INT32, sigc::mem_fun(*this, &tracker::handle_delete_participant));
+ add_action_with_parameter("edit", Glib::VARIANT_TYPE_INT32, sigc::mem_fun(*this, &tracker::handle_edit_participant));
- m_controls_revealed = Glib::Binding::bind_property(m_turn_order->property_is_empty(),
- m_controls->property_reveal_child(),
- Glib::Binding::Flags::SYNC_CREATE | Glib::Binding::Flags::INVERT_BOOLEAN);
+ Glib::Binding::bind_property(m_turn_order->property_is_empty(),
+ clear_action->property_enabled(),
+ Glib::Binding::Flags::SYNC_CREATE | Glib::Binding::Flags::INVERT_BOOLEAN);
- m_visible_child_widget = Glib::Binding::bind_property(m_turn_order->property_is_empty(),
- m_stack->property_visible_child(),
- Glib::Binding::Flags::SYNC_CREATE,
- [this](auto empty) { return empty ? m_empty : m_turn_order; });
+ Glib::Binding::bind_property(m_turn_order->property_is_empty(),
+ m_controls->property_reveal_child(),
+ Glib::Binding::Flags::SYNC_CREATE | Glib::Binding::Flags::INVERT_BOOLEAN);
- m_subtitle_text = Glib::Binding::bind_property(m_turn_order->property_is_empty(),
- m_subtitle,
- Glib::Binding::Flags::SYNC_CREATE,
- [](auto empty) { return empty ? _(lang::no_active_turn_order) : ""; });
- // clang-format on
+ Glib::Binding::bind_property(m_turn_order->property_is_empty(),
+ m_stack->property_visible_child(),
+ Glib::Binding::Flags::SYNC_CREATE,
+ [this](auto empty) { return empty ? m_empty : m_turn_order; });
- add_action("add_participant", sigc::mem_fun(*this, &tracker::handle_add_participant));
- add_action_with_parameter("delete", Glib::VARIANT_TYPE_INT32, [this](auto param) {
- auto index = Glib::VariantBase::cast_dynamic<Glib::Variant<int>>(param);
- m_turn_order->remove(index.get());
+ // clang-format off
+ Glib::Binding::bind_property(m_turn_order->property_is_empty(),
+ m_subtitle,
+ Glib::Binding::Flags::SYNC_CREATE,
+ [](auto empty) {
+ return empty ? _(lang::no_active_turn_order) : "";
});
- add_action_with_parameter("edit", Glib::VARIANT_TYPE_INT32, sigc::mem_fun(*this, &tracker::handle_edit_participant));
+ // clang-format on
}
auto tracker::handle_add_participant() -> void
@@ -71,6 +70,12 @@ namespace turns::app::windows
dialog->signal_finished().connect(sigc::mem_fun(*m_turn_order, &widgets::turn_order_view::append));
}
+ auto tracker::handle_delete_participant(Glib::VariantBase param) -> void
+ {
+ auto index = Glib::VariantBase::cast_dynamic<Glib::Variant<int>>(param);
+ m_turn_order->remove(index.get());
+ }
+
auto tracker::handle_edit_participant(Glib::VariantBase param) -> void
{
static_cast<void>(param);