2
* This file is a part of the Cairo-Dock project
4
* Copyright : (C) see the 'copyright' file.
5
* E-mail : see the 'copyright' file.
7
* This program is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU General Public License
9
* as published by the Free Software Foundation; either version 3
10
* of the License, or (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program. If not, see <http://www.gnu.org/licenses/>.
21
#ifndef __CAIRO_DOCK_DBUS__
22
#define __CAIRO_DOCK_DBUS__
25
#include <dbus/dbus-glib.h>
26
#include <dbus/dbus-glib-bindings.h>
30
*@file cairo-dock-dbus.h This class defines numerous convenient functions to use DBus inside Cairo-Dock.
31
* DBus is used to communicate and interact with other running applications.
34
/** Get the connection to the 'session' Bus.
35
*@return the connection to the bus.
37
DBusGConnection *cairo_dock_get_session_connection (void);
38
#define cairo_dock_get_dbus_connection cairo_dock_get_session_connection
40
DBusGProxy *cairo_dock_get_main_proxy (void);
42
DBusGProxy *cairo_dock_get_main_system_proxy (void);
44
/**Register a new service on the session bus.
45
*@param cServiceName name of the service.
47
void cairo_dock_register_service_name (const gchar *cServiceName);
49
/** Say if the bus is available or not.
50
*@return TRUE if the connection to the bus has been established.
52
gboolean cairo_dock_bdus_is_enabled (void);
54
/** Create a new proxy for the 'session' connection.
55
*@param name a name on the bus.
56
*@param path the path.
57
*@param interface name of the interface.
58
*@return the newly created proxy. Use g_object_unref when your done with it.
60
DBusGProxy *cairo_dock_create_new_session_proxy (const char *name, const char *path, const char *interface);
61
#define cairo_dock_create_new_dbus_proxy cairo_dock_create_new_session_proxy
63
/**Create a new proxy for the 'system' connection.
64
*@param name a name on the bus.
65
*@param path the path.
66
*@param interface name of the interface.
67
*@return the newly created proxy. Use g_object_unref when your done with it.
69
DBusGProxy *cairo_dock_create_new_system_proxy (const char *name, const char *path, const char *interface);
71
/** Detect if an application is currently running on Session bus.
72
*@param cName name of the application.
73
*@return TRUE if the application is running and has a service on the bus.
75
gboolean cairo_dock_dbus_detect_application (const gchar *cName);
77
/** Detect if an application is currently running on System bus.
78
*@param cName name of the application.
79
*@return TRUE if the application is running and has a service on the bus.
81
gboolean cairo_dock_dbus_detect_system_application (const gchar *cName);
84
gchar **cairo_dock_dbus_get_services (void);
86
/** Get the value of a 'boolean' parameter on the bus.
87
*@param pDbusProxy proxy to the connection.
88
*@param cAccessor name of the accessor.
89
*@return the value of the parameter.
91
gboolean cairo_dock_dbus_get_boolean (DBusGProxy *pDbusProxy, const gchar *cAccessor);
93
/** Get the value of an 'unsigned integer' parameter non signe on the bus.
94
*@param pDbusProxy proxy to the connection.
95
*@param cAccessor name of the accessor.
96
*@return the value of the parameter.
98
guint cairo_dock_dbus_get_uinteger (DBusGProxy *pDbusProxy, const gchar *cAccessor);
100
/** Get the value of a 'integer' parameter on the bus.
101
*@param pDbusProxy proxy to the connection.
102
*@param cAccessor name of the accessor.
103
*@return the value of the parameter.
105
int cairo_dock_dbus_get_integer (DBusGProxy *pDbusProxy, const gchar *cAccessor);
107
/** Get the value of a 'string' parameter on the bus.
108
*@param pDbusProxy proxy to the connection.
109
*@param cAccessor name of the accessor.
110
*@return the value of the parameter, to be freeed with g_free.
112
gchar *cairo_dock_dbus_get_string (DBusGProxy *pDbusProxy, const gchar *cAccessor);
114
/** Get the value of a 'string list' parameter on the bus.
115
*@param pDbusProxy proxy to the connection.
116
*@param cAccessor name of the accessor.
117
*@return the value of the parameter, to be freeed with g_strfreev.
119
gchar **cairo_dock_dbus_get_string_list (DBusGProxy *pDbusProxy, const gchar *cAccessor);
121
GPtrArray *cairo_dock_dbus_get_array (DBusGProxy *pDbusProxy, const gchar *cAccessor);
123
/** Get the value of an 'unsigned char' parameter on the bus.
124
*@param pDbusProxy proxy to the connection.
125
*@param cAccessor name of the accessor.
126
*@return the value of the parameter.
128
guchar *cairo_dock_dbus_get_uchar (DBusGProxy *pDbusProxy, const gchar *cAccessor);
130
gdouble cairo_dock_dbus_get_double (DBusGProxy *pDbusProxy, const gchar *cAccessor);
132
/** Call a command on the bus.
133
*@param pDbusProxy proxy to the connection.
134
*@param cCommand name of the commande.
136
void cairo_dock_dbus_call (DBusGProxy *pDbusProxy, const gchar *cCommand);
139
void cairo_dock_dbus_get_properties (DBusGProxy *pDbusProxy, const gchar *cCommand, const gchar *cInterface, const gchar *cProperty, GValue *vProperties); /// deprecated...
141
void cairo_dock_dbus_get_property_in_value (DBusGProxy *pDbusProxy, const gchar *cInterface, const gchar *cProperty, GValue *pProperty);
143
gboolean cairo_dock_dbus_get_property_as_boolean (DBusGProxy *pDbusProxy, const gchar *cInterface, const gchar *cProperty);
145
gint cairo_dock_dbus_get_property_as_int (DBusGProxy *pDbusProxy, const gchar *cInterface, const gchar *cProperty);
147
guint cairo_dock_dbus_get_property_as_uint (DBusGProxy *pDbusProxy, const gchar *cInterface, const gchar *cProperty);
149
guchar cairo_dock_dbus_get_property_as_uchar (DBusGProxy *pDbusProxy, const gchar *cInterface, const gchar *cProperty);
151
gdouble cairo_dock_dbus_get_property_as_double (DBusGProxy *pDbusProxy, const gchar *cInterface, const gchar *cProperty);
153
gchar *cairo_dock_dbus_get_property_as_string (DBusGProxy *pDbusProxy, const gchar *cInterface, const gchar *cProperty);
155
gchar *cairo_dock_dbus_get_property_as_object_path (DBusGProxy *pDbusProxy, const gchar *cInterface, const gchar *cProperty);
157
gpointer cairo_dock_dbus_get_property_as_boxed (DBusGProxy *pDbusProxy, const gchar *cInterface, const gchar *cProperty);
160
GHashTable *cairo_dock_dbus_get_all_properties (DBusGProxy *pDbusProxy, const gchar *cInterface);
163
void cairo_dock_dbus_set_property (DBusGProxy *pDbusProxy, const gchar *cInterface, const gchar *cProperty, GValue *pProperty);
165
void cairo_dock_dbus_set_boolean_property (DBusGProxy *pDbusProxy, const gchar *cInterface, const gchar *cProperty, gboolean bValue);