Get rid of DESKTOP_APP_DISABLE_DBUS_INTEGRATION

Desktop App Toolkit uses GLib as the D-Bus library for quite long time, but GLib is not only a D-Bus library, it's more a basic library providing native Linux APIs implementing various specs. The situation right now is that DESKTOP_APP_DISABLE_DBUS_INTEGRATION disables not only D-Bus code but all the native API integration such as MIME handling or .desktop file parsing. In other words, the option disables native Linux APIs on Linux what is absurd and doesn't have any sense.
This commit is contained in:
Ilya Fedin
2023-05-06 02:34:14 +04:00
committed by John Preston
parent 37f5576c38
commit 0a011db483
11 changed files with 17 additions and 129 deletions

View File

@@ -7,23 +7,18 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "platform/linux/file_utilities_linux.h"
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#include "base/platform/linux/base_linux_app_launch_context.h"
#include "platform/linux/linux_xdp_open_with_dialog.h"
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#include <QtGui/QDesktopServices>
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#include <glibmm.h>
#include <giomm.h>
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
namespace Platform {
namespace File {
void UnsafeOpenUrl(const QString &url) {
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
try {
if (Gio::AppInfo::launch_default_for_uri(
url.toStdString(),
@@ -33,7 +28,6 @@ void UnsafeOpenUrl(const QString &url) {
} catch (const std::exception &e) {
LOG(("App Error: %1").arg(QString::fromStdString(e.what())));
}
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
QDesktopServices::openUrl(url);
}
@@ -43,17 +37,14 @@ void UnsafeOpenEmailLink(const QString &email) {
}
bool UnsafeShowOpenWith(const QString &filepath) {
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
if (internal::ShowXDPOpenWithDialog(filepath)) {
return true;
}
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
return false;
}
void UnsafeLaunch(const QString &filepath) {
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
try {
if (Gio::AppInfo::launch_default_for_uri(
Glib::filename_to_uri(filepath.toStdString()),
@@ -67,7 +58,6 @@ void UnsafeLaunch(const QString &filepath) {
if (UnsafeShowOpenWith(filepath)) {
return;
}
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
QDesktopServices::openUrl(QUrl::fromLocalFile(filepath));
}