summaryrefslogtreecommitdiff
path: root/src/notifications/notifier_gio.cpp
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2023-03-09 23:28:10 -0500
committerouwou <26526779+ouwou@users.noreply.github.com>2023-03-09 23:28:10 -0500
commite06e574206990c5d0a57d526214f9bf482120412 (patch)
tree6d77ef3b479152b761a8607abeaf2abfd33e197b /src/notifications/notifier_gio.cpp
parent816f1a01ecc3155ad410d1ff34510b558e2d8cbf (diff)
downloadabaddon-portaudio-e06e574206990c5d0a57d526214f9bf482120412.tar.gz
abaddon-portaudio-e06e574206990c5d0a57d526214f9bf482120412.zip
add user avatars to notifications
Diffstat (limited to 'src/notifications/notifier_gio.cpp')
-rw-r--r--src/notifications/notifier_gio.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/notifications/notifier_gio.cpp b/src/notifications/notifier_gio.cpp
index f28735c..f09b002 100644
--- a/src/notifications/notifier_gio.cpp
+++ b/src/notifications/notifier_gio.cpp
@@ -18,12 +18,22 @@ Notifier::~Notifier() {
#endif
}
-void Notifier::Notify(const Glib::ustring &title, const Glib::ustring &text, const Glib::ustring &default_action) {
+void Notifier::Notify(const Glib::ustring &title, const Glib::ustring &text, const Glib::ustring &default_action, const std::string &icon_path) {
auto n = Gio::Notification::create(title);
n->set_body(text);
n->set_default_action(default_action);
+
+ // i dont think giomm provides an interface for this
+
+ auto *file = g_file_new_for_path(icon_path.c_str());
+ auto *icon = g_file_icon_new(file);
+ g_notification_set_icon(n->gobj(), icon);
+
Abaddon::Get().GetApp()->send_notification(n);
+ g_object_unref(icon);
+ g_object_unref(file);
+
#ifdef WITH_MINIAUDIO
ma_engine_play_sound(&m_engine, Abaddon::Get().GetResPath("/sound/message.mp3").c_str(), nullptr);
#endif