dbus-server.h

Go to the documentation of this file.
00001 
00006 /* purple
00007  *
00008  * Purple is the legal property of its developers, whose names are too numerous
00009  * to list here.  Please refer to the COPYRIGHT file distributed with this
00010  * source distribution.
00011  *
00012  * This program is free software; you can redistribute it and/or modify
00013  * it under the terms of the GNU General Public License as published by
00014  * the Free Software Foundation; either version 2 of the License, or
00015  * (at your option) any later version.
00016  *
00017  * This program is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  * GNU General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU General Public License
00023  * along with this program; if not, write to the Free Software
00024  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
00025  *
00026  * @see @ref dbus-server-signals
00027  */
00028 
00029 #ifndef _PURPLE_DBUS_SERVER_H_
00030 #define _PURPLE_DBUS_SERVER_H_
00031 
00032 #include "value.h"
00033 
00034 
00035 G_BEGIN_DECLS
00036 
00049 typedef struct _PurpleDBusType PurpleDBusType;
00050 
00051 struct _PurpleDBusType {
00052     PurpleDBusType *parent;
00053 };
00054 
00055 /* By convention, the PurpleDBusType variable representing each structure
00056    PurpleSomeStructure has the name PURPLE_DBUS_TYPE_PurpleSomeStructure.
00057    The following macros facilitate defining such variables
00058 
00059    #PURPLE_DBUS_DECLARE_TYPE declares an extern variable representing a
00060    given type, for use in header files.
00061 
00062    #PURPLE_DBUS_DEFINE_TYPE defines a variable representing a given
00063    type, use in .c files.  It defines a new type without a parent; for
00064    types with a parent use #PURPLE_DBUS_DEFINE_INHERITING_TYPE.
00065   */
00066 
00067 #define PURPLE_DBUS_TYPE(type) (&PURPLE_DBUS_TYPE_##type)
00068 
00069 
00070 #define PURPLE_DBUS_DECLARE_TYPE(type) \
00071     extern PurpleDBusType PURPLE_DBUS_TYPE_##type;
00072 
00073 #define PURPLE_DBUS_DEFINE_TYPE(type) \
00074     PurpleDBusType PURPLE_DBUS_TYPE_##type = { NULL };
00075 
00076 #define PURPLE_DBUS_DEFINE_INHERITING_TYPE(type, parent) \
00077     PurpleDBusType PURPLE_DBUS_TYPE_##type = { PURPLE_DBUS_TYPE(parent) };
00078 
00079 #define PURPLE_DBUS_RETURN_FALSE_IF_DISABLED(plugin) \
00080     if (purple_dbus_get_init_error() != NULL) \
00081     { \
00082         gchar *title; \
00083         title = g_strdup_printf("Unable to Load %s Plugin", plugin->info->name); \
00084         purple_notify_error(NULL, title, \
00085                 _("Purple's D-BUS server is not running for the reason listed below"), \
00086                 _(purple_dbus_get_init_error())); \
00087         g_free(title); \
00088         return FALSE; \
00089     }
00090 
00118 void purple_dbus_init_ids(void);
00119 
00126 void purple_dbus_register_pointer(gpointer node, PurpleDBusType *type);
00127 
00134 void purple_dbus_unregister_pointer(gpointer node);
00135 
00136 
00137 
00147 void purple_dbus_signal_emit_purple(const char *name, int num_values,
00148                 PurpleValue **values, va_list vargs);
00149 
00164 const char *purple_dbus_get_init_error(void);
00165 
00171 void *purple_dbus_get_handle(void);
00172 
00178 gboolean purple_dbus_is_owner(void);
00179 
00184 void purple_dbus_init(void);
00185 
00189 void purple_dbus_uninit(void);
00190 
00201 #define DBUS_EXPORT
00202 
00203 /*
00204    Here we include the list of #PURPLE_DBUS_DECLARE_TYPE statements for
00205    all structs defined in purple.  This file has been generated by the
00206    #dbus-analize-types.py script.
00207 */
00208 
00209 #include "dbus-types.h"
00210 
00211 G_END_DECLS
00212 
00213 #endif  /* _PURPLE_DBUS_SERVER_H_ */