mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-09-08 02:25:13 +00:00
Move glib usage to glibmm
This commit is contained in:
@@ -10,16 +10,39 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "core/application.h"
|
||||
#include "main/main_domain.h"
|
||||
#include "window/notifications_manager.h"
|
||||
#include "platform/linux/specific_linux.h"
|
||||
#include "base/platform/linux/base_linux_dbus_utilities.h"
|
||||
|
||||
#include <QtDBus/QDBusConnection>
|
||||
|
||||
namespace Platform {
|
||||
namespace internal {
|
||||
namespace {
|
||||
|
||||
constexpr auto kNotificationService = "org.freedesktop.Notifications"_cs;
|
||||
|
||||
bool IsNotificationServiceActivatable() {
|
||||
static const auto Result = [] {
|
||||
try {
|
||||
const auto connection = Gio::DBus::Connection::get_sync(
|
||||
Gio::DBus::BusType::BUS_TYPE_SESSION);
|
||||
|
||||
return ranges::contains(
|
||||
base::Platform::DBus::ListActivatableNames(connection),
|
||||
Glib::ustring(std::string(kNotificationService)));
|
||||
} catch (...) {
|
||||
}
|
||||
|
||||
return false;
|
||||
}();
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
NotificationServiceWatcher::NotificationServiceWatcher()
|
||||
: _dbusWatcher(
|
||||
qsl("org.freedesktop.Notifications"),
|
||||
kNotificationService.utf16(),
|
||||
QDBusConnection::sessionBus(),
|
||||
QDBusServiceWatcher::WatchForOwnerChange) {
|
||||
const auto signal = &QDBusServiceWatcher::serviceOwnerChanged;
|
||||
|
Reference in New Issue
Block a user