From f8bfd268523ff5abd3cf5490d5b892ff49954f47 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Sat, 13 Jul 2024 16:14:36 +0200 Subject: app/ui: make list entry title editable --- .../turns/app/widgets/participant_list_row.hpp | 6 ++++- app/src/widgets/participant_list_row.cpp | 10 +++++++- res/widgets/participant_list_row.ui | 20 +++++++++++----- res/widgets/widgets.cmb | 28 +++++++++++----------- 4 files changed, 42 insertions(+), 22 deletions(-) diff --git a/app/include/turns/app/widgets/participant_list_row.hpp b/app/include/turns/app/widgets/participant_list_row.hpp index b9efbd6..172e9ac 100644 --- a/app/include/turns/app/widgets/participant_list_row.hpp +++ b/app/include/turns/app/widgets/participant_list_row.hpp @@ -7,15 +7,18 @@ #include #include +#include #include #include #include +#include namespace turns::app::widgets { struct participant_list_row : template_widget { auto constexpr inline static children = std::array{ + "edit", "header", "prefixes", "image", @@ -31,12 +34,13 @@ namespace turns::app::widgets auto set_title(Glib::ustring const & value) -> void; private: + Gtk::ToggleButton * m_edit; Gtk::Box * m_header; Gtk::Image * m_image; Gtk::Box * m_prefixes; Gtk::Label * m_subtitle; Gtk::Box * m_suffixes; - Gtk::Label * m_title; + Gtk::EditableLabel * m_title; Gtk::Box * m_title_box; }; } // namespace turns::app::widgets diff --git a/app/src/widgets/participant_list_row.cpp b/app/src/widgets/participant_list_row.cpp index bc3108e..10bcc2d 100644 --- a/app/src/widgets/participant_list_row.cpp +++ b/app/src/widgets/participant_list_row.cpp @@ -14,13 +14,21 @@ namespace turns::app::widgets : Glib::ObjectBase(TYPE_NAME) , template_widget{TEMPLATE} { + m_edit = get_widget("edit"); m_header = get_widget("header"); m_image = get_widget("image"); m_prefixes = get_widget("prefixes"); m_subtitle = get_widget("subtitle"); m_suffixes = get_widget("suffixes"); - m_title = get_widget("title"); + m_title = get_widget("title"); m_title_box = get_widget("title_box"); + + m_edit->signal_clicked().connect([this]{ + if(m_edit->get_active()) + { + m_title->start_editing(); + } + }); } auto participant_list_row::set_subtitle(Glib::ustring const & value) -> void diff --git a/res/widgets/participant_list_row.ui b/res/widgets/participant_list_row.ui index 66506c8..c0e3895 100644 --- a/res/widgets/participant_list_row.ui +++ b/res/widgets/participant_list_row.ui @@ -32,15 +32,14 @@ vertical center - - 0 + + False False - True - word-char - 0.0 + + @@ -64,7 +63,16 @@ center - + + document-edit-symbolic + + + + + + + center +