From 5d7c8646d5ed2a57bc322b62de192fbdf70429de Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Thu, 27 Mar 2025 08:27:32 +0100 Subject: adw: clean up implementation --- include/turns/adw/actionrow.hpp | 98 +++++++++-------------------------------- 1 file changed, 22 insertions(+), 76 deletions(-) (limited to 'include/turns/adw/actionrow.hpp') diff --git a/include/turns/adw/actionrow.hpp b/include/turns/adw/actionrow.hpp index 15ddbb1..d098d65 100644 --- a/include/turns/adw/actionrow.hpp +++ b/include/turns/adw/actionrow.hpp @@ -2,16 +2,22 @@ #define TURNS_ADW_ACTION_ROW_HPP #include "helpers/gobj_mixin.hpp" -#include "turns/adw/helpers/properties.hpp" #include "turns/adw/preferencesrow.hpp" #include +#include +#include +#include #include #include #include +#include +#include + using AdwActionRow = struct _AdwActionRow; +using AdwActionRowClass = struct _AdwActionRowClass; namespace turns::adw { @@ -21,9 +27,9 @@ namespace turns::adw struct Class : Glib::Class { using BaseClassParent = AdwPreferencesRowClass; - using BaseClassType = struct AdwActionRowClass; + using BaseClassType = AdwActionRowClass; using BaseObjectType = AdwActionRow; - using CppClassParent = adw::PreferencesRow; + using CppClassParent = adw::PreferencesRow::Class; using CppObjectType = ActionRow; auto init() -> Glib::Class const &; @@ -53,12 +59,19 @@ namespace turns::adw auto add_suffix(Gtk::Widget & widget) -> ActionRow &; auto remove(Gtk::Widget & widget) -> ActionRow &; - auto get_activatable_widget(this auto && self) noexcept; - [[deprecated("replaced by add_prefix")]] auto get_icon_name(this auto && self); - auto get_subtitle(this auto && self); - auto get_subtitle_lines(this auto && self) noexcept; - auto get_subtitle_selectable(this auto && self) noexcept; - auto get_title_lines(this auto && self) noexcept; + auto get_activatable_widget() const noexcept -> Glib::RefPtr; + [[deprecated("replaced by add_prefix")]] auto get_icon_name() const -> Glib::ustring; + auto get_subtitle() const -> Glib::ustring; + auto get_subtitle_lines() const noexcept -> int; + auto get_subtitle_selectable() const noexcept -> bool; + auto get_title_lines() const noexcept -> int; + + auto property_activatable_widget() noexcept -> Glib::PropertyProxy; + [[deprecated("replaced by add_prefix")]] auto property_icon_name() noexcept -> Glib::PropertyProxy; + auto property_subtitle() noexcept -> Glib::PropertyProxy; + auto property_subtitle_lines() noexcept -> Glib::PropertyProxy; + auto property_subtitle_selectable() noexcept -> Glib::PropertyProxy; + auto property_title_lines() noexcept -> Glib::PropertyProxy; auto set_activatable_widget(Gtk::Widget & widget) noexcept -> CppObjectType &; [[deprecated("replaced by add_prefix")]] auto set_icon_name(Glib::ustring const & name) -> CppObjectType &; @@ -67,78 +80,11 @@ namespace turns::adw auto set_subtitle_selectable(bool subtitle_selectable) noexcept -> CppObjectType &; auto set_title_lines(int title_lines) noexcept -> CppObjectType &; - auto property_activatable_widget(this auto && self); - [[deprecated("replaced by add_prefix")]] auto property_icon_name(this auto && self); - auto property_subtitle(this auto && self); - auto property_subtitle_lines(this auto && self); - auto property_subtitle_selectable(this auto && self); - auto property_title_lines(this auto && self); - protected: explicit ActionRow(Glib::ConstructParams const & params); explicit ActionRow(BaseObjectType * gobj); }; - auto ActionRow::get_activatable_widget(this auto && self) noexcept - { - return self.property_activatable_widget().value(); - } - - auto ActionRow::get_icon_name(this auto && self) - { - return self.property_icon_name().value(); - } - - auto ActionRow::get_subtitle(this auto && self) - { - return self.property_subtitle().value(); - } - - auto ActionRow::get_subtitle_lines(this auto && self) noexcept - { - return self.property_subtitle_lines().value(); - } - - auto ActionRow::get_subtitle_selectable(this auto && self) noexcept - { - return self.property_subtitle_selectable().value(); - } - - auto ActionRow::get_title_lines(this auto && self) noexcept - { - return self.property_title_lines().value(); - } - - auto ActionRow::property_activatable_widget(this auto && self) - { - return helpers::make_property_proxy(self, "activatable-widget"); - } - - auto ActionRow::property_icon_name(this auto && self) - { - return helpers::make_property_proxy(self, "icon-name"); - } - - auto ActionRow::property_subtitle(this auto && self) - { - return helpers::make_property_proxy(self, "subtitle"); - } - - auto ActionRow::property_subtitle_lines(this auto && self) - { - return helpers::make_property_proxy(self, "subtitle-lines"); - } - - auto ActionRow::property_subtitle_selectable(this auto && self) - { - return helpers::make_property_proxy(self, "subtitle-selectable"); - } - - auto ActionRow::property_title_lines(this auto && self) - { - return helpers::make_property_proxy(self, "title-lines"); - } - } // namespace turns::adw namespace Glib -- cgit v1.2.3