mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
Don't link glib with DESKTOP_APP_DISABLE_DBUS_INTEGRATION
This commit is contained in:
@@ -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)) {
|
||||
|
@@ -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) {
|
||||
|
@@ -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() {
|
||||
|
Reference in New Issue
Block a user