From babf6054fa765b3ee7e8aae50101408518b14b43 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Mon, 4 Nov 2019 13:15:05 +0100 Subject: [PATCH] [DBus] Wrap the default DBus client in a utility class. JB#47762 --- libssu/libssu.pro | 9 +++++---- libssu/ssuproxy.cpp | 9 +++++++++ libssu/ssuproxy.h | 38 ++++++++++++++++++++++++++++++++++++++ ssucli/ssucli.cpp | 2 +- ssucli/ssucli.h | 2 +- 5 files changed, 54 insertions(+), 6 deletions(-) create mode 100644 libssu/ssuproxy.cpp create mode 100644 libssu/ssuproxy.h diff --git a/libssu/libssu.pro b/libssu/libssu.pro index ce358d6..73cc397 100644 --- a/libssu/libssu.pro +++ b/libssu/libssu.pro @@ -2,8 +2,8 @@ TARGET = ssu include(../ssulibrary.pri) ssu_dbus_interface.files = ../dbus/org.nemo.ssu.xml -ssu_dbus_interface.source_flags = -c SsuProxy -ssu_dbus_interface.header_flags = -c SsuProxy -i ssud/ssud_dbus.h +ssu_dbus_interface.source_flags = -c SsuDBusInterface +ssu_dbus_interface.header_flags = -c SsuDBusInterface -i ssud/ssud_dbus.h DBUS_INTERFACES += ssu_dbus_interface # TODO: which headers are public? i.e. to be installed @@ -12,7 +12,7 @@ public_headers = \ ssudeviceinfo.h \ ssurepomanager.h \ ssufeaturemodel.h \ - ssu_interface.h + ssuproxy.h HEADERS = \ $${public_headers} \ @@ -33,7 +33,8 @@ SOURCES = \ ssufeaturemodel.cpp \ ssuvariables.cpp \ ssurepomanager.cpp \ - ssusettings.cpp + ssusettings.cpp \ + ssuproxy.cpp CONFIG += link_pkgconfig QT += network xml dbus diff --git a/libssu/ssuproxy.cpp b/libssu/ssuproxy.cpp new file mode 100644 index 0000000..896ba6a --- /dev/null +++ b/libssu/ssuproxy.cpp @@ -0,0 +1,9 @@ + +#include +#include "ssuproxy.h" + +SsuProxy::SsuProxy() + : SsuDBusInterface("org.nemo.ssu", "/org/nemo/ssu", QDBusConnection::systemBus(), 0) +{ +} + diff --git a/libssu/ssuproxy.h b/libssu/ssuproxy.h new file mode 100644 index 0000000..1ce7c7a --- /dev/null +++ b/libssu/ssuproxy.h @@ -0,0 +1,38 @@ +/** + * @file ssuproxy.h + * @copyright 2019 Jolla Ltd. + * @copyright 2019 Open Mobile Platform LLC. + * @copyright LGPLv2+ + * @date 2019 + */ + +/* + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + * + */ + +#ifndef _SSUPROXY_H +#define _SSUPROXY_H + +#include "../libssu/ssu_interface.h" + +class SsuProxy: public SsuDBusInterface +{ + Q_OBJECT + +public: + SsuProxy(); +}; + +#endif // _SSUPROXY_H diff --git a/ssucli/ssucli.cpp b/ssucli/ssucli.cpp index 10eb3bf..c9f4cac 100644 --- a/ssucli/ssucli.cpp +++ b/ssucli/ssucli.cpp @@ -45,7 +45,7 @@ SsuCli::SsuCli() connect(&ssu, SIGNAL(done()), this, SLOT(handleResponse())); - ssuProxy = new SsuProxy("org.nemo.ssu", "/org/nemo/ssu", QDBusConnection::systemBus(), 0); + ssuProxy = new SsuProxy(); connect(ssuProxy, SIGNAL(done()), this, SLOT(handleDBusResponse())); diff --git a/ssucli/ssucli.h b/ssucli/ssucli.h index 09fdc61..7b4a0eb 100644 --- a/ssucli/ssucli.h +++ b/ssucli/ssucli.h @@ -31,7 +31,7 @@ #include #include "libssu/ssu.h" -#include "../libssu/ssu_interface.h" +#include "libssu/ssuproxy.h" class SsuCli: public QObject {