diff --git a/app/src/handlers/systemhandler.cpp b/app/src/handlers/systemhandler.cpp index cb1f9135ad1f53eb9b66afcdd498aed969fd76df..a5c3d10658d2dc7a79c9a6ded69179bd13d5977b 100644 --- a/app/src/handlers/systemhandler.cpp +++ b/app/src/handlers/systemhandler.cpp @@ -8,7 +8,6 @@ #include <QProcess> #include <QDBusMessage> #include <QDBusConnection> -#include <QDBusVariant> #include <QDebug> #endif @@ -297,15 +296,10 @@ bool SystemHandler::applyGnomeGnomeShellTheme(const QString &path) const return QProcess::startDetached("gsettings", arguments); } -bool SystemHandler::applyXfceWallpaper(const QString &path) const +bool SystemHandler::setPropertyWithXfconf(const QString &channel, const QString &property, const QDBusVariant &value) const { - QString channelValue = "xfce4-desktop"; - //QString propertyValue = "/backdrop/screen0/monitor0/image-path"; - QString propertyValue = "/backdrop/screen0/monitor0/workspace0/last-image"; - QDBusVariant valueValue(path); - auto message = QDBusMessage::createMethodCall("org.xfce.Xfconf", "/org/xfce/Xfconf", "org.xfce.Xfconf", "SetProperty"); - message.setArguments(QVariantList() << QVariant(channelValue) << QVariant(propertyValue) << QVariant::fromValue(valueValue)); + message.setArguments(QVariantList() << QVariant(channel) << QVariant(property) << QVariant::fromValue(value)); auto reply = QDBusConnection::sessionBus().call(message); if (reply.type() == QDBusMessage::ErrorMessage) { @@ -314,4 +308,9 @@ bool SystemHandler::applyXfceWallpaper(const QString &path) const } return true; } + +bool SystemHandler::applyXfceWallpaper(const QString &path) const +{ + return setPropertyWithXfconf("xfce4-desktop", "/backdrop/screen0/monitor0/workspace0/last-image", QDBusVariant(path)); +} #endif diff --git a/app/src/handlers/systemhandler.h b/app/src/handlers/systemhandler.h index 06cd247a85ddef772a5752a2afe21779ff7d4828..1d61714dff33ea080770cf1ba9fb631cbf32107b 100644 --- a/app/src/handlers/systemhandler.h +++ b/app/src/handlers/systemhandler.h @@ -2,6 +2,10 @@ #include <QObject> +#ifdef QTLIB_UNIX +#include <QDBusVariant> +#endif + class SystemHandler : public QObject { Q_OBJECT @@ -36,6 +40,7 @@ private: bool applyGnomeGtk3Theme(const QString &path) const; bool applyGnomeGnomeShellTheme(const QString &path) const; + bool setPropertyWithXfconf(const QString &channel, const QString &property, const QDBusVariant &value) const; bool applyXfceWallpaper(const QString &path) const; #endif };