mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Generate GUID for GNotification
That's what g_application_send_notification does when ID is not passed and that simplifies the code
This commit is contained in:
parent
cf781e1043
commit
da55698a51
1 changed files with 5 additions and 14 deletions
|
@ -360,6 +360,7 @@ private:
|
||||||
|
|
||||||
Glib::RefPtr<Gio::Application> _application;
|
Glib::RefPtr<Gio::Application> _application;
|
||||||
Glib::RefPtr<Gio::Notification> _notification;
|
Glib::RefPtr<Gio::Notification> _notification;
|
||||||
|
const std::string _guid;
|
||||||
|
|
||||||
Glib::RefPtr<Gio::DBus::Connection> _dbusConnection;
|
Glib::RefPtr<Gio::DBus::Connection> _dbusConnection;
|
||||||
Glib::ustring _title;
|
Glib::ustring _title;
|
||||||
|
@ -390,7 +391,8 @@ NotificationData::NotificationData(
|
||||||
, _id(id)
|
, _id(id)
|
||||||
, _application(UseGNotification()
|
, _application(UseGNotification()
|
||||||
? Gio::Application::get_default()
|
? Gio::Application::get_default()
|
||||||
: nullptr) {
|
: nullptr)
|
||||||
|
, _guid(_application ? Gio::DBus::generate_guid() : std::string()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NotificationData::init(
|
bool NotificationData::init(
|
||||||
|
@ -623,13 +625,7 @@ NotificationData::~NotificationData() {
|
||||||
|
|
||||||
void NotificationData::show() {
|
void NotificationData::show() {
|
||||||
if (_application && _notification) {
|
if (_application && _notification) {
|
||||||
_application->send_notification(
|
_application->send_notification(_guid, _notification);
|
||||||
std::to_string(_id.contextId.sessionId)
|
|
||||||
+ '-'
|
|
||||||
+ std::to_string(_id.contextId.peerId.value)
|
|
||||||
+ '-'
|
|
||||||
+ std::to_string(_id.msgId.bare),
|
|
||||||
_notification);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -679,12 +675,7 @@ void NotificationData::show() {
|
||||||
|
|
||||||
void NotificationData::close() {
|
void NotificationData::close() {
|
||||||
if (_application) {
|
if (_application) {
|
||||||
_application->withdraw_notification(
|
_application->withdraw_notification(_guid);
|
||||||
std::to_string(_id.contextId.sessionId)
|
|
||||||
+ '-'
|
|
||||||
+ std::to_string(_id.contextId.peerId.value)
|
|
||||||
+ '-'
|
|
||||||
+ std::to_string(_id.msgId.bare));
|
|
||||||
_manager->clearNotification(_id);
|
_manager->clearNotification(_id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue