mirror of https://github.com/procxx/kepka.git
Add possibility to build without dbus
This commit is contained in:
parent
b4fbff0b6c
commit
0480611bf8
|
@ -7,7 +7,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
#include "platform/linux/linux_desktop_environment.h"
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
|
||||
#include <QDBusInterface>
|
||||
#endif
|
||||
|
||||
namespace Platform {
|
||||
namespace DesktopEnvironment {
|
||||
|
@ -117,11 +119,11 @@ bool TryQtTrayIcon() {
|
|||
|
||||
bool PreferAppIndicatorTrayIcon() {
|
||||
return IsXFCE() || IsUnity() || IsUbuntu() ||
|
||||
(IsGnome() && QDBusInterface("org.kde.StatusNotifierWatcher", "/").isValid());
|
||||
}
|
||||
|
||||
bool TryUnityCounter() {
|
||||
return IsUnity() || IsPantheon() || IsUbuntu() || IsKDE5();
|
||||
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
|
||||
(IsGnome() && QDBusInterface("org.kde.StatusNotifierWatcher", "/").isValid());
|
||||
#else
|
||||
IsGnome();
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace DesktopEnvironment
|
||||
|
|
|
@ -67,7 +67,6 @@ inline bool IsAwesome() {
|
|||
|
||||
bool TryQtTrayIcon();
|
||||
bool PreferAppIndicatorTrayIcon();
|
||||
bool TryUnityCounter();
|
||||
|
||||
} // namespace DesktopEnvironment
|
||||
} // namespace Platform
|
||||
|
|
|
@ -19,7 +19,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "facades.h"
|
||||
#include "app.h"
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
|
||||
#include <QtDBus>
|
||||
#endif
|
||||
|
||||
#include <QtWidgets/QMenu>
|
||||
#include <QtWidgets/QAction>
|
||||
|
||||
|
@ -43,7 +46,10 @@ bool _trayIconMuted = true;
|
|||
int32 _trayIconCount = 0;
|
||||
QImage _trayIconImageBack, _trayIconImage;
|
||||
QString _desktopFile;
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
|
||||
QString _dbusPath = "/";
|
||||
#endif
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION
|
||||
void _trayIconPopup(GtkStatusIcon *status_icon, guint button, guint32 activate_time, gpointer popup_menu) {
|
||||
|
@ -341,6 +347,7 @@ void MainWindow::updateIconCounters() {
|
|||
|
||||
const auto counter = Core::App().unreadBadge();
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
|
||||
if (useUnityCount) {
|
||||
QVariantMap dbusUnityProperties;
|
||||
if (counter > 0) {
|
||||
|
@ -355,6 +362,7 @@ void MainWindow::updateIconCounters() {
|
|||
signal << dbusUnityProperties;
|
||||
QDBusConnection::sessionBus().send(signal);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (noQtTrayIcon) {
|
||||
#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION
|
||||
|
@ -544,6 +552,7 @@ void MainWindow::psCreateTrayIcon() {
|
|||
void MainWindow::psFirstShow() {
|
||||
psCreateTrayIcon();
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
|
||||
if (QDBusInterface("com.canonical.Unity", "/").isValid()) {
|
||||
auto snapName = QString::fromLatin1(qgetenv("SNAP_NAME"));
|
||||
if(snapName.isEmpty()) {
|
||||
|
@ -572,6 +581,7 @@ void MainWindow::psFirstShow() {
|
|||
} else {
|
||||
LOG(("Not using Unity Launcher count."));
|
||||
}
|
||||
#endif
|
||||
|
||||
bool showShadows = true;
|
||||
|
||||
|
|
|
@ -12,12 +12,17 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "facades.h"
|
||||
|
||||
#include <QtCore/QBuffer>
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
|
||||
#include <QtDBus/QDBusConnection>
|
||||
#include <QtDBus/QDBusReply>
|
||||
#include <QtDBus/QDBusMetaType>
|
||||
#endif
|
||||
|
||||
namespace Platform {
|
||||
namespace Notifications {
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
|
||||
namespace {
|
||||
|
||||
constexpr auto kService = str_const("org.freedesktop.Notifications");
|
||||
|
@ -276,24 +281,32 @@ const QDBusArgument &operator>>(const QDBusArgument &argument,
|
|||
argument.endStructure();
|
||||
return argument;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool Supported() {
|
||||
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
|
||||
static auto Available = QDBusInterface(
|
||||
str_const_toString(kService),
|
||||
str_const_toString(kObjectPath),
|
||||
str_const_toString(kInterface)).isValid();
|
||||
|
||||
return Available;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
std::unique_ptr<Window::Notifications::Manager> Create(
|
||||
Window::Notifications::System *system) {
|
||||
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
|
||||
if (Global::NativeNotifications() && Supported()) {
|
||||
return std::make_unique<Manager>(system);
|
||||
}
|
||||
#endif
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
|
||||
Manager::Private::Private(Manager *manager, Type type)
|
||||
: _cachedUserpics(type)
|
||||
, _manager(manager)
|
||||
|
@ -435,6 +448,7 @@ void Manager::doClearAllFast() {
|
|||
void Manager::doClearFromHistory(not_null<History*> history) {
|
||||
_private->clearFromHistory(history);
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace Notifications
|
||||
} // namespace Platform
|
||||
|
|
|
@ -11,8 +11,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "window/notifications_utilities.h"
|
||||
#include "base/weak_ptr.h"
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
|
||||
#include <QtDBus/QDBusInterface>
|
||||
#include <QtDBus/QDBusArgument>
|
||||
#endif
|
||||
|
||||
namespace Platform {
|
||||
namespace Notifications {
|
||||
|
@ -28,6 +30,7 @@ inline bool SkipToast() {
|
|||
inline void FlashBounce() {
|
||||
}
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
|
||||
class NotificationData : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -134,8 +137,11 @@ private:
|
|||
base::weak_ptr<Manager> _manager;
|
||||
std::shared_ptr<QDBusInterface> _notificationInterface;
|
||||
};
|
||||
#endif
|
||||
|
||||
} // namespace Notifications
|
||||
} // namespace Platform
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
|
||||
Q_DECLARE_METATYPE(Platform::Notifications::NotificationData::ImageData)
|
||||
#endif
|
||||
|
|
|
@ -9,6 +9,7 @@ option(TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME "Disable automatic 'tg://' URL sc
|
|||
option(TDESKTOP_DISABLE_NETWORK_PROXY "Disable all code for working through Socks5 or MTProxy." OFF)
|
||||
option(TDESKTOP_DISABLE_DESKTOP_FILE_GENERATION "Disable automatic '.desktop' file generation (Linux only)." OFF)
|
||||
option(TDESKTOP_DISABLE_GTK_INTEGRATION "Disable all code for GTK integration (Linux only)." OFF)
|
||||
option(TDESKTOP_DISABLE_DBUS_INTEGRATION "Disable all code for D-Bus integration (Linux only)." OFF)
|
||||
option(TDESKTOP_USE_PACKAGED_TGVOIP "Find libtgvoip using CMake instead of bundled one." ${DESKTOP_APP_USE_PACKAGED})
|
||||
option(TDESKTOP_API_TEST "Use test API credentials." OFF)
|
||||
set(TDESKTOP_API_ID "0" CACHE STRING "Provide 'api_id' for the Telegram API access.")
|
||||
|
@ -85,6 +86,10 @@ if (TDESKTOP_DISABLE_GTK_INTEGRATION)
|
|||
target_compile_definitions(Telegram PRIVATE TDESKTOP_DISABLE_GTK_INTEGRATION)
|
||||
endif()
|
||||
|
||||
if (TDESKTOP_DISABLE_DBUS_INTEGRATION)
|
||||
target_compile_definitions(Telegram PRIVATE TDESKTOP_DISABLE_DBUS_INTEGRATION)
|
||||
endif()
|
||||
|
||||
if (NOT TDESKTOP_LAUNCHER_BASENAME)
|
||||
if (NOT DESKTOP_APP_USE_PACKAGED)
|
||||
set(TDESKTOP_LAUNCHER_BASENAME "telegramdesktop")
|
||||
|
|
Loading…
Reference in New Issue