mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 23:53:58 +02:00
Catch ListActivatableNames errors
This commit is contained in:
parent
d6848c49e8
commit
b24cba99e2
3 changed files with 21 additions and 19 deletions
|
@ -50,13 +50,27 @@ bool GetServiceRegistered() {
|
||||||
const auto connection = Gio::DBus::Connection::get_sync(
|
const auto connection = Gio::DBus::Connection::get_sync(
|
||||||
Gio::DBus::BusType::BUS_TYPE_SESSION);
|
Gio::DBus::BusType::BUS_TYPE_SESSION);
|
||||||
|
|
||||||
static const auto activatable = ranges::contains(
|
const auto hasOwner = [&] {
|
||||||
base::Platform::DBus::ListActivatableNames(connection),
|
try {
|
||||||
Glib::ustring(std::string(kService)));
|
return base::Platform::DBus::NameHasOwner(
|
||||||
|
connection,
|
||||||
|
std::string(kService));
|
||||||
|
} catch (...) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}();
|
||||||
|
|
||||||
return base::Platform::DBus::NameHasOwner(
|
static const auto activatable = [&] {
|
||||||
connection,
|
try {
|
||||||
std::string(kService)) || activatable;
|
return ranges::contains(
|
||||||
|
base::Platform::DBus::ListActivatableNames(connection),
|
||||||
|
Glib::ustring(std::string(kService)));
|
||||||
|
} catch (...) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}();
|
||||||
|
|
||||||
|
return hasOwner || activatable;
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -371,14 +371,6 @@ bool InSnap() {
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AreQtPluginsBundled() {
|
|
||||||
#if !defined DESKTOP_APP_USE_PACKAGED || defined DESKTOP_APP_USE_PACKAGED_LAZY
|
|
||||||
return true;
|
|
||||||
#else // !DESKTOP_APP_USE_PACKAGED || DESKTOP_APP_USE_PACKAGED_LAZY
|
|
||||||
return false;
|
|
||||||
#endif // DESKTOP_APP_USE_PACKAGED && !DESKTOP_APP_USE_PACKAGED_LAZY
|
|
||||||
}
|
|
||||||
|
|
||||||
QString AppRuntimeDirectory() {
|
QString AppRuntimeDirectory() {
|
||||||
static const auto Result = [&] {
|
static const auto Result = [&] {
|
||||||
auto runtimeDir = QStandardPaths::writableLocation(
|
auto runtimeDir = QStandardPaths::writableLocation(
|
||||||
|
@ -659,10 +651,7 @@ void start() {
|
||||||
// Since tdesktop is distributed in static binary form,
|
// Since tdesktop is distributed in static binary form,
|
||||||
// it makes sense to use ibus portal whenever it present
|
// it makes sense to use ibus portal whenever it present
|
||||||
// to ensure compatibility with the maximum range of distributions.
|
// to ensure compatibility with the maximum range of distributions.
|
||||||
if (AreQtPluginsBundled()
|
if (IsIBusPortalPresent()) {
|
||||||
&& !InFlatpak()
|
|
||||||
&& !InSnap()
|
|
||||||
&& IsIBusPortalPresent()) {
|
|
||||||
LOG(("IBus portal is present! Using it."));
|
LOG(("IBus portal is present! Using it."));
|
||||||
qputenv("IBUS_USE_PORTAL", "1");
|
qputenv("IBUS_USE_PORTAL", "1");
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@ namespace Platform {
|
||||||
|
|
||||||
bool InFlatpak();
|
bool InFlatpak();
|
||||||
bool InSnap();
|
bool InSnap();
|
||||||
bool AreQtPluginsBundled();
|
|
||||||
|
|
||||||
QString AppRuntimeDirectory();
|
QString AppRuntimeDirectory();
|
||||||
QString GetLauncherBasename();
|
QString GetLauncherBasename();
|
||||||
|
|
Loading…
Add table
Reference in a new issue