diff options
author | Søren Sandmann <sandmann@redhat.com> | 2009-08-30 21:50:51 -0400 |
---|---|---|
committer | Søren Sandmann <sandmann@redhat.com> | 2009-08-30 21:50:51 -0400 |
commit | e947945d98e54fbd72c7764418b6556c7df7c7cc (patch) | |
tree | 88854705a9aa8b78a65f130f71ad3b1a5b89031b /maincontext.h |
Diffstat (limited to 'maincontext.h')
-rw-r--r-- | maincontext.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/maincontext.h b/maincontext.h new file mode 100644 index 0000000..32f3af3 --- /dev/null +++ b/maincontext.h @@ -0,0 +1,47 @@ +#include <glib.h> +#include "mainloop.h" + +typedef struct MainContext MainContext; + +MainContext *main_context_new (MainLoop *loop, + gpointer data); +void main_context_free (MainContext *context); + +/* Filedescriptors */ +typedef void (* MainFdTask) (MainContext *context, + int fd, + gpointer data); + +void main_context_add_fd (MainContext *context, + int fd, + gpointer data); +void main_context_remove_fd (MainContext *context, + int fd); +/* Called before the fd is polled */ +void main_context_set_prepare_callback (MainContext *context, + int fd, + MainFdTask func); +/* Called when the fd is writable */ +void main_context_set_write_callback (MainContext *context, + int fd, + MainFdTask func); +/* Called when there is data to be read, if the fd is closed/hungup, or + * if there is an error + */ +void main_context_set_read_callback (MainContext *context, + int fd, + MainFdTask func); + +/* Idle/timeout tasks */ +#if 0 +typedef gboolean (* MainTaskFunc) (gpointer data); + +MainTask *main_context_add_idle (MainContext *context, + MainTaskFunc func, + gpointer data); +MainTask *main_context_add_timeout (MainContext *context, + int millisecs, + MainTaskFunc func, + gpointer data); +void main_task_remove (MainTask *task); +#endif |