diff options
Diffstat (limited to 'adw/src/aboutdialog.cpp')
| -rw-r--r-- | adw/src/aboutdialog.cpp | 607 |
1 files changed, 607 insertions, 0 deletions
diff --git a/adw/src/aboutdialog.cpp b/adw/src/aboutdialog.cpp new file mode 100644 index 0000000..a30758a --- /dev/null +++ b/adw/src/aboutdialog.cpp @@ -0,0 +1,607 @@ +/** + * @author Felix Morgner (felix.morgner@gmail.com) + * @copyright Copyright (c) 2025 + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + +#include "adwaitamm/aboutdialog.hpp" + +#include "adwaitamm/dialog.hpp" +#include "adwaitamm/private/aboutdialog_p.hpp" + +#include <sigc++/functors/slot.h> + +#include <glibmm/containerhandle_shared.h> +#include <glibmm/exceptionhandler.h> +#include <glibmm/object.h> +#include <glibmm/objectbase.h> +#include <glibmm/propertyproxy.h> +#include <glibmm/refptr.h> +#include <glibmm/signalproxy.h> +#include <glibmm/ustring.h> +#include <glibmm/utility.h> +#include <glibmm/vectorutils.h> +#include <glibmm/wrap.h> + +#include <giomm/asyncresult.h> +#include <giomm/cancellable.h> + +#include <gtkmm/aboutdialog.h> +#include <gtkmm/widget.h> + +#include <adwaita.h> +#include <glib-object.h> +#include <glib.h> +#include <gtk/gtk.h> + +#include <string> +#include <vector> + +namespace Adwaita +{ + + namespace + { + auto constinit _class = AboutDialog_Class{}; ///< The static instance of this types class + + extern "C" auto AdwAboutDialog_signal_activate_link_connect_callback(AdwAboutDialog * self, char const * uri, void * user_data) -> gboolean + try + { + auto object = Glib::wrap(self); + if (object) + { + auto slot = Glib::SignalProxyNormal::data_to_slot(user_data); + if (slot) + { + return static_cast<gboolean>( + (*static_cast<sigc::slot<bool(Glib::ustring const &)> *>(slot))(Glib::convert_const_gchar_ptr_to_ustring(uri))); + } + } + return {}; + } + catch (...) + { + Glib::exception_handlers_invoke(); + return {}; + } + + extern "C" auto AdwAboutDialog_signal_activate_link_notify_callback(AdwAboutDialog * self, char const * uri, void * user_data) -> gboolean + try + { + auto object = Glib::wrap(self); + if (object) + { + auto slot = Glib::SignalProxyNormal::data_to_slot(user_data); + if (slot) + { + (*static_cast<sigc::slot<void(Glib::ustring const &)> *>(slot))(Glib::convert_const_gchar_ptr_to_ustring(uri)); + } + } + return {}; + } + catch (...) + { + Glib::exception_handlers_invoke(); + return {}; + } + + namespace property_name + { + auto constexpr application_icon = "application-icon"; + auto constexpr application_name = "application-name"; + auto constexpr artists = "artists"; + auto constexpr comments = "comments"; + auto constexpr copyright = "copyright"; + auto constexpr debug_info = "debug-info"; + auto constexpr debug_info_filename = "debug-info-filename"; + auto constexpr designers = "designers"; + auto constexpr developer_name = "developer-name"; + auto constexpr developers = "developers"; + auto constexpr documenters = "documenters"; + auto constexpr issue_url = "issue-url"; + auto constexpr license_type = "license-type"; + auto constexpr license = "license"; + auto constexpr release_notes = "release-notes"; + auto constexpr release_notes_version = "release-notes-version"; + auto constexpr support_url = "support-url"; + auto constexpr translator_credits = "translator-credits"; + auto constexpr version = "version"; + auto constexpr website = "website"; + } // namespace property_name + + namespace signal_info + { + static const Glib::SignalProxyInfo activate_link = {"activate_link", + (GCallback)&AdwAboutDialog_signal_activate_link_connect_callback, + (GCallback)&AdwAboutDialog_signal_activate_link_notify_callback}; + } // namespace signal_info + + } // namespace + + AboutDialog::AboutDialog() + : Glib::ObjectBase{nullptr} + , Dialog{Glib::ConstructParams{_class.init()}} + { + } + + AboutDialog::AboutDialog(std::string resource_path, std::string release_notes_version) + : Glib::ObjectBase{nullptr} + , Dialog{adw_about_dialog_new_from_appdata(resource_path.c_str(), Glib::c_str_or_nullptr(release_notes_version))} + { + } + + auto AboutDialog::get_type() -> GType + { + return _class.init().get_type(); + } + + auto AboutDialog::get_base_type() -> GType + { + return adw_about_dialog_get_type(); + } + + auto AboutDialog::add_acknowledgement_section(Glib::ustring const & name, std::vector<Glib::ustring> const & people) -> void + { + return adw_about_dialog_add_acknowledgement_section(unwrap(this), + Glib::c_str_or_nullptr(name), + Glib::ArrayHandler<Glib::ustring>::vector_to_array(people).data()); + } + + auto AboutDialog::add_credit_section(Glib::ustring const & name, std::vector<Glib::ustring> const & people) -> void + { + + return adw_about_dialog_add_credit_section(unwrap(this), + Glib::c_str_or_nullptr(name), + Glib::ArrayHandler<Glib::ustring>::vector_to_array(people).data()); + } + + auto AboutDialog::add_legal_section(Glib::ustring const & title, + Glib::ustring const & copyright, + Gtk::License license_type, + Glib::ustring const & license) -> void + { + return adw_about_dialog_add_legal_section(Glib::unwrap(this), + title.c_str(), + c_str_or_nullptr(copyright), + static_cast<GtkLicense>(license_type), + c_str_or_nullptr(license)); + } + + auto AboutDialog::add_link(Glib::ustring const & title, Glib::ustring const & url) -> void + { + return adw_about_dialog_add_link(unwrap(this), title.c_str(), url.c_str()); + } + + auto AboutDialog::add_other_app(Glib::ustring const & id, Glib::ustring const & name, Glib::ustring const & summary) -> void + { + return adw_about_dialog_add_other_app(unwrap(this), id.c_str(), name.c_str(), summary.c_str()); + } + + auto AboutDialog::get_application_icon() const -> Glib::ustring + { + return adw_about_dialog_get_application_icon(const_cast<BaseObjectType *>(unwrap(this))); + } + + auto AboutDialog::get_application_name() const -> Glib::ustring + { + return adw_about_dialog_get_application_name(const_cast<BaseObjectType *>(unwrap(this))); + } + + auto AboutDialog::get_artists() const -> std::vector<Glib::ustring> + { + return Glib::ArrayHandler<Glib::ustring>::array_to_vector(adw_about_dialog_get_artists(const_cast<BaseObjectType *>(unwrap(this))), + Glib::OWNERSHIP_NONE); + } + + auto AboutDialog::get_comments() const -> Glib::ustring + { + return adw_about_dialog_get_comments(const_cast<BaseObjectType *>(unwrap(this))); + } + + auto AboutDialog::get_copyright() const -> Glib::ustring + { + return adw_about_dialog_get_copyright(const_cast<BaseObjectType *>(unwrap(this))); + } + + auto AboutDialog::get_debug_info() const -> Glib::ustring + { + return adw_about_dialog_get_debug_info(const_cast<BaseObjectType *>(unwrap(this))); + } + + auto AboutDialog::get_debug_info_filename() const -> Glib::ustring + { + return adw_about_dialog_get_debug_info_filename(const_cast<BaseObjectType *>(unwrap(this))); + } + + auto AboutDialog::get_designers() const -> std::vector<Glib::ustring> + { + return Glib::ArrayHandler<Glib::ustring>::array_to_vector(adw_about_dialog_get_designers(const_cast<BaseObjectType *>(unwrap(this))), + Glib::OWNERSHIP_NONE); + } + + auto AboutDialog::get_developer_name() const -> Glib::ustring + { + return adw_about_dialog_get_developer_name(const_cast<BaseObjectType *>(unwrap(this))); + } + + auto AboutDialog::get_developers() const -> std::vector<Glib::ustring> + { + return Glib::ArrayHandler<Glib::ustring>::array_to_vector(adw_about_dialog_get_developers(const_cast<BaseObjectType *>(unwrap(this))), + Glib::OWNERSHIP_NONE); + } + + auto AboutDialog::get_documenters() const -> std::vector<Glib::ustring> + { + return Glib::ArrayHandler<Glib::ustring>::array_to_vector(adw_about_dialog_get_documenters(const_cast<BaseObjectType *>(unwrap(this))), + Glib::OWNERSHIP_NONE); + } + + auto AboutDialog::get_issue_url() const -> Glib::ustring + { + return adw_about_dialog_get_issue_url(const_cast<BaseObjectType *>(unwrap(this))); + } + + auto AboutDialog::get_license() const -> Glib::ustring + { + return adw_about_dialog_get_license(const_cast<BaseObjectType *>(unwrap(this))); + } + + auto AboutDialog::get_license_type() const -> Gtk::License + { + return static_cast<Gtk::License>(adw_about_dialog_get_license_type(const_cast<BaseObjectType *>(unwrap(this)))); + } + + auto AboutDialog::get_release_notes() const -> Glib::ustring + { + return adw_about_dialog_get_release_notes(const_cast<BaseObjectType *>(unwrap(this))); + } + + auto AboutDialog::get_release_notes_version() const -> Glib::ustring + { + return adw_about_dialog_get_release_notes_version(const_cast<BaseObjectType *>(unwrap(this))); + } + + auto AboutDialog::get_support_url() const -> Glib::ustring + { + return adw_about_dialog_get_support_url(const_cast<BaseObjectType *>(unwrap(this))); + } + + auto AboutDialog::get_translator_credits() const -> Glib::ustring + { + return adw_about_dialog_get_translator_credits(const_cast<BaseObjectType *>(unwrap(this))); + } + + auto AboutDialog::get_version() const -> Glib::ustring + { + return adw_about_dialog_get_version(const_cast<BaseObjectType *>(unwrap(this))); + } + + auto AboutDialog::get_website() const -> Glib::ustring + { + return adw_about_dialog_get_website(const_cast<BaseObjectType *>(unwrap(this))); + } + + auto AboutDialog::set_application_icon(Glib::ustring const & value) -> void + { + return adw_about_dialog_set_application_icon(unwrap(this), value.c_str()); + } + + auto AboutDialog::set_application_name(Glib::ustring const & value) -> void + { + return adw_about_dialog_set_application_name(unwrap(this), value.c_str()); + } + + auto AboutDialog::set_artists(std::vector<Glib::ustring> const & value) -> void + { + return adw_about_dialog_set_artists(unwrap(this), Glib::ArrayHandler<Glib::ustring>::vector_to_array(value).data()); + } + + auto AboutDialog::set_comments(Glib::ustring const & value) -> void + { + return adw_about_dialog_set_comments(unwrap(this), value.c_str()); + } + + auto AboutDialog::set_copyright(Glib::ustring const & value) -> void + { + return adw_about_dialog_set_copyright(unwrap(this), value.c_str()); + } + + auto AboutDialog::set_debug_info(Glib::ustring const & value) -> void + { + return adw_about_dialog_set_debug_info(unwrap(this), value.c_str()); + } + + auto AboutDialog::set_debug_info_filename(Glib::ustring const & value) -> void + { + return adw_about_dialog_set_debug_info_filename(unwrap(this), value.c_str()); + } + + auto AboutDialog::set_designers(std::vector<Glib::ustring> const & value) -> void + { + return adw_about_dialog_set_designers(unwrap(this), Glib::ArrayHandler<Glib::ustring>::vector_to_array(value).data()); + } + + auto AboutDialog::set_developer_name(Glib::ustring const & value) -> void + { + return adw_about_dialog_set_developer_name(unwrap(this), value.c_str()); + } + + auto AboutDialog::set_developers(std::vector<Glib::ustring> const & value) -> void + { + return adw_about_dialog_set_developers(unwrap(this), Glib::ArrayHandler<Glib::ustring>::vector_to_array(value).data()); + } + + auto AboutDialog::set_documenters(std::vector<Glib::ustring> const & value) -> void + { + return adw_about_dialog_set_documenters(unwrap(this), Glib::ArrayHandler<Glib::ustring>::vector_to_array(value).data()); + } + + auto AboutDialog::set_issue_url(Glib::ustring const & value) -> void + { + return adw_about_dialog_set_issue_url(unwrap(this), value.c_str()); + } + + auto AboutDialog::set_license(Glib::ustring const & value) -> void + { + return adw_about_dialog_set_license(unwrap(this), value.c_str()); + } + + auto AboutDialog::set_license_type(Gtk::License const & value) -> void + { + return adw_about_dialog_set_license_type(unwrap(this), static_cast<GtkLicense>(value)); + } + + auto AboutDialog::set_release_notes(Glib::ustring const & value) -> void + { + return adw_about_dialog_set_release_notes(unwrap(this), value.c_str()); + } + + auto AboutDialog::set_release_notes_version(Glib::ustring const & value) -> void + { + return adw_about_dialog_set_release_notes_version(unwrap(this), value.c_str()); + } + + auto AboutDialog::set_support_url(Glib::ustring const & value) -> void + { + return adw_about_dialog_set_support_url(unwrap(this), value.c_str()); + } + + auto AboutDialog::set_translator_credits(Glib::ustring const & value) -> void + { + return adw_about_dialog_set_translator_credits(unwrap(this), value.c_str()); + } + + auto AboutDialog::set_version(Glib::ustring const & value) -> void + { + return adw_about_dialog_set_version(unwrap(this), value.c_str()); + } + + auto AboutDialog::set_website(Glib::ustring const & value) -> void + { + return adw_about_dialog_set_website(unwrap(this), value.c_str()); + } + + auto AboutDialog::property_application_icon() -> Glib::PropertyProxy<Glib::ustring> + { + return Glib::PropertyProxy<Glib::ustring>{this, property_name::application_icon}; + } + + auto AboutDialog::property_application_icon() const -> Glib::PropertyProxy_ReadOnly<Glib::ustring> + { + return Glib::PropertyProxy_ReadOnly<Glib::ustring>{this, property_name::application_icon}; + } + + auto AboutDialog::property_application_name() -> Glib::PropertyProxy<Glib::ustring> + { + return Glib::PropertyProxy<Glib::ustring>{this, property_name::application_name}; + } + + auto AboutDialog::property_application_name() const -> Glib::PropertyProxy_ReadOnly<Glib::ustring> + { + return Glib::PropertyProxy_ReadOnly<Glib::ustring>{this, property_name::application_name}; + } + + auto AboutDialog::property_artists() -> Glib::PropertyProxy<std::vector<Glib::ustring>> + { + return Glib::PropertyProxy<std::vector<Glib::ustring>>{this, property_name::artists}; + } + + auto AboutDialog::property_artists() const -> Glib::PropertyProxy_ReadOnly<std::vector<Glib::ustring>> + { + return Glib::PropertyProxy_ReadOnly<std::vector<Glib::ustring>>{this, property_name::artists}; + } + + auto AboutDialog::property_comments() -> Glib::PropertyProxy<Glib::ustring> + { + return Glib::PropertyProxy<Glib::ustring>{this, property_name::comments}; + } + + auto AboutDialog::property_comments() const -> Glib::PropertyProxy_ReadOnly<Glib::ustring> + { + return Glib::PropertyProxy_ReadOnly<Glib::ustring>{this, property_name::comments}; + } + + auto AboutDialog::property_copyright() -> Glib::PropertyProxy<Glib::ustring> + { + return Glib::PropertyProxy<Glib::ustring>{this, property_name::copyright}; + } + + auto AboutDialog::property_copyright() const -> Glib::PropertyProxy_ReadOnly<Glib::ustring> + { + return Glib::PropertyProxy_ReadOnly<Glib::ustring>{this, property_name::copyright}; + } + + auto AboutDialog::property_debug_info() -> Glib::PropertyProxy<Glib::ustring> + { + return Glib::PropertyProxy<Glib::ustring>{this, property_name::debug_info}; + } + + auto AboutDialog::property_debug_info() const -> Glib::PropertyProxy_ReadOnly<Glib::ustring> + { + return Glib::PropertyProxy_ReadOnly<Glib::ustring>{this, property_name::debug_info}; + } + + auto AboutDialog::property_debug_info_filename() -> Glib::PropertyProxy<Glib::ustring> + { + return Glib::PropertyProxy<Glib::ustring>{this, property_name::debug_info_filename}; + } + + auto AboutDialog::property_debug_info_filename() const -> Glib::PropertyProxy_ReadOnly<Glib::ustring> + { + return Glib::PropertyProxy_ReadOnly<Glib::ustring>{this, property_name::debug_info_filename}; + } + + auto AboutDialog::property_designers() -> Glib::PropertyProxy<std::vector<Glib::ustring>> + { + return Glib::PropertyProxy<std::vector<Glib::ustring>>{this, property_name::designers}; + } + + auto AboutDialog::property_designers() const -> Glib::PropertyProxy_ReadOnly<std::vector<Glib::ustring>> + { + return Glib::PropertyProxy_ReadOnly<std::vector<Glib::ustring>>{this, property_name::designers}; + } + + auto AboutDialog::property_developer_name() -> Glib::PropertyProxy<Glib::ustring> + { + return Glib::PropertyProxy<Glib::ustring>{this, property_name::developer_name}; + } + + auto AboutDialog::property_developer_name() const -> Glib::PropertyProxy_ReadOnly<Glib::ustring> + { + return Glib::PropertyProxy_ReadOnly<Glib::ustring>{this, property_name::developer_name}; + } + + auto AboutDialog::property_developers() -> Glib::PropertyProxy<std::vector<Glib::ustring>> + { + return Glib::PropertyProxy<std::vector<Glib::ustring>>{this, property_name::developers}; + } + + auto AboutDialog::property_developers() const -> Glib::PropertyProxy_ReadOnly<std::vector<Glib::ustring>> + { + return Glib::PropertyProxy_ReadOnly<std::vector<Glib::ustring>>{this, property_name::developers}; + } + + auto AboutDialog::property_documenters() -> Glib::PropertyProxy<std::vector<Glib::ustring>> + { + return Glib::PropertyProxy<std::vector<Glib::ustring>>{this, property_name::documenters}; + } + + auto AboutDialog::property_documenters() const -> Glib::PropertyProxy_ReadOnly<std::vector<Glib::ustring>> + { + return Glib::PropertyProxy_ReadOnly<std::vector<Glib::ustring>>{this, property_name::documenters}; + } + + auto AboutDialog::property_issue_url() -> Glib::PropertyProxy<Glib::ustring> + { + return Glib::PropertyProxy<Glib::ustring>{this, property_name::issue_url}; + } + + auto AboutDialog::property_issue_url() const -> Glib::PropertyProxy_ReadOnly<Glib::ustring> + { + return Glib::PropertyProxy_ReadOnly<Glib::ustring>{this, property_name::issue_url}; + } + + auto AboutDialog::property_license_type() -> Glib::PropertyProxy<Gtk::License> + { + return Glib::PropertyProxy<Gtk::License>{this, property_name::license_type}; + } + + auto AboutDialog::property_license_type() const -> Glib::PropertyProxy_ReadOnly<Gtk::License> + { + return Glib::PropertyProxy_ReadOnly<Gtk::License>{this, property_name::license_type}; + } + + auto AboutDialog::property_license() -> Glib::PropertyProxy<Glib::ustring> + { + return Glib::PropertyProxy<Glib::ustring>{this, property_name::license}; + } + + auto AboutDialog::property_license() const -> Glib::PropertyProxy_ReadOnly<Glib::ustring> + { + return Glib::PropertyProxy_ReadOnly<Glib::ustring>{this, property_name::license}; + } + + auto AboutDialog::property_release_notes() -> Glib::PropertyProxy<Glib::ustring> + { + return Glib::PropertyProxy<Glib::ustring>{this, property_name::release_notes}; + } + + auto AboutDialog::property_release_notes() const -> Glib::PropertyProxy_ReadOnly<Glib::ustring> + { + return Glib::PropertyProxy_ReadOnly<Glib::ustring>{this, property_name::release_notes}; + } + + auto AboutDialog::property_release_notes_version() -> Glib::PropertyProxy<Glib::ustring> + { + return Glib::PropertyProxy<Glib::ustring>{this, property_name::release_notes_version}; + } + + auto AboutDialog::property_release_notes_version() const -> Glib::PropertyProxy_ReadOnly<Glib::ustring> + { + return Glib::PropertyProxy_ReadOnly<Glib::ustring>{this, property_name::release_notes_version}; + } + + auto AboutDialog::property_support_url() -> Glib::PropertyProxy<Glib::ustring> + { + return Glib::PropertyProxy<Glib::ustring>{this, property_name::support_url}; + } + + auto AboutDialog::property_support_url() const -> Glib::PropertyProxy_ReadOnly<Glib::ustring> + { + return Glib::PropertyProxy_ReadOnly<Glib::ustring>{this, property_name::support_url}; + } + + auto AboutDialog::property_translator_credits() -> Glib::PropertyProxy<Glib::ustring> + { + return Glib::PropertyProxy<Glib::ustring>{this, property_name::translator_credits}; + } + + auto AboutDialog::property_translator_credits() const -> Glib::PropertyProxy_ReadOnly<Glib::ustring> + { + return Glib::PropertyProxy_ReadOnly<Glib::ustring>{this, property_name::translator_credits}; + } + + auto AboutDialog::property_version() -> Glib::PropertyProxy<Glib::ustring> + { + return Glib::PropertyProxy<Glib::ustring>{this, property_name::version}; + } + + auto AboutDialog::property_version() const -> Glib::PropertyProxy_ReadOnly<Glib::ustring> + { + return Glib::PropertyProxy_ReadOnly<Glib::ustring>{this, property_name::version}; + } + + auto AboutDialog::property_website() -> Glib::PropertyProxy<Glib::ustring> + { + return Glib::PropertyProxy<Glib::ustring>{this, property_name::website}; + } + + auto AboutDialog::property_website() const -> Glib::PropertyProxy_ReadOnly<Glib::ustring> + { + return Glib::PropertyProxy_ReadOnly<Glib::ustring>{this, property_name::website}; + } + + auto AboutDialog::signal_activate_link() -> Glib::SignalProxy<bool(Glib::ustring const &)> + { + return Glib::SignalProxy<bool(Glib::ustring const &)>{this, &signal_info::activate_link}; + } + + AboutDialog::AboutDialog(Glib::ConstructParams const & params) + : Dialog{params} + { + } + + AboutDialog::AboutDialog(BaseObjectType * gobj) + : Dialog(ADW_DIALOG(gobj)) + { + } + +} // namespace Adwaita + +namespace Glib +{ + auto wrap(AdwAboutDialog * object, bool copy) -> Adwaita::AboutDialog * + { + return dynamic_cast<Adwaita::AboutDialog *>(Glib::wrap_auto(G_OBJECT(object), copy)); + } +} // namespace Glib
\ No newline at end of file |
