mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-09-03 16:15:13 +00:00
Use GBytesIcon with GNotification
GFileIcon is not supported by xdg-desktop-portal
This commit is contained in:
@@ -691,7 +691,25 @@ void NotificationData::setImage(const QString &imagePath) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (_notification) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user