590a49e2bbb2624cf4c7c27daf5827ddd836b559
[python-purple] / libpurple / eventloop.pxd
1 #
2 #  Copyright (c) 2008 INdT - Instituto Nokia de Tecnologia
3 #
4 #  This file is part of python-purple.
5 #
6 #  python-purple is free software: you can redistribute it and/or modify
7 #  it under the terms of the GNU General Public License as published by
8 #  the Free Software Foundation, either version 3 of the License, or
9 #  (at your option) any later version.
10 #
11 #  python-purple is distributed in the hope that it will be useful,
12 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 #  GNU General Public License for more details.
15 #
16 #  You should have received a copy of the GNU General Public License
17 #  along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 #
19
20 cimport glib
21
22 cdef extern from "libpurple/eventloop.h":
23     ctypedef enum PurpleInputCondition:
24         PURPLE_INPUT_READ
25         PURPLE_INPUT_WRITE
26
27     ctypedef void (*PurpleInputFunction) (glib.gpointer, glib.gint, \
28             PurpleInputCondition)
29
30     ctypedef struct PurpleEventLoopUiOps:
31         glib.guint (*timeout_add) (glib.guint interval, \
32                 glib.GSourceFunc function, glib.gpointer data)
33         glib.gboolean (*timeout_remove) (glib.guint handle)
34         glib.guint (*input_add) (int fd, PurpleInputCondition cond, \
35                 PurpleInputFunction func, glib.gpointer user_data)
36         glib.gboolean (*input_remove) (glib.guint handle)
37         int (*input_get_error) (int fd, int *error)
38         glib.guint (*timeout_add_seconds) (glib.guint interval, \
39                 glib.GSourceFunc function, glib.gpointer data)
40
41     # Event Loop API
42     glib.guint purple_timeout_add(glib.guint interval, \
43             glib.GSourceFunc function, glib.gpointer data)
44     glib.guint purple_timeout_add_seconds(glib.guint interval, \
45             glib.GSourceFunc function, glib.gpointer data)
46     glib.gboolean purple_timeout_remove(glib.guint handle)
47     glib.guint purple_input_add(int fd, PurpleInputCondition cond, \
48             PurpleInputFunction func, glib.gpointer user_data)
49     glib.gboolean purple_input_remove(glib.guint handle)
50     int purple_input_get_error(int fd, int *error)
51
52     # UI Registration Functions
53     void purple_eventloop_set_ui_ops(PurpleEventLoopUiOps *ops)
54     PurpleEventLoopUiOps *purple_eventloop_get_ui_ops()