2 * @file dbus_connection.cpp
4 * @brief Settings daemon D-Bus connection adapter.
6 * @author Michael Leibowitz @<michael.leibowitz@@intel.com@>
7 * @author Ossama Othman @<ossama.othman@@intel.com@>
10 * Copyright 2013 Intel Corporation All Rights Reserved.
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public
14 * License as published by the Free Software Foundation;
15 * version 2.1 of the License.
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
25 * Boston, MA 02110-1301 USA
28 #include "dbus_connection.hpp"
30 #include <settingsd/glib_traits.hpp>
31 #include <settingsd/unique_ptr.hpp>
36 ivi::settings::dbus_connection::dbus_connection()
37 : connection_(nullptr)
39 GError * error = nullptr;
41 connection_ = g_bus_get_sync(G_BUS_TYPE_SYSTEM, nullptr, &error);
43 if (connection_ == nullptr) {
44 unique_ptr<GError> safe_error(error);
45 throw std::runtime_error(error->message);
49 ivi::settings::dbus_connection::~dbus_connection()
51 GError * error = nullptr;
53 if (connection_ != nullptr
54 && !g_dbus_connection_close_sync(connection_,
57 g_critical("D-Bus connection close failed: %s.\n",
67 // indent-tabs-mode: nil