mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Use GBytesIcon with GNotification
GFileIcon is not supported by xdg-desktop-portal
This commit is contained in:
parent
d6ed23b3dd
commit
ace363f432
1 changed files with 19 additions and 1 deletions
|
@ -691,7 +691,25 @@ void NotificationData::setImage(const QString &imagePath) {
|
|||
}
|
||||
|
||||
if (_notification) {
|
||||
_notification->set_icon(Gio::Icon::create(imagePath.toStdString()));
|
||||
const auto imageData = [&] {
|
||||
QFile f(imagePath);
|
||||
if (f.open(QIODevice::ReadOnly)) {
|
||||
return f.readAll();
|
||||
}
|
||||
return QByteArray();
|
||||
}();
|
||||
|
||||
if (imageData.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto imageBytes = Glib::Bytes::create(
|
||||
imageData.constData(),
|
||||
imageData.size());
|
||||
|
||||
_notification->set_icon(
|
||||
Glib::wrap(g_bytes_icon_new(imageBytes->gobj())));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue