mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Get rid of NotificationData::init
This commit is contained in:
parent
93615fef65
commit
892db55ae1
1 changed files with 6 additions and 20 deletions
|
@ -147,9 +147,8 @@ public:
|
||||||
NotificationData(
|
NotificationData(
|
||||||
not_null<Manager*> manager,
|
not_null<Manager*> manager,
|
||||||
XdgNotifications::NotificationsProxy proxy,
|
XdgNotifications::NotificationsProxy proxy,
|
||||||
NotificationId id);
|
NotificationId id,
|
||||||
|
const Info &info);
|
||||||
[[nodiscard]] bool init(const Info &info);
|
|
||||||
|
|
||||||
NotificationData(const NotificationData &other) = delete;
|
NotificationData(const NotificationData &other) = delete;
|
||||||
NotificationData &operator=(const NotificationData &other) = delete;
|
NotificationData &operator=(const NotificationData &other) = delete;
|
||||||
|
@ -188,7 +187,8 @@ using Notification = std::unique_ptr<NotificationData>;
|
||||||
NotificationData::NotificationData(
|
NotificationData::NotificationData(
|
||||||
not_null<Manager*> manager,
|
not_null<Manager*> manager,
|
||||||
XdgNotifications::NotificationsProxy proxy,
|
XdgNotifications::NotificationsProxy proxy,
|
||||||
NotificationId id)
|
NotificationId id,
|
||||||
|
const Info &info)
|
||||||
: _manager(manager)
|
: _manager(manager)
|
||||||
, _id(id)
|
, _id(id)
|
||||||
, _sounds(cWorkingDir() + u"tdata/audio_cache"_q)
|
, _sounds(cWorkingDir() + u"tdata/audio_cache"_q)
|
||||||
|
@ -200,9 +200,6 @@ NotificationData::NotificationData(
|
||||||
, _interface(proxy)
|
, _interface(proxy)
|
||||||
, _hints(GLib::VariantDict::new_())
|
, _hints(GLib::VariantDict::new_())
|
||||||
, _imageKey(GetImageKey()) {
|
, _imageKey(GetImageKey()) {
|
||||||
}
|
|
||||||
|
|
||||||
bool NotificationData::init(const Info &info) {
|
|
||||||
const auto &title = info.title;
|
const auto &title = info.title;
|
||||||
const auto &subtitle = info.subtitle;
|
const auto &subtitle = info.subtitle;
|
||||||
|
|
||||||
|
@ -268,12 +265,6 @@ bool NotificationData::init(const Info &info) {
|
||||||
"app.notification-mark-as-read",
|
"app.notification-mark-as-read",
|
||||||
notificationVariant);
|
notificationVariant);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!_interface) {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto &text = info.message;
|
const auto &text = info.message;
|
||||||
|
@ -430,8 +421,6 @@ bool NotificationData::init(const Info &info) {
|
||||||
_lifetime.add([=] {
|
_lifetime.add([=] {
|
||||||
_interface.disconnect(notificationClosedSignalId);
|
_interface.disconnect(notificationClosedSignalId);
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotificationData::show() {
|
void NotificationData::show() {
|
||||||
|
@ -816,11 +805,8 @@ void Manager::Private::showNotification(
|
||||||
auto notification = std::make_unique<NotificationData>(
|
auto notification = std::make_unique<NotificationData>(
|
||||||
_manager,
|
_manager,
|
||||||
_proxy,
|
_proxy,
|
||||||
notificationId);
|
notificationId,
|
||||||
const auto inited = notification->init(info);
|
info);
|
||||||
if (!inited) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!options.hideNameAndPhoto) {
|
if (!options.hideNameAndPhoto) {
|
||||||
notification->setImage(
|
notification->setImage(
|
||||||
|
|
Loading…
Add table
Reference in a new issue