eventloop.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 #ifndef _PURPLE_EVENTLOOP_H_
00027 #define _PURPLE_EVENTLOOP_H_
00028 
00029 #include <glib.h>
00030 
00031 #ifdef __cplusplus
00032 extern "C" {
00033 #endif
00034 
00038 typedef enum
00039 {
00040     PURPLE_INPUT_READ  = 1 << 0,  
00041     PURPLE_INPUT_WRITE = 1 << 1   
00043 } PurpleInputCondition;
00044 
00050 typedef void (*PurpleInputFunction)(gpointer, gint, PurpleInputCondition);
00051 
00053 typedef struct _PurpleEventLoopUiOps PurpleEventLoopUiOps;
00054 
00060 struct _PurpleEventLoopUiOps
00061 {
00085     guint (*timeout_add)(guint interval, GSourceFunc function, gpointer data);
00086 
00095     gboolean (*timeout_remove)(guint handle);
00096 
00112     guint (*input_add)(int fd, PurpleInputCondition cond,
00113                        PurpleInputFunction func, gpointer user_data);
00114 
00121     gboolean (*input_remove)(guint handle);
00122     
00123     
00134     int (*input_get_error)(int fd, int *error);
00135 
00150     guint (*timeout_add_seconds)(guint interval, GSourceFunc function,
00151                                  gpointer data);
00152 
00153     void (*_purple_reserved2)(void);
00154     void (*_purple_reserved3)(void);
00155     void (*_purple_reserved4)(void);
00156 };
00157 
00158 /**************************************************************************/
00160 /**************************************************************************/
00178 guint purple_timeout_add(guint interval, GSourceFunc function, gpointer data);
00179 
00198 guint purple_timeout_add_seconds(guint interval, GSourceFunc function, gpointer data);
00199 
00207 gboolean purple_timeout_remove(guint handle);
00208 
00220 guint purple_input_add(int fd, PurpleInputCondition cond,
00221                        PurpleInputFunction func, gpointer user_data);
00222 
00229 gboolean purple_input_remove(guint handle);
00230 
00245 int
00246 purple_input_get_error(int fd, int *error);
00247 
00248 
00252 /**************************************************************************/
00254 /**************************************************************************/
00261 void purple_eventloop_set_ui_ops(PurpleEventLoopUiOps *ops);
00262 
00268 PurpleEventLoopUiOps *purple_eventloop_get_ui_ops(void);
00269 
00272 #ifdef __cplusplus
00273 }
00274 #endif
00275 
00276 #endif /* _PURPLE_EVENTLOOP_H_ */