1 /* -*- mode: C; c-file-style: "gnu" -*- */
2 /* dbus-glib.h GLib integration
4 * Copyright (C) 2002, 2003 CodeFactory AB
5 * Copyright (C) 2003 Red Hat, Inc.
7 * Licensed under the Academic Free License version 2.0
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 #include <dbus/dbus.h>
28 #include <glib-object.h>
32 #define DBUS_INSIDE_DBUS_GLIB_H 1
34 GQuark dbus_g_error_quark (void);
35 #define DBUS_GERROR dbus_g_error_quark ()
37 #define DBUS_TYPE_CONNECTION (dbus_connection_get_g_type ())
38 #define DBUS_TYPE_MESSAGE (dbus_message_get_g_type ())
39 GType dbus_connection_get_g_type (void) G_GNUC_CONST;
40 GType dbus_message_get_g_type (void) G_GNUC_CONST;
44 /* FIXME map all the DBUS_ERROR to DBUS_GERROR, should
45 * probably be automated in some way, perhaps
46 * via lame perl script
51 void dbus_set_g_error (GError **gerror,
54 void dbus_g_thread_init (void);
55 void dbus_connection_setup_with_g_main (DBusConnection *connection,
56 GMainContext *context);
57 void dbus_server_setup_with_g_main (DBusServer *server,
58 GMainContext *context);
59 DBusConnection* dbus_bus_get_with_g_main (DBusBusType type,
62 typedef struct DBusGObjectInfo DBusGObjectInfo;
63 typedef struct DBusGMethodInfo DBusGMethodInfo;
66 * Object typically generated by dbus-glib-tool that
67 * stores a mapping from introspection data to a
68 * function pointer for a C method to be invoked.
70 struct DBusGMethodInfo
72 GCallback function; /**< C method to invoke */
73 DBusHandleMessageFunction marshaller; /**< Marshaller to go DBusMessage to C method */
74 int data_offset; /**< Offset into the introspection data */
78 * Introspection data for a GObject, normally autogenerated by
79 * a tool such as dbus-glib-tool.
81 struct DBusGObjectInfo
83 int format_version; /**< Allows us to change the rest of this struct
84 * by adding DBusGObjectInfo2, DBusGObjectInfo3, etc.
86 const DBusGMethodInfo *infos; /**< Array of method pointers */
87 const unsigned char *data; /**< Introspection data */
90 void dbus_g_object_class_install_info (GObjectClass *object_class,
91 const DBusGObjectInfo *info);
92 void dbus_connection_register_g_object (DBusConnection *connection,
97 typedef struct DBusGProxy DBusGProxy;
98 typedef struct DBusGProxyClass DBusGProxyClass;
100 typedef void (* DBusGProxySignalHandler) (DBusGProxy *proxy,
104 #define DBUS_TYPE_GPROXY (dbus_gproxy_get_type ())
105 #define DBUS_GPROXY(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), DBUS_TYPE_GPROXY, DBusGProxy))
106 #define DBUS_GPROXY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DBUS_TYPE_GPROXY, DBusGProxyClass))
107 #define DBUS_IS_GPROXY(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), DBUS_TYPE_GPROXY))
108 #define DBUS_IS_GPROXY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DBUS_TYPE_GPROXY))
109 #define DBUS_GPROXY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DBUS_TYPE_GPROXY, DBusGProxyClass))
112 GType dbus_gproxy_get_type (void) G_GNUC_CONST;
113 DBusGProxy* dbus_gproxy_new_for_service (DBusConnection *connection,
114 const char *service_name,
115 const char *path_name,
116 const char *interface_name);
117 DBusGProxy* dbus_gproxy_new_for_service_owner (DBusConnection *connection,
118 const char *service_name,
119 const char *path_name,
120 const char *interface_name,
122 DBusGProxy* dbus_gproxy_new_for_peer (DBusConnection *connection,
123 const char *path_name,
124 const char *interface_name);
125 void dbus_gproxy_connect_signal (DBusGProxy *proxy,
126 const char *signal_name,
127 DBusGProxySignalHandler handler,
129 GClosureNotify free_data_func);
130 void dbus_gproxy_disconnect_signal (DBusGProxy *proxy,
131 const char *signal_name,
132 DBusGProxySignalHandler handler,
134 DBusPendingCall* dbus_gproxy_begin_call (DBusGProxy *proxy,
138 gboolean dbus_gproxy_end_call (DBusGProxy *proxy,
139 DBusPendingCall *pending,
143 void dbus_gproxy_call_no_reply (DBusGProxy *proxy,
147 void dbus_gproxy_send (DBusGProxy *proxy,
148 DBusMessage *message,
149 dbus_uint32_t *client_serial);
152 #undef DBUS_INSIDE_DBUS_GLIB_H
156 #endif /* DBUS_GLIB_H */