Check GNotification option via base::options::lookup

This commit is contained in:
Ilya Fedin
2026-06-25 22:15:18 +00:00
committed by John Preston
parent 228934b6c3
commit ab8d1ffa67
3 changed files with 39 additions and 46 deletions
@@ -70,6 +70,37 @@ constexpr auto kSystemAlertDuration = crl::time(1000);
constexpr auto kSystemAlertDuration = crl::time(0);
#endif // Q_OS_MAC
base::options::toggle OptionCustomNotification({
.id = kOptionCustomNotification,
.name = "Force non-native notifications availability",
.description = "Allow to disable native notifications"
" even if custom notifications are broken on this platform",
.scope = [] {
return Platform::Notifications::Enforced();
},
});
base::options::toggle OptionGNotification({
.id = kOptionGNotification,
.name = "GNotification",
.description = "Force enable GLib's GNotification."
" When disabled, autodetect is used.",
.scope = [] {
#if __has_include(<gio/gio.hpp>)
using namespace gi::repository;
return bool(Gio::Application::get_default());
#else // __has_include(<gio/gio.hpp>)
return false;
#endif // __has_include(<gio/gio.hpp>)
},
});
base::options::toggle HideReplyButtonOption({
.id = kOptionHideReplyButton,
.name = "Hide reply button",
.description = "Hide reply button in notifications.",
});
[[nodiscard]] QString PlaceholderReactionText() {
static const auto result = QString::fromUtf8("\xf0\x9f\x92\xad");
return result;
@@ -140,41 +171,9 @@ constexpr auto kSystemAlertDuration = crl::time(0);
} // namespace
const char kOptionCustomNotification[] = "custom-notification";
base::options::toggle OptionCustomNotification({
.id = kOptionCustomNotification,
.name = "Force non-native notifications availability",
.description = "Allow to disable native notifications"
" even if custom notifications are broken on this platform",
.scope = [] {
return Platform::Notifications::Enforced();
},
});
const char kOptionGNotification[] = "gnotification";
const char kOptionHideReplyButton[] = "hide-reply-button";
base::options::toggle OptionGNotification({
.id = kOptionGNotification,
.name = "GNotification",
.description = "Force enable GLib's GNotification."
" When disabled, autodetect is used.",
.scope = [] {
#if __has_include(<gio/gio.hpp>)
using namespace gi::repository;
return bool(Gio::Application::get_default());
#else // __has_include(<gio/gio.hpp>)
return false;
#endif // __has_include(<gio/gio.hpp>)
},
});
base::options::toggle HideReplyButtonOption({
.id = kOptionHideReplyButton,
.name = "Hide reply button",
.description = "Hide reply button in notifications.",
});
struct System::Waiter {
NotificationInHistoryKey key;
UserData *reactionOrVoteSender = nullptr;