Don't link glib with DESKTOP_APP_DISABLE_DBUS_INTEGRATION

This commit is contained in:
Ilya Fedin 2021-09-11 01:55:28 +04:00 committed by John Preston
parent ee8c6f68d7
commit 3fbd68cff9
7 changed files with 34 additions and 34 deletions

View File

@ -1245,17 +1245,13 @@ elseif (APPLE)
endif()
endif()
else()
target_link_libraries(Telegram
PRIVATE
desktop-app::external_glibmm
desktop-app::external_glib
)
if (NOT DESKTOP_APP_DISABLE_DBUS_INTEGRATION)
target_link_libraries(Telegram
PRIVATE
desktop-app::external_statusnotifieritem
desktop-app::external_dbusmenu_qt
desktop-app::external_glibmm
desktop-app::external_glib
)
endif()

View File

@ -15,13 +15,16 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <QtCore/QProcess>
#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())) {
return;
@ -29,6 +32,7 @@ void UnsafeOpenUrl(const QString &url) {
} catch (const Glib::Error &e) {
LOG(("App Error: %1").arg(QString::fromStdString(e.what())));
}
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
if (QDesktopServices::openUrl(url)) {
return;
@ -52,6 +56,7 @@ bool UnsafeShowOpenWith(const QString &filepath) {
}
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()))) {
@ -64,6 +69,7 @@ void UnsafeLaunch(const QString &filepath) {
if (UnsafeShowOpenWith(filepath)) {
return;
}
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
const auto qUrlPath = QUrl::fromLocalFile(filepath);
if (QDesktopServices::openUrl(qUrlPath)) {

View File

@ -16,8 +16,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <QtWidgets/QApplication>
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#include <glibmm.h>
#include <giomm.h>
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#include <sys/stat.h>
#include <sys/types.h>
@ -57,8 +59,10 @@ Launcher::Launcher(int argc, char *argv[])
}
int Launcher::exec() {
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
Glib::init();
Gio::init();
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#ifndef DESKTOP_APP_DISABLE_WEBKITGTK
for (auto i = begin(_arguments), e = end(_arguments); i != e; ++i) {

View File

@ -9,7 +9,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/openssl_help.h"
#include "base/platform/base_platform_info.h"
#include "base/platform/linux/base_linux_glibmm_helper.h"
#include "ui/platform/linux/ui_linux_wayland_integration.h"
#include "platform/linux/linux_desktop_environment.h"
#include "platform/linux/linux_wayland_integration.h"
@ -24,6 +23,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "window/window_controller.h"
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#include "base/platform/linux/base_linux_glibmm_helper.h"
#include "base/platform/linux/base_linux_dbus_utilities.h"
#include "base/platform/linux/base_linux_xdp_utilities.h"
#include "platform/linux/linux_xdp_file_dialog.h"
@ -46,9 +46,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <QtGui/QWindow>
#include <private/qguiapplication_p.h>
#include <jemalloc/jemalloc.h>
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#include <glibmm.h>
#include <giomm.h>
#include <jemalloc/jemalloc.h>
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#include <sys/stat.h>
#include <sys/types.h>
@ -577,23 +580,14 @@ void psActivateProcess(uint64 pid) {
namespace {
QString GetHomeDir() {
const auto home = QString::fromStdString(Glib::get_home_dir());
if (!home.isEmpty() && !home.endsWith('/')) {
return home + '/';
}
return home;
}
#ifdef __HAIKU__
void HaikuAutostart(bool start) {
const auto home = GetHomeDir();
const auto home = QDir::homePath();
if (home.isEmpty()) {
return;
}
QFile file(home + "config/settings/boot/launch/telegram-desktop");
QFile file(home + "/config/settings/boot/launch/telegram-desktop");
if (start) {
if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {
QTextStream out(&file);
@ -618,9 +612,9 @@ void HaikuAutostart(bool start) {
QString psAppDataPath() {
// Previously we used ~/.TelegramDesktop, so look there first.
// If we find data there, we should still use it.
auto home = GetHomeDir();
auto home = QDir::homePath();
if (!home.isEmpty()) {
auto oldPath = home + qsl(".TelegramDesktop/");
auto oldPath = home + qsl("/.TelegramDesktop/");
auto oldSettingsBase = oldPath + qsl("tdata/settings");
if (QFile::exists(oldSettingsBase + '0')
|| QFile::exists(oldSettingsBase + '1')
@ -671,18 +665,10 @@ void start() {
qputenv("PULSE_PROP_application.name", AppName.utf8());
qputenv("PULSE_PROP_application.icon_name", GetIconName().toLatin1());
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
Glib::set_prgname(cExeName().toStdString());
Glib::set_application_name(std::string(AppName));
#ifndef DESKTOP_APP_DISABLE_WEBKITGTK
const auto d = QFile::encodeName(QDir(cWorkingDir()).absolutePath());
char h[33] = { 0 };
hashMd5Hex(d.constData(), d.size(), h);
Webview::WebKit2Gtk::SetServiceName(
kWebviewService.utf16().arg(h).arg("%1").toStdString());
#endif // !DESKTOP_APP_DISABLE_WEBKITGTK
#ifdef DESKTOP_APP_USE_PACKAGED_RLOTTIE
g_warning(
"Application has been built with foreign rlottie, "
@ -695,7 +681,6 @@ void start() {
"this may lead to font issues.");
#endif // DESKTOP_APP_USE_PACKAGED_FONTS
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
// IBus has changed its socket path several times
// and each change should be synchronized with Qt.
// Moreover, the last time Qt changed the path,
@ -709,6 +694,15 @@ void start() {
qputenv("IBUS_USE_PORTAL", "1");
}
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#ifndef DESKTOP_APP_DISABLE_WEBKITGTK
const auto d = QFile::encodeName(QDir(cWorkingDir()).absolutePath());
char h[33] = { 0 };
hashMd5Hex(d.constData(), d.size(), h);
Webview::WebKit2Gtk::SetServiceName(
kWebviewService.utf16().arg(h).arg("%1").toStdString());
#endif // !DESKTOP_APP_DISABLE_WEBKITGTK
}
void finish() {

@ -1 +1 @@
Subproject commit 4ccf5d6c8c7f04a3b4b583f713ada2434f3d8243
Subproject commit 50d2d313e7127802ae25965b6144515cb5d243c2

@ -1 +1 @@
Subproject commit 246b947fa747a1fd54e0b4a58516e1b3a9465c1a
Subproject commit 15d1560e41e79a2dcd0571ea75fdaeada15f017f

2
cmake

@ -1 +1 @@
Subproject commit 750861b4ab7433c3cb3706c4392eec743cba74a2
Subproject commit 03fad319f5911419e736c26f9458598a4d1e55f8