summaryrefslogtreecommitdiff
path: root/navit/event_glib.c
diff options
context:
space:
mode:
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2008-10-24 20:51:37 +0000
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2008-10-24 20:51:37 +0000
commit37fbca67790882c1f7377a0fcc71b588725e65fd (patch)
treec7a126b20a4e80e140c539e3e666445eb7c16870 /navit/event_glib.c
parent13895dee0a96fae550019265136c1d67800c97fe (diff)
downloadnavit-37fbca67790882c1f7377a0fcc71b588725e65fd.tar.gz
Fix:Core:Cleanup event watch api
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@1558 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/event_glib.c')
-rw-r--r--navit/event_glib.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/navit/event_glib.c b/navit/event_glib.c
index f7d67c3cf..730d9082a 100644
--- a/navit/event_glib.c
+++ b/navit/event_glib.c
@@ -54,11 +54,23 @@ event_glib_call_watch(GIOChannel * iochan, GIOCondition condition, gpointer t)
}
static struct event_watch *
-event_glib_add_watch(int fd, int w, struct callback *cb)
+event_glib_add_watch(struct file *file, enum event_watch_cond cond, struct callback *cb)
{
struct event_watch *ret=g_new0(struct event_watch, 1);
+ int flags=0,fd=(int)file_get_os_handle(file);
ret->iochan = g_io_channel_unix_new(fd);
- ret->source = g_io_add_watch(ret->iochan, G_IO_IN | G_IO_ERR | G_IO_HUP, event_glib_call_watch, (gpointer)cb);
+ switch (cond) {
+ case event_watch_cond_read:
+ flags=G_IO_IN;
+ break;
+ case event_watch_cond_write:
+ flags=G_IO_OUT;
+ break;
+ case event_watch_cond_except:
+ flags=G_IO_ERR|G_IO_HUP;
+ break;
+ }
+ ret->source = g_io_add_watch(ret->iochan, cond, event_glib_call_watch, (gpointer)cb);
return ret;
}