diff options
27 files changed, 360 insertions, 157 deletions
diff --git a/.vscode/settings.json b/.vscode/settings.json index cfba6a6..bce475b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -5,8 +5,11 @@ }, "cSpell.words": [ + "activatable", "arknet", + "gclass", "gobj", + "gtype", "klass", "refptr", "sigc", diff --git a/adw/CMakeLists.txt b/adw/CMakeLists.txt index f1ac616..49ac424 100644 --- a/adw/CMakeLists.txt +++ b/adw/CMakeLists.txt @@ -1,6 +1,7 @@ add_library("adw" "src/actionrow.cpp" "src/application.cpp" + "src/applicationwindow.cpp" "src/dialog.cpp" "src/preferencesdialog.cpp" "src/preferencespage.cpp" diff --git a/adw/include/turns/adw/actionrow.hpp b/adw/include/turns/adw/actionrow.hpp index 15ddbb1..d098d65 100644 --- a/adw/include/turns/adw/actionrow.hpp +++ b/adw/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 <glibmm/class.h> +#include <glibmm/object.h> +#include <glibmm/objectbase.h> +#include <glibmm/propertyproxy.h> #include <glibmm/refptr.h> #include <glibmm/ustring.h> #include <gtkmm/widget.h> +#include <glib-object.h> +#include <glib.h> + 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<Gtk::Widget>; + [[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<Gtk::Widget *>; + [[deprecated("replaced by add_prefix")]] auto property_icon_name() noexcept -> Glib::PropertyProxy<Glib::ustring>; + auto property_subtitle() noexcept -> Glib::PropertyProxy<Glib::ustring>; + auto property_subtitle_lines() noexcept -> Glib::PropertyProxy<int>; + auto property_subtitle_selectable() noexcept -> Glib::PropertyProxy<bool>; + auto property_title_lines() noexcept -> Glib::PropertyProxy<int>; 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<Gtk::Widget *>(self, "activatable-widget"); - } - - auto ActionRow::property_icon_name(this auto && self) - { - return helpers::make_property_proxy<Glib::ustring>(self, "icon-name"); - } - - auto ActionRow::property_subtitle(this auto && self) - { - return helpers::make_property_proxy<Glib::ustring>(self, "subtitle"); - } - - auto ActionRow::property_subtitle_lines(this auto && self) - { - return helpers::make_property_proxy<int>(self, "subtitle-lines"); - } - - auto ActionRow::property_subtitle_selectable(this auto && self) - { - return helpers::make_property_proxy<bool>(self, "subtitle-selectable"); - } - - auto ActionRow::property_title_lines(this auto && self) - { - return helpers::make_property_proxy<int>(self, "title-lines"); - } - } // namespace turns::adw namespace Glib diff --git a/adw/include/turns/adw/application.hpp b/adw/include/turns/adw/application.hpp index 64efcb0..df5e930 100644 --- a/adw/include/turns/adw/application.hpp +++ b/adw/include/turns/adw/application.hpp @@ -12,6 +12,7 @@ #include <gtkmm/application.h> using AdwApplication = struct _AdwApplication; +using AdwApplicationClass = struct _AdwApplicationClass; namespace turns::adw { @@ -21,7 +22,7 @@ namespace turns::adw struct Class : Glib::Class { using BaseClassParent = GtkApplicationClass; - using BaseClassType = struct AdwApplicationClass; + using BaseClassType = AdwApplicationClass; using BaseObjectType = AdwApplication; using CppClassParent = struct Gtk::Application_Class; using CppObjectType = Application; diff --git a/adw/include/turns/adw/applicationwindow.hpp b/adw/include/turns/adw/applicationwindow.hpp new file mode 100644 index 0000000..e5b02b0 --- /dev/null +++ b/adw/include/turns/adw/applicationwindow.hpp @@ -0,0 +1,64 @@ +#ifndef TURNS_ADW_APPLICATION_WINDOW_HPP +#define TURNS_ADW_APPLICATION_WINDOW_HPP + +#include "helpers/gobj_mixin.hpp" + +#include <glibmm/object.h> +#include <glibmm/objectbase.h> +#include <glibmm/refptr.h> +#include <glibmm/ustring.h> + +#include <gtkmm/application.h> +#include <gtkmm/applicationwindow.h> + +using AdwApplicationWindow = struct _AdwApplicationWindow; +using AdwApplicationWindowClass = struct _AdwApplicationWindowClass; + +namespace turns::adw +{ + struct ApplicationWindow : Gtk::ApplicationWindow, + helpers::gobj_mixin<ApplicationWindow, AdwApplicationWindow> + { + struct Class : Glib::Class + { + using BaseClassParent = GtkApplicationWindowClass; + using BaseClassType = AdwApplicationWindowClass; + using BaseObjectType = AdwApplicationWindow; + using CppClassParent = struct Gtk::ApplicationWindow_Class; + using CppObjectType = ApplicationWindow; + + auto init() -> Glib::Class const &; + auto static class_init_function(void * gclass, void * data) -> void; + auto static wrap_new(GObject * object) -> Glib::ObjectBase *; + }; + + using BaseObjectType = Class::BaseObjectType; + using BaseClassType = Class::BaseClassType; + using CppObjectType = Class::CppObjectType; + using CppClassType = Class; + + using helpers::gobj_mixin<CppObjectType, BaseObjectType>::gobj; + using helpers::gobj_mixin<CppObjectType, BaseObjectType>::gobj_copy; + + explicit ApplicationWindow(Gtk::Application & app); + ApplicationWindow(ApplicationWindow const & other) = delete; + ApplicationWindow(ApplicationWindow && other) noexcept = default; + + auto operator=(ApplicationWindow const & other) noexcept -> ApplicationWindow & = delete; + auto operator=(ApplicationWindow && other) noexcept -> ApplicationWindow & = default; + + auto static get_type() -> GType; + auto static get_base_type() -> GType; + + protected: + explicit ApplicationWindow(Glib::ConstructParams const & params); + explicit ApplicationWindow(BaseObjectType * gobj); + }; +} // namespace turns::adw + +namespace Glib +{ + auto wrap(AdwApplicationWindow * object, bool copy = false) -> turns::adw::ApplicationWindow *; +} // namespace Glib + +#endif
\ No newline at end of file diff --git a/adw/include/turns/adw/dialog.hpp b/adw/include/turns/adw/dialog.hpp index af5f5da..75a095c 100644 --- a/adw/include/turns/adw/dialog.hpp +++ b/adw/include/turns/adw/dialog.hpp @@ -4,11 +4,16 @@ #include "helpers/gobj_mixin.hpp" #include <glibmm/class.h> +#include <glibmm/object.h> +#include <glibmm/objectbase.h> #include <glibmm/refptr.h> #include <gtkmm/widget.h> +#include <glib-object.h> + using AdwDialog = struct _AdwDialog; +using AdwDialogClass = struct _AdwDialogClass; namespace turns::adw { @@ -20,7 +25,7 @@ namespace turns::adw struct Class : Glib::Class { using BaseClassParent = GtkWidgetClass; - using BaseClassType = struct AdwDialogClass; + using BaseClassType = AdwDialogClass; using BaseObjectType = AdwDialog; using CppClassParent = struct Gtk::Widget_Class; using CppObjectType = Dialog; diff --git a/adw/include/turns/adw/preferencesdialog.hpp b/adw/include/turns/adw/preferencesdialog.hpp index 06ac600..85735ef 100644 --- a/adw/include/turns/adw/preferencesdialog.hpp +++ b/adw/include/turns/adw/preferencesdialog.hpp @@ -11,6 +11,7 @@ #include <gtkmm/widget.h> using AdwPreferencesDialog = struct _AdwPreferencesDialog; +using AdwPreferencesDialogClass = struct _AdwPreferencesDialogClass; namespace turns::adw { @@ -22,7 +23,7 @@ namespace turns::adw struct Class : Glib::Class { using BaseClassParent = AdwDialogClass; - using BaseClassType = struct AdwPreferencesDialogClass; + using BaseClassType = AdwPreferencesDialogClass; using BaseObjectType = AdwPreferencesDialog; using CppClassParent = adw::Dialog::Class; using CppObjectType = PreferencesDialog; diff --git a/adw/include/turns/adw/preferencespage.hpp b/adw/include/turns/adw/preferencespage.hpp index 30e7eed..b8b4051 100644 --- a/adw/include/turns/adw/preferencespage.hpp +++ b/adw/include/turns/adw/preferencespage.hpp @@ -10,6 +10,7 @@ #include <gtkmm/widget.h> using AdwPreferencesPage = struct _AdwPreferencesPage; +using AdwPreferencesPageClass = struct _AdwPreferencesPageClass; namespace turns::adw { @@ -19,7 +20,7 @@ namespace turns::adw struct Class : Glib::Class { using BaseClassParent = GtkWidgetClass; - using BaseClassType = struct AdwPreferencesPageClass; + using BaseClassType = AdwPreferencesPageClass; using BaseObjectType = AdwPreferencesPage; using CppClassParent = struct Gtk::Widget_Class; using CppObjectType = PreferencesPage; diff --git a/adw/include/turns/adw/preferencesrow.hpp b/adw/include/turns/adw/preferencesrow.hpp index 6f831b0..a0f22ed 100644 --- a/adw/include/turns/adw/preferencesrow.hpp +++ b/adw/include/turns/adw/preferencesrow.hpp @@ -11,6 +11,7 @@ #include <gtkmm/listboxrow.h> using AdwPreferencesRow = struct _AdwPreferencesRow; +using AdwPreferencesRowClass = struct _AdwPreferencesRowClass; namespace turns::adw { @@ -20,7 +21,7 @@ namespace turns::adw struct Class : Glib::Class { using BaseClassParent = GtkListBoxRowClass; - using BaseClassType = struct AdwPreferencesRowClass; + using BaseClassType = AdwPreferencesRowClass; using BaseObjectType = AdwPreferencesRow; using CppClassParent = struct Gtk::ListBoxRow_Class; using CppObjectType = PreferencesRow; diff --git a/adw/include/turns/adw/switchrow.hpp b/adw/include/turns/adw/switchrow.hpp index ed5190a..e7e0131 100644 --- a/adw/include/turns/adw/switchrow.hpp +++ b/adw/include/turns/adw/switchrow.hpp @@ -6,11 +6,17 @@ #include "turns/adw/helpers/properties.hpp" #include <glibmm/class.h> +#include <glibmm/object.h> +#include <glibmm/objectbase.h> #include <glibmm/refptr.h> #include <glibmm/ustring.h> #include <gtkmm/widget.h> +#define _ADWAITA_INSIDE +#include <adw-switch-row.h> +#undef _ADWAITA_INSIDE + using AdwSwitchRow = struct _AdwSwitchRow; namespace turns::adw @@ -21,9 +27,9 @@ namespace turns::adw struct Class : Glib::Class { using BaseClassParent = AdwActionRowClass; - using BaseClassType = struct AdwSwitchRowClass; + using BaseClassType = AdwSwitchRowClass; using BaseObjectType = AdwSwitchRow; - using CppClassParent = adw::ActionRow; + using CppClassParent = adw::ActionRow::Class; using CppObjectType = SwitchRow; auto init() -> Glib::Class const &; diff --git a/adw/src/actionrow.cpp b/adw/src/actionrow.cpp index f45f7a3..e8cfc7d 100644 --- a/adw/src/actionrow.cpp +++ b/adw/src/actionrow.cpp @@ -1,10 +1,12 @@ #include "turns/adw/actionrow.hpp" +#include "turns/adw/helpers/properties.hpp" #include "turns/adw/preferencesrow.hpp" #include <glibmm/class.h> #include <glibmm/object.h> #include <glibmm/objectbase.h> +#include <glibmm/propertyproxy.h> #include <glibmm/refptr.h> #include <glibmm/ustring.h> #include <glibmm/utility.h> @@ -12,10 +14,13 @@ #include <gtkmm/init.h> #include <gtkmm/listboxrow.h> +#include <gtkmm/object.h> #include <gtkmm/private/widget_p.h> +#include <gtkmm/widget.h> #include <adwaita.h> #include <glib-object.h> +#include <glib.h> #include <gtk/gtk.h> namespace turns::adw @@ -29,7 +34,7 @@ namespace turns::adw { if (!gtype_) { - class_init_func_ = &ActionRow::Class::class_init_function; + class_init_func_ = &class_init_function; register_derived_type(adw_action_row_get_type()); } return *this; @@ -37,13 +42,13 @@ namespace turns::adw auto ActionRow::Class::class_init_function(void * gclass, void * data) -> void { - auto const klass = static_cast<AdwActionRowClass *>(gclass); - PreferencesRow::Class::class_init_function(klass, data); + auto const klass = static_cast<BaseClassType *>(gclass); + CppClassParent::class_init_function(klass, data); } auto ActionRow::Class::wrap_new(GObject * object) -> Glib::ObjectBase * { - return new ActionRow(ADW_ACTION_ROW(object)); + return Gtk::manage(new ActionRow(ADW_ACTION_ROW(object))); } auto ActionRow::get_type() -> GType @@ -62,6 +67,16 @@ namespace turns::adw { } + ActionRow::ActionRow(Glib::ConstructParams const & params) + : adw::PreferencesRow{params} + { + } + + ActionRow::ActionRow(BaseObjectType * gobj) + : adw::PreferencesRow(ADW_PREFERENCES_ROW(gobj)) + { + } + auto ActionRow::add_prefix(Gtk::Widget & widget) -> ActionRow & { adw_action_row_add_prefix(Glib::unwrap(this), Glib::unwrap(&widget)); @@ -80,6 +95,69 @@ namespace turns::adw return *this; } + auto ActionRow::get_activatable_widget() const noexcept -> Glib::RefPtr<Gtk::Widget> + { + return Glib::make_refptr_for_instance(Glib::wrap(adw_action_row_get_activatable_widget(const_cast<BaseObjectType *>(Glib::unwrap(this))))); + } + + auto ActionRow::get_icon_name() const -> Glib::ustring + { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + return adw_action_row_get_icon_name(const_cast<BaseObjectType *>(Glib::unwrap(this))); +#pragma GCC diagnostic pop + } + + auto ActionRow::get_subtitle() const -> Glib::ustring + { + return adw_action_row_get_subtitle(const_cast<BaseObjectType *>(Glib::unwrap(this))); + } + + auto ActionRow::get_subtitle_lines() const noexcept -> int + { + return adw_action_row_get_subtitle_lines(const_cast<BaseObjectType *>(Glib::unwrap(this))); + } + + auto ActionRow::get_subtitle_selectable() const noexcept -> bool + { + return adw_action_row_get_subtitle_selectable(const_cast<BaseObjectType *>(Glib::unwrap(this))); + } + + auto ActionRow::get_title_lines() const noexcept -> int + { + return adw_action_row_get_title_lines(const_cast<BaseObjectType *>(Glib::unwrap(this))); + } + + auto ActionRow::property_activatable_widget() noexcept -> Glib::PropertyProxy<Gtk::Widget *> + { + return helpers::make_property_proxy<Gtk::Widget *>(*this, "activatable-widget"); + } + + auto ActionRow::property_icon_name() noexcept -> Glib::PropertyProxy<Glib::ustring> + { + return helpers::make_property_proxy<Glib::ustring>(*this, "icon-name"); + } + + auto ActionRow::property_subtitle() noexcept -> Glib::PropertyProxy<Glib::ustring> + { + return helpers::make_property_proxy<Glib::ustring>(*this, "subtitle"); + } + + auto ActionRow::property_subtitle_lines() noexcept -> Glib::PropertyProxy<int> + { + return helpers::make_property_proxy<int>(*this, "subtitle-lines"); + } + + auto ActionRow::property_subtitle_selectable() noexcept -> Glib::PropertyProxy<bool> + { + return helpers::make_property_proxy<bool>(*this, "subtitle-selectable"); + } + + auto ActionRow::property_title_lines() noexcept -> Glib::PropertyProxy<int> + { + return helpers::make_property_proxy<int>(*this, "title-lines"); + } + auto ActionRow::set_activatable_widget(Gtk::Widget & widget) noexcept -> CppObjectType & { adw_action_row_set_activatable_widget(Glib::unwrap(this), Glib::unwrap(&widget)); @@ -109,7 +187,7 @@ namespace turns::adw auto ActionRow::set_subtitle_selectable(bool subtitle_selectable) noexcept -> CppObjectType & { - adw_action_row_set_subtitle_selectable(Glib::unwrap(this), subtitle_selectable); + adw_action_row_set_subtitle_selectable(Glib::unwrap(this), static_cast<gboolean>(subtitle_selectable)); return *this; } @@ -119,24 +197,12 @@ namespace turns::adw return *this; } - ActionRow::ActionRow(Glib::ConstructParams const & params) - : adw::PreferencesRow{params} - { - } - - ActionRow::ActionRow(BaseObjectType * gobj) - : Glib::ObjectBase{nullptr} - , adw::PreferencesRow(ADW_PREFERENCES_ROW(gobj)) - { - } - } // namespace turns::adw namespace Glib { auto wrap(AdwActionRow * object, bool copy) -> Glib::RefPtr<turns::adw::ActionRow> { - return Glib::make_refptr_for_instance<turns::adw::ActionRow>( - dynamic_cast<turns::adw::ActionRow *>(Glib::wrap_auto(G_OBJECT(object), copy))); + return Glib::make_refptr_for_instance(dynamic_cast<turns::adw::ActionRow *>(Glib::wrap_auto(G_OBJECT(object), copy))); } } // namespace Glib
\ No newline at end of file diff --git a/adw/src/application.cpp b/adw/src/application.cpp index 1fe47c3..05bc07a 100644 --- a/adw/src/application.cpp +++ b/adw/src/application.cpp @@ -77,8 +77,7 @@ namespace turns::adw } Application::Application(AdwApplication * gobj) - : Glib::ObjectBase{nullptr} - , Gtk::Application((GtkApplication *)gobj) + : Gtk::Application((GtkApplication *)gobj) { } @@ -94,7 +93,6 @@ namespace Glib { auto wrap(AdwApplication * object, bool copy) -> Glib::RefPtr<turns::adw::Application> { - return Glib::make_refptr_for_instance<turns::adw::Application>( - dynamic_cast<turns::adw::Application *>(Glib::wrap_auto(G_OBJECT(object), copy))); + return Glib::make_refptr_for_instance(dynamic_cast<turns::adw::Application *>(Glib::wrap_auto(G_OBJECT(object), copy))); } } // namespace Glib
\ No newline at end of file diff --git a/adw/src/applicationwindow.cpp b/adw/src/applicationwindow.cpp new file mode 100644 index 0000000..af21a5e --- /dev/null +++ b/adw/src/applicationwindow.cpp @@ -0,0 +1,83 @@ +#include "turns/adw/applicationwindow.hpp" + +#include <glibmm/class.h> +#include <glibmm/object.h> +#include <glibmm/objectbase.h> +#include <glibmm/refptr.h> +#include <glibmm/ustring.h> +#include <glibmm/utility.h> +#include <glibmm/wrap.h> + +#include <gtkmm/application.h> +#include <gtkmm/applicationwindow.h> +#include <gtkmm/init.h> +#include <gtkmm/object.h> +#include <gtkmm/private/applicationwindow_p.h> + +#include <adwaita.h> +#include <glib-object.h> +#include <gtk/gtk.h> + +namespace turns::adw +{ + namespace + { + auto constinit _class = ApplicationWindow::Class{}; + } // namespace + + auto ApplicationWindow::Class::init() -> Glib::Class const & + { + if (!gtype_) + { + class_init_func_ = &class_init_function; + register_derived_type(adw_application_window_get_type()); + } + return *this; + } + + auto ApplicationWindow::Class::class_init_function(void * gclass, void * data) -> void + { + auto const klass = static_cast<BaseClassType *>(gclass); + CppClassParent::class_init_function(klass, data); + } + + auto ApplicationWindow::Class::wrap_new(GObject * object) -> Glib::ObjectBase * + { + return new ApplicationWindow(ADW_APPLICATION_WINDOW(object)); + } + + auto ApplicationWindow::get_type() -> GType + { + return _class.init().get_type(); + } + + auto ApplicationWindow::get_base_type() -> GType + { + return adw_application_window_get_type(); + } + + ApplicationWindow::ApplicationWindow(Gtk::Application & app) + : Glib::ObjectBase{nullptr} + , Gtk::ApplicationWindow{Glib::ConstructParams{_class.init(), "app", &app, nullptr}} + { + } + + ApplicationWindow::ApplicationWindow(Glib::ConstructParams const & params) + : Gtk::ApplicationWindow{params} + { + } + + ApplicationWindow::ApplicationWindow(BaseObjectType * gobj) + : Gtk::ApplicationWindow(GTK_APPLICATION_WINDOW(gobj)) + { + } + +} // namespace turns::adw + +namespace Glib +{ + auto wrap(AdwApplicationWindow * object, bool copy) -> turns::adw::ApplicationWindow * + { + return dynamic_cast<turns::adw::ApplicationWindow *>(Glib::wrap_auto(G_OBJECT(object), copy)); + } +} // namespace Glib
\ No newline at end of file diff --git a/adw/src/dialog.cpp b/adw/src/dialog.cpp index 3fe9752..c6d5e2b 100644 --- a/adw/src/dialog.cpp +++ b/adw/src/dialog.cpp @@ -8,6 +8,7 @@ #include <glibmm/wrap.h> #include <gtkmm/init.h> +#include <gtkmm/object.h> #include <gtkmm/private/widget_p.h> #include <gtkmm/widget.h> @@ -27,7 +28,7 @@ namespace turns::adw { if (!gtype_) { - class_init_func_ = &Dialog::Class::class_init_function; + class_init_func_ = &class_init_function; register_derived_type(adw_dialog_get_type()); } return *this; @@ -35,13 +36,13 @@ namespace turns::adw auto Dialog::Class::class_init_function(void * gclass, void * data) -> void { - auto const klass = static_cast<AdwDialogClass *>(gclass); - Gtk::Widget_Class::class_init_function(klass, data); + auto const klass = static_cast<BaseClassType *>(gclass); + CppClassParent::class_init_function(klass, data); } auto Dialog::Class::wrap_new(GObject * object) -> Glib::ObjectBase * { - return new Dialog(ADW_DIALOG(object)); + return Gtk::manage(new Dialog(ADW_DIALOG(object))); } auto Dialog::get_type() -> GType @@ -60,8 +61,7 @@ namespace turns::adw } Dialog::Dialog(AdwDialog * gobj) - : Glib::ObjectBase{nullptr} - , Gtk::Widget(GTK_WIDGET(gobj)) + : Gtk::Widget(GTK_WIDGET(gobj)) { } @@ -82,6 +82,6 @@ namespace Glib { auto wrap(AdwDialog * object, bool copy) -> Glib::RefPtr<turns::adw::Dialog> { - return Glib::make_refptr_for_instance<turns::adw::Dialog>(dynamic_cast<turns::adw::Dialog *>(Glib::wrap_auto(G_OBJECT(object), copy))); + return Glib::make_refptr_for_instance(dynamic_cast<turns::adw::Dialog *>(Glib::wrap_auto(G_OBJECT(object), copy))); } } // namespace Glib
\ No newline at end of file diff --git a/adw/src/preferencesdialog.cpp b/adw/src/preferencesdialog.cpp index b18c0e6..10419fe 100644 --- a/adw/src/preferencesdialog.cpp +++ b/adw/src/preferencesdialog.cpp @@ -12,6 +12,7 @@ #include <glibmm/wrap.h> #include <gtkmm/init.h> +#include <gtkmm/object.h> #include <gtkmm/private/widget_p.h> #include <gtkmm/widget.h> @@ -30,7 +31,7 @@ namespace turns::adw { if (!gtype_) { - class_init_func_ = &PreferencesDialog::Class::class_init_function; + class_init_func_ = &class_init_function; register_derived_type(adw_preferences_dialog_get_type()); } return *this; @@ -38,13 +39,13 @@ namespace turns::adw auto PreferencesDialog::Class::class_init_function(void * gclass, void * data) -> void { - auto const klass = static_cast<AdwPreferencesDialogClass *>(gclass); - Gtk::Widget_Class::class_init_function(klass, data); + auto const klass = static_cast<BaseClassType *>(gclass); + CppClassParent::class_init_function(klass, data); } auto PreferencesDialog::Class::wrap_new(GObject * object) -> Glib::ObjectBase * { - return new PreferencesDialog(ADW_PREFERENCES_DIALOG(object)); + return Gtk::manage(new PreferencesDialog(ADW_PREFERENCES_DIALOG(object))); } auto PreferencesDialog::get_type() -> GType @@ -63,8 +64,7 @@ namespace turns::adw } PreferencesDialog::PreferencesDialog(AdwPreferencesDialog * gobj) - : Glib::ObjectBase{nullptr} - , adw::Dialog(ADW_DIALOG(gobj)) + : adw::Dialog(ADW_DIALOG(gobj)) { } diff --git a/adw/src/preferencespage.cpp b/adw/src/preferencespage.cpp index 475f591..8467e29 100644 --- a/adw/src/preferencespage.cpp +++ b/adw/src/preferencespage.cpp @@ -9,6 +9,7 @@ #include <glibmm/wrap.h> #include <gtkmm/init.h> +#include <gtkmm/object.h> #include <gtkmm/private/widget_p.h> #include <gtkmm/widget.h> @@ -21,13 +22,13 @@ namespace turns::adw namespace { auto constinit _class = PreferencesPage::Class{}; - } + } // namespace auto PreferencesPage::Class::init() -> Glib::Class const & { if (!gtype_) { - class_init_func_ = &PreferencesPage::Class::class_init_function; + class_init_func_ = &class_init_function; register_derived_type(adw_preferences_page_get_type()); } return *this; @@ -35,13 +36,13 @@ namespace turns::adw auto PreferencesPage::Class::class_init_function(void * gc |
