Mercurial > pidgin.yaz
diff src/dbus-server.h @ 11080:f54740547c95
[gaim-migrate @ 13092]
All gaim signals are automatically relayed to dbus.
committer: Tailor Script <tailor@pidgin.im>
author | Piotr Zielinski <zielaj> |
---|---|
date | Sun, 10 Jul 2005 02:29:52 +0000 |
parents | 2eca9ed49469 |
children | 0754ce8f1122 |
line wrap: on
line diff
--- a/src/dbus-server.h Sat Jul 09 20:27:57 2005 +0000 +++ b/src/dbus-server.h Sun Jul 10 02:29:52 2005 +0000 @@ -27,6 +27,8 @@ #ifndef _GAIM_DBUS_SERVER_H_ #define _GAIM_DBUS_SERVER_H_ +#include <glib-object.h> +#include "value.h" G_BEGIN_DECLS @@ -48,6 +50,10 @@ DBUS_POINTER_ACCOUNT } GaimDBusPointerType; +typedef struct _GaimObject GaimObject; + +/** The main GaimObject */ +GaimObject * gaim_dbus_object; /** * Starts the gaim DBUS server. It is responsible for handling DBUS @@ -55,7 +61,9 @@ * * @return TRUE if successful, FALSE otherwise. */ -gboolean dbus_server_init(void); +gboolean gaim_dbus_init(void); + +gboolean gaim_dbus_connect(GaimObject *object); /** Initializes gaim dbus pointer registration engine. @@ -102,6 +110,94 @@ */ void gaim_dbus_unregister_pointer(gpointer node); +/** + Registers a gaim signal with a #GaimObject. + + @param object The #GaimObject (usually #gaim_dbus_object) + @param name Name of the signal + @param marshaller Marshaller for the signal. + @param num_values The number of parameters. + @param values Array of pointers to #GaimValue objects representing + the types of the parameters. + @result The dbus id of the registered signal. + + This function is intended to be used in signal.h, where it + automatically registers all gaim signals with dbus. For your own + dbus signals, use #gaim_dbus_register. + + The name of the signal, usually in the form "aaa-bbb-ccc", is + converted into DBus standard, "AaaBbbCcc", because "aaa-bbb-ccc" + doesn't work with DBus GObject binding version 0.34 (cvs version is ok). + + The #marshaller can be set to gaim_dbus_invalid_marshaller because + DBus signals are never passed to any local handler. + */ +int gaim_dbus_signal_register_gaim(GaimObject *object, const char *name, + GSignalCMarshaller marshaller, + int num_values, GaimValue **values); + +/** + Emits a dbus signal. + + @param object The #GaimObject (usually #gaim_dbus_object) + @param dbus_id Id of the signal. + @param num_values The number of parameters. + @param values Array of pointers to #GaimValue objects representing + the types of the parameters. + @param vargs A va_list containing the actual parameters. + + This function is intended to be used in signal.h, where it + automatically emits all gaim signals to dbus. For your own dbus + signals, use #gaim_dbus_emit. + */ +void gaim_dbus_signal_emit_gaim(GaimObject *object, int dbus_id, + int num_values, GaimValue **values, va_list vargs); + +/** + A marshaller that emits an "assertion failed" message if called. + + This marshaller is intended to use with signal that will never need to be marshalled. + */ +void gaim_dbus_invalid_marshaller(GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); + +/** + Registers a gaim signal with a #GaimObject. + + @param object The #GaimObject (usually #gaim_dbus_object) + @param name Name of the signal + @param marshaller Marshaller for the signal. + @param num_values The number of parameters. + @param ... List of GType of the parameter types. + + @result The dbus id of the registered signal. + */ +int gaim_dbus_signal_register(GaimObject *object, const char *name, + GSignalCMarshaller marshaller, + int num_values, ...); + +/** + Emits a dbus signal. + + @param object The #GaimObject (usually #gaim_dbus_object) + @param dbus_id Id of the signal. + @param ... Actual parameters. + */ +void gaim_dbus_signal_emit(GaimObject *object, int dbus_id, ...); + +/** + Emits a dbus signal. + + @param object The #GaimObject (usually #gaim_dbus_object) + @param dbus_id Id of the signal. + @param vargs A va_list containing the actual parameters. + */ +void gaim_dbus_signal_emit_valist(GaimObject *object, int dbus_id, va_list args); + G_END_DECLS