File indexing completed on 2024-04-28 17:04:01

0001 /*****************************************************************************
0002  *   Copyright 2015 - 2015 Yichao Yu <yyc1992@gmail.com>                     *
0003  *                                                                           *
0004  *   This program is free software; you can redistribute it and/or modify    *
0005  *   it under the terms of the GNU Lesser General Public License as          *
0006  *   published by the Free Software Foundation; either version 2.1 of the    *
0007  *   License, or (at your option) version 3, or any later version accepted   *
0008  *   by the membership of KDE e.V. (or its successor approved by the         *
0009  *   membership of KDE e.V.), which shall act as a proxy defined in          *
0010  *   Section 6 of version 3 of the license.                                  *
0011  *                                                                           *
0012  *   This program is distributed in the hope that it will be useful,         *
0013  *   but WITHOUT ANY WARRANTY; without even the implied warranty of          *
0014  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU       *
0015  *   Lesser General Public License for more details.                         *
0016  *                                                                           *
0017  *   You should have received a copy of the GNU Lesser General Public        *
0018  *   License along with this library. If not,                                *
0019  *   see <http://www.gnu.org/licenses/>.                                     *
0020  *****************************************************************************/
0021 
0022 #include "dbus.h"
0023 
0024 namespace QtCurve {
0025 namespace GDBus {
0026 
0027 static GDBusConnection*
0028 getConnection()
0029 {
0030     static GDBusConnection *conn = g_bus_get_sync(G_BUS_TYPE_SESSION,
0031                                                   nullptr, nullptr);
0032     return conn;
0033 }
0034 
0035 void
0036 _callMethod(const char *bus_name, const char *path, const char *iface,
0037             const char *method, GVariant *params)
0038 {
0039     if (GDBusConnection *conn = getConnection()) {
0040         g_dbus_connection_call(conn, bus_name, path, iface, method, params,
0041                                nullptr, G_DBUS_CALL_FLAGS_NONE, -1,
0042                                nullptr, nullptr, nullptr);
0043     }
0044 }
0045 
0046 }
0047 }