- fd = IceConnectionNumber(conn);
- obt_main_loop_fd_add(ob_main_loop, fd, ice_handler, conn, NULL);
- } else {
- obt_main_loop_fd_remove(ob_main_loop, fd);
- fd = -1;
+ GIOChannel *ch;
+
+ ch = g_io_channel_unix_new(IceConnectionNumber(conn));
+ id = g_io_add_watch(ch, G_IO_IN, ice_handler, conn);
+ g_io_channel_unref(ch);
+ } else if (id) {
+ g_source_remove(id);
+ id = 0;