ladishd: save&restore app associations of vclients. Fix for #149
[ladish.git] / gui / dbus.c
blob84f0878fe32bc087004a1a6cab4d08d8e514fa35
1 /* -*- Mode: C ; c-basic-offset: 2 -*- */
2 /*
3 * LADI Session Handler (ladish)
5 * Copyright (C) 2010 Nedko Arnaudov <nedko@arnaudov.name>
7 **************************************************************************
8 * This file contains D-Bus related code
9 **************************************************************************
11 * LADI Session Handler is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * LADI Session Handler is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with LADI Session Handler. If not, see <http://www.gnu.org/licenses/>
23 * or write to the Free Software Foundation, Inc.,
24 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
27 #include "internal.h"
28 #include "../dbus/helpers.h"
29 #include <dbus/dbus-glib-lowlevel.h>
31 void dbus_init(void)
33 dbus_error_init(&g_dbus_error);
35 // Connect to the bus
36 g_dbus_connection = dbus_bus_get(DBUS_BUS_SESSION, &g_dbus_error);
37 if (dbus_error_is_set(&g_dbus_error))
39 //error_msg("dbus_bus_get() failed");
40 //error_msg(g_dbus_error.message);
41 dbus_error_free(&g_dbus_error);
44 dbus_connection_setup_with_g_main(g_dbus_connection, NULL);
47 void dbus_uninit(void)
49 if (g_dbus_connection)
51 dbus_connection_flush(g_dbus_connection);
54 if (dbus_error_is_set(&g_dbus_error))
56 dbus_error_free(&g_dbus_error);
59 dbus_call_last_error_cleanup();