mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Guard linux notification inhibition checks
This commit is contained in:
parent
a79e979fb8
commit
8e8a209aad
1 changed files with 9 additions and 4 deletions
|
@ -788,7 +788,7 @@ void Create(Window::Notifications::System *system) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
class Manager::Private {
|
class Manager::Private : public base::has_weak_ptr {
|
||||||
public:
|
public:
|
||||||
using Type = Window::Notifications::CachedUserpics::Type;
|
using Type = Window::Notifications::CachedUserpics::Type;
|
||||||
explicit Private(not_null<Manager*> manager, Type type);
|
explicit Private(not_null<Manager*> manager, Type type);
|
||||||
|
@ -862,9 +862,10 @@ Manager::Private::Private(not_null<Manager*> manager, Type type)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetInhibited([=](bool result) {
|
const auto weak = base::make_weak(this);
|
||||||
|
GetInhibited(crl::guard(weak, [=](bool result) {
|
||||||
_inhibited = result;
|
_inhibited = result;
|
||||||
});
|
}));
|
||||||
|
|
||||||
_inhibitedSignalId = _dbusConnection->signal_subscribe(
|
_inhibitedSignalId = _dbusConnection->signal_subscribe(
|
||||||
[=](
|
[=](
|
||||||
|
@ -882,10 +883,14 @@ Manager::Private::Private(not_null<Manager*> manager, Type type)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_inhibited = GlibVariantCast<bool>(
|
const auto inhibited = GlibVariantCast<bool>(
|
||||||
GlibVariantCast<
|
GlibVariantCast<
|
||||||
std::map<Glib::ustring, Glib::VariantBase>
|
std::map<Glib::ustring, Glib::VariantBase>
|
||||||
>(parameters.get_child(1)).at("Inhibited"));
|
>(parameters.get_child(1)).at("Inhibited"));
|
||||||
|
|
||||||
|
crl::on_main(weak, [=] {
|
||||||
|
_inhibited = inhibited;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
std::string(kService),
|
std::string(kService),
|
||||||
|
|
Loading…
Add table
Reference in a new issue