Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[DBus] Wrap the default DBus client in a utility class. JB#47762
  • Loading branch information
abranson committed Nov 5, 2019
1 parent 1d0cefb commit babf605
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 6 deletions.
9 changes: 5 additions & 4 deletions libssu/libssu.pro
Expand Up @@ -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
Expand All @@ -12,7 +12,7 @@ public_headers = \
ssudeviceinfo.h \
ssurepomanager.h \
ssufeaturemodel.h \
ssu_interface.h
ssuproxy.h

HEADERS = \
$${public_headers} \
Expand All @@ -33,7 +33,8 @@ SOURCES = \
ssufeaturemodel.cpp \
ssuvariables.cpp \
ssurepomanager.cpp \
ssusettings.cpp
ssusettings.cpp \
ssuproxy.cpp

CONFIG += link_pkgconfig
QT += network xml dbus
Expand Down
9 changes: 9 additions & 0 deletions libssu/ssuproxy.cpp
@@ -0,0 +1,9 @@

#include <QDBusConnection>
#include "ssuproxy.h"

SsuProxy::SsuProxy()
: SsuDBusInterface("org.nemo.ssu", "/org/nemo/ssu", QDBusConnection::systemBus(), 0)
{
}

38 changes: 38 additions & 0 deletions 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 <http://www.gnu.org/licenses/>.
*
*/

#ifndef _SSUPROXY_H
#define _SSUPROXY_H

#include "../libssu/ssu_interface.h"

class SsuProxy: public SsuDBusInterface
{
Q_OBJECT

public:
SsuProxy();
};

#endif // _SSUPROXY_H
2 changes: 1 addition & 1 deletion ssucli/ssucli.cpp
Expand Up @@ -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()));
Expand Down
2 changes: 1 addition & 1 deletion ssucli/ssucli.h
Expand Up @@ -31,7 +31,7 @@
#include <QDebug>

#include "libssu/ssu.h"
#include "../libssu/ssu_interface.h"
#include "libssu/ssuproxy.h"

class SsuCli: public QObject
{
Expand Down

0 comments on commit babf605

Please sign in to comment.