summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--adw/include/adwaitamm/toastoverlay.hpp14
-rw-r--r--adw/src/toastoverlay.cpp22
-rw-r--r--ui/src/windows/tracker.cpp2
3 files changed, 28 insertions, 10 deletions
diff --git a/adw/include/adwaitamm/toastoverlay.hpp b/adw/include/adwaitamm/toastoverlay.hpp
index f4d54cb..9872c1b 100644
--- a/adw/include/adwaitamm/toastoverlay.hpp
+++ b/adw/include/adwaitamm/toastoverlay.hpp
@@ -2,11 +2,11 @@
#define LIBADWAITAMM_TOASTOVERLAY_HPP
#include "adwaitamm/helpers/gobj_mixin.hpp"
-#include "adwaitamm/helpers/properties.hpp"
#include <glibmm/class.h>
#include <glibmm/object.h>
#include <glibmm/objectbase.h>
+#include <glibmm/propertyproxy.h>
#include <glibmm/refptr.h>
#include <gtkmm/widget.h>
@@ -53,20 +53,18 @@ namespace Adwaita
auto static get_type() -> GType;
auto static get_base_type() -> GType;
- auto add(Glib::RefPtr<struct Toast> const & toast) -> void;
+ auto add_toast(struct Toast & toast) -> void;
+ auto dismiss_all() -> void;
+ auto get_child() const -> Gtk::Widget *;
+ auto set_child(Gtk::Widget & value) -> void;
- auto property_child(this auto && self);
+ auto property_child() -> Glib::PropertyProxy<Gtk::Widget *>;
protected:
explicit ToastOverlay(Glib::ConstructParams const & params);
explicit ToastOverlay(BaseObjectType * gobj);
};
- auto ToastOverlay::property_child(this auto && self)
- {
- return helpers::make_property_proxy<Gtk::Widget *>(self, "child");
- }
-
} // namespace Adwaita
namespace Glib
diff --git a/adw/src/toastoverlay.cpp b/adw/src/toastoverlay.cpp
index 7d1493c..cc9eb26 100644
--- a/adw/src/toastoverlay.cpp
+++ b/adw/src/toastoverlay.cpp
@@ -58,12 +58,32 @@ namespace Adwaita
return adw_toast_overlay_get_type();
}
- auto ToastOverlay::add(Glib::RefPtr<struct Toast> const & toast) -> void
+ auto ToastOverlay::add_toast(Toast & toast) -> void
{
// Take a copy since the overlay will take ownership of the toast.
adw_toast_overlay_add_toast(Glib::unwrap(this), Glib::unwrap_copy(toast));
}
+ auto ToastOverlay::dismiss_all() -> void
+ {
+ adw_toast_overlay_dismiss_all(unwrap(this));
+ }
+
+ auto ToastOverlay::get_child() const -> Gtk::Widget *
+ {
+ return Glib::wrap(adw_toast_overlay_get_child(const_cast<BaseObjectType *>(unwrap(this))));
+ }
+
+ auto ToastOverlay::set_child(Gtk::Widget & value) -> void
+ {
+ adw_toast_overlay_set_child(unwrap(this), unwrap(&value));
+ }
+
+ auto ToastOverlay::property_child() -> Glib::PropertyProxy<Gtk::Widget *>
+ {
+ return Glib::PropertyProxy<Gtk::Widget *>{this, "child"};
+ }
+
ToastOverlay::ToastOverlay(Glib::ConstructParams const & params)
: Gtk::Widget{params}
{
diff --git a/ui/src/windows/tracker.cpp b/ui/src/windows/tracker.cpp
index 71ad630..df16a9e 100644
--- a/ui/src/windows/tracker.cpp
+++ b/ui/src/windows/tracker.cpp
@@ -197,7 +197,7 @@ namespace turns::ui::windows
auto tracker::show_toast(std::string const & message) -> void
{
- m_overlay->add(Adwaita::Toast::create(message));
+ m_overlay->add_toast(*Adwaita::Toast::create(message));
}
auto tracker::update_colors() -> void