diff -ru3 /home/src/gnomecvs/gimp/app/batch.c ./app/batch.c
--- /home/src/gnomecvs/gimp/app/batch.c	Thu Oct 15 07:54:16 1998
+++ ./app/batch.c	Tue Oct 27 13:39:32 1998
@@ -14,7 +14,7 @@
 
 static void batch_run_cmd  (char              *cmd);
 static void batch_read     (gpointer           data,
-			    gint               source,
+			    GIOChannel        *source,
 			    GdkInputCondition  condition);
 
 
@@ -43,8 +43,9 @@
 	{
 	  if (!read_from_stdin)
 	    {
+	      GIOChannel *input = g_iochannel_new (STDIN_FILENO);
 	      g_print (_("reading batch commands from stdin\n"));
-	      gdk_input_add (STDIN_FILENO, GDK_INPUT_READ, batch_read, NULL);
+	      gdk_input_add (input, GDK_INPUT_READ, batch_read, NULL);
 	      read_from_stdin = TRUE;
 	    }
 	}
@@ -101,7 +102,7 @@
 
 static void
 batch_read (gpointer          data,
-	    gint              source,
+	    GIOChannel       *source,
 	    GdkInputCondition condition)
 {
   static GString *string;
@@ -111,7 +112,7 @@
   if (condition & GDK_INPUT_READ)
     {
       do {
-	nread = read (source, &buf, sizeof (char) * 31);
+	nread = read (source->fd, &buf, sizeof (char) * 31);
       } while ((nread == -1) && ((errno == EAGAIN) || (errno == EINTR)));
 
       if ((nread == 0) && (!string || (string->len == 0)))
diff -ru3 /home/src/gnomecvs/gimp/app/plug_in.c ./app/plug_in.c
--- /home/src/gnomecvs/gimp/app/plug_in.c	Sat Oct 24 23:21:30 1998
+++ ./app/plug_in.c	Tue Oct 27 15:20:26 1998
@@ -80,14 +80,14 @@
 };
 
 
-static int  plug_in_write                 (int                fd,
+static int  plug_in_write                 (GIOChannel        *channel,
 					   guint8            *buf,
 				           gulong             count);
-static int  plug_in_flush                 (int                fd);
+static int  plug_in_flush                 (GIOChannel        *channel);
 static void plug_in_push                  (PlugIn            *plug_in);
 static void plug_in_pop                   (void);
 static void plug_in_recv_message          (gpointer           data,
-				           gint               id,
+				           GIOChannel        *channel,
 				           GdkInputCondition  cond);
 static void plug_in_handle_message        (WireMessage       *msg);
 static void plug_in_handle_quit           (void);
@@ -146,8 +146,8 @@
 
 static GSList *plug_in_stack = NULL;
 static PlugIn *current_plug_in = NULL;
-static int current_readfd = 0;
-static int current_writefd = 0;
+static GIOChannel *current_readchannel = NULL;
+static GIOChannel *current_writechannel = NULL;
 static int current_write_buffer_index = 0;
 static char *current_write_buffer = NULL;
 static Argument *current_return_vals = NULL;
@@ -810,10 +810,10 @@
   plug_in->args[4] = NULL;
   plug_in->args[5] = NULL;
   plug_in->args[6] = NULL;
-  plug_in->my_read = 0;
-  plug_in->my_write = 0;
-  plug_in->his_read = 0;
-  plug_in->his_write = 0;
+  plug_in->my_read = NULL;
+  plug_in->my_write = NULL;
+  plug_in->his_read = NULL;
+  plug_in->his_write = NULL;
   plug_in->input_id = 0;
   plug_in->write_buffer_index = 0;
   plug_in->temp_proc_defs = NULL;
@@ -886,15 +886,15 @@
 	  return 0;
 	}
 
-      plug_in->my_read = my_read[0];
-      plug_in->my_write = my_write[1];
-      plug_in->his_read = my_write[0];
-      plug_in->his_write = my_read[1];
+      plug_in->my_read = g_iochannel_new (my_read[0]);
+      plug_in->my_write = g_iochannel_new (my_write[1]);
+      plug_in->his_read = g_iochannel_new (my_write[0]);
+      plug_in->his_write = g_iochannel_new (my_read[1]);
 
       /* Remember the file descriptors for the pipes.
        */
-      sprintf (plug_in->args[2], "%d", plug_in->his_read);
-      sprintf (plug_in->args[3], "%d", plug_in->his_write);
+      sprintf (plug_in->args[2], "%d", plug_in->his_read->fd);
+      sprintf (plug_in->args[3], "%d", plug_in->his_write->fd);
 
       /* Set the rest of the command line arguments.
        */
@@ -919,8 +919,8 @@
 
       if (plug_in->pid == 0)
 	{
-	  close(plug_in->my_read);
-	  close(plug_in->my_write);
+	  g_iochannel_close_and_free (plug_in->my_read);
+	  g_iochannel_close_and_free (plug_in->my_write);
           /* Execute the filter. The "_exit" call should never
            *  be reached, unless some strange error condition
            *  exists.
@@ -935,8 +935,10 @@
           return 0;
 	}
 
-      close(plug_in->his_read);  plug_in->his_read  = -1;
-      close(plug_in->his_write); plug_in->his_write = -1;
+      g_iochannel_close_and_free (plug_in->his_read);
+      plug_in->his_read  = NULL;
+      g_iochannel_close_and_free (plug_in->his_write);
+      plug_in->his_write = NULL;
 
       if (!plug_in->synchronous)
 	{
@@ -971,7 +973,7 @@
       if (kill_it && plug_in->pid)
 	{
 	  plug_in_push (plug_in);
-	  gp_quit_write (current_writefd);
+	  gp_quit_write (current_writechannel);
 	  plug_in_pop ();
 
 	  /*  give the plug-in some time (10 ms)  */
@@ -998,14 +1000,14 @@
 
       /* Close the pipes.
        */
-      if (plug_in->my_read)
-        close (plug_in->my_read);
-      if (plug_in->my_write)
-        close (plug_in->my_write);
-      if (plug_in->his_read)
-        close (plug_in->his_read);
-      if (plug_in->his_write)
-        close (plug_in->his_write);
+      if (plug_in->my_read != NULL)
+        g_iochannel_close_and_free (plug_in->my_read);
+      if (plug_in->my_write != NULL)
+        g_iochannel_close_and_free (plug_in->my_write);
+      if (plug_in->his_read != NULL)
+        g_iochannel_close_and_free (plug_in->his_read);
+      if (plug_in->his_write != NULL)
+        g_iochannel_close_and_free (plug_in->his_write);
 
       wire_clear_error();
 
@@ -1156,9 +1158,9 @@
 	  proc_run.nparams = argc;
 	  proc_run.params = plug_in_args_to_params (args, argc, FALSE);
 
-	  if (!gp_config_write (current_writefd, &config) ||
-	      !gp_proc_run_write (current_writefd, &proc_run) ||
-	      !wire_flush (current_writefd))
+	  if (!gp_config_write (current_writechannel, &config) ||
+	      !gp_proc_run_write (current_writechannel, &proc_run) ||
+	      !wire_flush (current_writechannel))
 	    {
 	      return_vals = procedural_db_return_args (proc_rec, FALSE);
 	      goto done;
@@ -1275,7 +1277,7 @@
 
 static void
 plug_in_recv_message (gpointer          data,
-		      gint              id,
+		      GIOChannel       *channel,
 		      GdkInputCondition cond)
 {
   WireMessage msg;
@@ -1283,7 +1285,7 @@
   plug_in_push ((PlugIn*) data);
 
   memset (&msg, 0, sizeof (WireMessage));
-  if (!wire_read_msg (current_readfd, &msg))
+  if (!wire_read_msg (current_readchannel, &msg))
     plug_in_close (current_plug_in, TRUE);
   else 
     {
@@ -1373,14 +1375,14 @@
       tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE;
       tile_data.data = NULL;
 
-      if (!gp_tile_data_write (current_writefd, &tile_data))
+      if (!gp_tile_data_write (current_writechannel, &tile_data))
 	{
 	  g_message (_("plug_in_handle_tile_req: ERROR"));
 	  plug_in_close (current_plug_in, TRUE);
 	  return;
 	}
 
-      if (!wire_read_msg (current_readfd, &msg))
+      if (!wire_read_msg (current_readchannel, &msg))
 	{
 	  g_message (_("plug_in_handle_tile_req: ERROR"));
 	  plug_in_close (current_plug_in, TRUE);
@@ -1424,7 +1426,7 @@
       tile_release (tile, TRUE);
 
       wire_destroy (&msg);
-      if (!gp_tile_ack_write (current_writefd))
+      if (!gp_tile_ack_write (current_writechannel))
 	{
 	  g_message (_("plug_in_handle_tile_req: ERROR"));
 	  plug_in_close (current_plug_in, TRUE);
@@ -1466,7 +1468,7 @@
       else
 	tile_data.data = tile_data_pointer (tile, 0, 0);
 
-      if (!gp_tile_data_write (current_writefd, &tile_data))
+      if (!gp_tile_data_write (current_writechannel, &tile_data))
 	{
 	  g_message (_("plug_in_handle_tile_req: ERROR"));
 	  plug_in_close (current_plug_in, TRUE);
@@ -1475,7 +1477,7 @@
 
       tile_release (tile, FALSE);
 
-      if (!wire_read_msg (current_readfd, &msg))
+      if (!wire_read_msg (current_readchannel, &msg))
 	{
 	  g_message (_("plug_in_handle_tile_req: ERROR"));
 	  plug_in_close (current_plug_in, TRUE);
@@ -1530,7 +1532,7 @@
 	  proc_return.params = plug_in_args_to_params (return_vals, 1, FALSE);
 	}
 
-      if (!gp_proc_return_write (current_writefd, &proc_return))
+      if (!gp_proc_return_write (current_writechannel, &proc_return))
 	{
 	  g_message (_("plug_in_handle_proc_run: ERROR"));
 	  plug_in_close (current_plug_in, TRUE);
@@ -1574,7 +1576,7 @@
 	  if (strcmp (blocked->proc_name, proc_return->name) == 0)
 	    {
 	      plug_in_push (blocked->plug_in);
-	      if (!gp_proc_return_write (current_writefd, proc_return))
+	      if (!gp_proc_return_write (current_writechannel, proc_return))
 		{
 		  g_message (_("plug_in_handle_proc_run: ERROR"));
 		  plug_in_close (current_plug_in, TRUE);
@@ -1834,9 +1836,9 @@
 }
 
 static int
-plug_in_write (int     fd,
-	       guint8 *buf,
-	       gulong  count)
+plug_in_write (GIOChannel *channel,
+	       guint8	   *buf,
+	       gulong	   count)
 {
   gulong bytes;
 
@@ -1847,7 +1849,7 @@
 	  bytes = WRITE_BUFFER_SIZE - current_write_buffer_index;
 	  memcpy (&current_write_buffer[current_write_buffer_index], buf, bytes);
 	  current_write_buffer_index += bytes;
-	  if (!wire_flush (fd))
+	  if (!wire_flush (channel))
 	    return FALSE;
 	}
       else
@@ -1865,7 +1867,7 @@
 }
 
 static int
-plug_in_flush (int fd)
+plug_in_flush (GIOChannel *channel)
 {
   int count;
   int bytes;
@@ -1876,7 +1878,7 @@
       while (count != current_write_buffer_index)
         {
 	  do {
-	    bytes = write (fd, &current_write_buffer[count],
+	    bytes = write (channel->fd, &current_write_buffer[count],
 			   (current_write_buffer_index - count));
 	  } while ((bytes == -1) && (errno == EAGAIN));
 
@@ -1900,15 +1902,15 @@
       current_plug_in = plug_in;
       plug_in_stack = g_slist_prepend (plug_in_stack, current_plug_in);
 
-      current_readfd = current_plug_in->my_read;
-      current_writefd = current_plug_in->my_write;
+      current_readchannel = current_plug_in->my_read;
+      current_writechannel = current_plug_in->my_write;
       current_write_buffer_index = current_plug_in->write_buffer_index;
       current_write_buffer = current_plug_in->write_buffer;
     }
   else
     {
-      current_readfd = 0;
-      current_writefd = 0;
+      current_readchannel = NULL;
+      current_writechannel = NULL;
       current_write_buffer_index = 0;
       current_write_buffer = NULL;
     }
@@ -1932,16 +1934,16 @@
   if (plug_in_stack)
     {
       current_plug_in = plug_in_stack->data;
-      current_readfd = current_plug_in->my_read;
-      current_writefd = current_plug_in->my_write;
+      current_readchannel = current_plug_in->my_read;
+      current_writechannel = current_plug_in->my_write;
       current_write_buffer_index = current_plug_in->write_buffer_index;
       current_write_buffer = current_plug_in->write_buffer;
     }
   else
     {
       current_plug_in = NULL;
-      current_readfd = 0;
-      current_writefd = 0;
+      current_readchannel = NULL;
+      current_writechannel = NULL;
       current_write_buffer_index = 0;
       current_write_buffer = NULL;
     }
@@ -2130,7 +2132,7 @@
 
 	  while (plug_in->open)
 	    {
-	      if (!wire_read_msg (current_readfd, &msg))
+	      if (!wire_read_msg (current_readchannel, &msg))
 		plug_in_close (current_plug_in, TRUE);
 	      else 
 		{
@@ -2474,8 +2476,8 @@
       proc_run.nparams = argc;
       proc_run.params = plug_in_args_to_params (args, argc, FALSE);
 
-      if (!gp_temp_proc_run_write (current_writefd, &proc_run) ||
-	  !wire_flush (current_writefd))
+      if (!gp_temp_proc_run_write (current_writechannel, &proc_run) ||
+	  !wire_flush (current_writechannel))
 	{
 	  return_vals = procedural_db_return_args (proc_rec, FALSE);
 	  goto done;
diff -ru3 /home/src/gnomecvs/gimp/app/plug_in.h ./app/plug_in.h
--- /home/src/gnomecvs/gimp/app/plug_in.h	Thu Oct 22 08:35:09 1998
+++ ./app/plug_in.h	Tue Oct 27 14:47:13 1998
@@ -48,8 +48,8 @@
   pid_t pid;                             /* Plug-ins process id */
   char *args[7];                         /* Plug-ins command line arguments */
 
-  int my_read, my_write;                 /* Apps read and write file descriptors */
-  int his_read, his_write;               /* Plug-ins read and write file descriptors */
+  GIOChannel *my_read, *my_write;        /* App's read and write channels */
+  GIOChannel *his_read, *his_write;      /* Plug-in's read and write channels */
 
   guint32 input_id;                      /* Id of input proc */
 
Only in /home/src/gnomecvs/gimp: data
Only in /home/src/gnomecvs/gimp: docs
diff -ru3 /home/src/gnomecvs/gimp/libgimp/gimp.c ./libgimp/gimp.c
--- /home/src/gnomecvs/gimp/libgimp/gimp.c	Wed Oct 14 12:57:15 1998
+++ ./libgimp/gimp.c	Tue Oct 27 13:55:50 1998
@@ -55,8 +55,8 @@
 
 
 static RETSIGTYPE gimp_signal        (int signum);
-static int        gimp_write         (int fd, guint8 *buf, gulong count);
-static int        gimp_flush         (int fd);
+static int        gimp_write         (GIOChannel *channel, guint8 *buf, gulong count);
+static int        gimp_flush         (GIOChannel *channel);
 static void       gimp_loop          (void);
 static void       gimp_config        (GPConfig *config);
 static void       gimp_proc_run      (GPProcRun *proc_run);
@@ -65,8 +65,9 @@
 static void       gimp_process_message(WireMessage *msg);
 
 
-int _readfd = 0;
-int _writefd = 0;
+GIOChannel *_readchannel = NULL;
+GIOChannel *_writechannel = NULL;
+
 int _shm_ID = -1;
 guchar *_shm_addr = NULL;
 
@@ -110,8 +111,8 @@
   signal (SIGTERM, gimp_signal);
   signal (SIGFPE, gimp_signal);
 
-  _readfd = atoi (argv[2]);
-  _writefd = atoi (argv[3]);
+  _readchannel = g_iochannel_new (atoi (argv[2]));
+  _writechannel = g_iochannel_new (atoi (argv[3]));
 
   gp_init ();
   wire_set_writer (gimp_write);
@@ -144,7 +145,7 @@
     shmdt ((char*) _shm_addr);
 #endif
 
-  gp_quit_write (_writefd);
+  gp_quit_write (_writechannel);
   exit (0);
 }
 
@@ -461,7 +462,7 @@
   proc_install.params = (GPParamDef*) params;
   proc_install.return_vals = (GPParamDef*) return_vals;
 
-  if (!gp_proc_install_write (_writefd, &proc_install))
+  if (!gp_proc_install_write (_writechannel, &proc_install))
     gimp_quit ();
 }
 
@@ -496,7 +497,7 @@
 
   proc_uninstall.name = name;
 
-  if (!gp_proc_uninstall_write (_writefd, &proc_uninstall))
+  if (!gp_proc_uninstall_write (_writechannel, &proc_uninstall))
     gimp_quit ();
   g_hash_table_remove (temp_proc_ht, (gpointer) name);
 }
@@ -731,7 +732,7 @@
 
   va_end (args);
 
-  if (!gp_proc_run_write (_writefd, &proc_run))
+  if (!gp_proc_run_write (_writechannel, &proc_run))
     gimp_quit ();
 
   gimp_read_expect_msg(&msg,GP_PROC_RETURN);
@@ -764,7 +765,7 @@
 {
   while(1)
     {
-      if (!wire_read_msg (_readfd, msg))
+      if (!wire_read_msg (_readchannel, msg))
 	gimp_quit ();
       
       if (msg->type != type)
@@ -798,7 +799,7 @@
   proc_run.nparams = nparams;
   proc_run.params = (GPParam *) params;
 
-  if (!gp_proc_run_write (_writefd, &proc_run))
+  if (!gp_proc_run_write (_writechannel, &proc_run))
     gimp_quit ();
 
   gimp_read_expect_msg(&msg,GP_PROC_RETURN);
@@ -912,7 +913,7 @@
   WireMessage msg;
 
   /* Run a temp function */
-  if (!wire_read_msg (_readfd, &msg))
+  if (!wire_read_msg (_readchannel, &msg))
     gimp_quit ();
 
   gimp_process_message(&msg);
@@ -938,7 +939,7 @@
     tvp = NULL;
 
   FD_ZERO (&readfds);
-  FD_SET (_readfd, &readfds);
+  FD_SET (_readchannel->fd, &readfds);
 
   if ((select_val = select (FD_SETSIZE, &readfds, NULL, NULL, tvp)) > 0)
     {
@@ -955,7 +956,7 @@
 gimp_extension_ack ()
 {
   /*  Send an extension initialization acknowledgement  */
-  if (! gp_extension_ack_write (_writefd))
+  if (! gp_extension_ack_write (_writechannel))
     gimp_quit ();
 }
 
@@ -992,7 +993,7 @@
 }
 
 static int
-gimp_write (int fd, guint8 *buf, gulong count)
+gimp_write (GIOChannel *channel, guint8 *buf, gulong count)
 {
   gulong bytes;
 
@@ -1003,7 +1004,7 @@
 	  bytes = WRITE_BUFFER_SIZE - write_buffer_index;
 	  memcpy (&write_buffer[write_buffer_index], buf, bytes);
 	  write_buffer_index += bytes;
-	  if (!wire_flush (fd))
+	  if (!wire_flush (channel))
 	    return FALSE;
 	}
       else
@@ -1021,7 +1022,7 @@
 }
 
 static int
-gimp_flush (int fd)
+gimp_flush (GIOChannel *channel)
 {
   int count;
   int bytes;
@@ -1032,7 +1033,7 @@
       while (count != write_buffer_index)
         {
 	  do {
-	    bytes = write (fd, &write_buffer[count], (write_buffer_index - count));
+	    bytes = write (channel->fd, &write_buffer[count], (write_buffer_index - count));
 	  } while ((bytes == -1) && (errno == EAGAIN));
 
 	  if (bytes == -1)
@@ -1054,7 +1055,7 @@
 
   while (1)
     {
-      if (!wire_read_msg (_readfd, &msg))
+      if (!wire_read_msg (_readchannel, &msg))
 	gimp_quit ();
 
       switch (msg.type)
@@ -1153,7 +1154,7 @@
       proc_return.nparams = nreturn_vals;
       proc_return.params = (GPParam*) return_vals;
 
-      if (!gp_proc_return_write (_writefd, &proc_return))
+      if (!gp_proc_return_write (_writechannel, &proc_return))
 	gimp_quit ();
     }
 }
@@ -1180,7 +1181,7 @@
 /*       proc_return.nparams = nreturn_vals; */
 /*       proc_return.params = (GPParam*) return_vals; */
 
-/*       if (!gp_temp_proc_return_write (_writefd, &proc_return)) */
+/*       if (!gp_temp_proc_return_write (_writechannel, &proc_return)) */
 /* 	gimp_quit (); */
     }
 }
diff -ru3 /home/src/gnomecvs/gimp/libgimp/gimpmenu.c ./libgimp/gimpmenu.c
--- /home/src/gnomecvs/gimp/libgimp/gimpmenu.c	Wed Oct 21 09:37:04 1998
+++ ./libgimp/gimpmenu.c	Tue Oct 27 14:27:33 1998
@@ -66,7 +66,7 @@
 				      int              *nreturn_vals,
 				      GParam          **return_vals);
 static void    input_callback        (gpointer          data,
-				      gint              source,
+				      GIOChannel       *source,
 				      GdkInputCondition condition);
 static void    gimp_setup_callbacks  (void);
 static gchar*  gen_temp_plugin_name  (void);
@@ -597,7 +597,7 @@
 
 static void
 input_callback (gpointer          data,
-                gint              source,
+                GIOChannel	 *source,
                 GdkInputCondition condition)
 {
   /* We have some data in the wire - read it */
@@ -609,12 +609,12 @@
 gimp_setup_callbacks (void)
 {
   static int first_time = TRUE;
-  extern int _readfd;
+  extern GIOChannel *_readchannel;
   if(first_time)
     {
       /* Tie into the gdk input function */
       /* only once */
-      gdk_input_add(_readfd,GDK_INPUT_READ,input_callback,NULL);
+      gdk_input_add(_readchannel,GDK_INPUT_READ,input_callback,NULL);
       first_time = FALSE;
     }
 }
diff -ru3 /home/src/gnomecvs/gimp/libgimp/gimpprotocol.c ./libgimp/gimpprotocol.c
--- /home/src/gnomecvs/gimp/libgimp/gimpprotocol.c	Wed Oct 14 12:57:15 1998
+++ ./libgimp/gimpprotocol.c	Tue Oct 27 14:02:43 1998
@@ -24,44 +24,44 @@
 #include <stdio.h>
 
 
-static void _gp_quit_read                (int fd, WireMessage *msg);
-static void _gp_quit_write               (int fd, WireMessage *msg);
+static void _gp_quit_read                (GIOChannel *channel, WireMessage *msg);
+static void _gp_quit_write               (GIOChannel *channel, WireMessage *msg);
 static void _gp_quit_destroy             (WireMessage *msg);
-static void _gp_config_read              (int fd, WireMessage *msg);
-static void _gp_config_write             (int fd, WireMessage *msg);
+static void _gp_config_read              (GIOChannel *channel, WireMessage *msg);
+static void _gp_config_write             (GIOChannel *channel, WireMessage *msg);
 static void _gp_config_destroy           (WireMessage *msg);
-static void _gp_tile_req_read            (int fd, WireMessage *msg);
-static void _gp_tile_req_write           (int fd, WireMessage *msg);
+static void _gp_tile_req_read            (GIOChannel *channel, WireMessage *msg);
+static void _gp_tile_req_write           (GIOChannel *channel, WireMessage *msg);
 static void _gp_tile_req_destroy         (WireMessage *msg);
-static void _gp_tile_ack_read            (int fd, WireMessage *msg);
-static void _gp_tile_ack_write           (int fd, WireMessage *msg);
+static void _gp_tile_ack_read            (GIOChannel *channel, WireMessage *msg);
+static void _gp_tile_ack_write           (GIOChannel *channel, WireMessage *msg);
 static void _gp_tile_ack_destroy         (WireMessage *msg);
-static void _gp_tile_data_read           (int fd, WireMessage *msg);
-static void _gp_tile_data_write          (int fd, WireMessage *msg);
+static void _gp_tile_data_read           (GIOChannel *channel, WireMessage *msg);
+static void _gp_tile_data_write          (GIOChannel *channel, WireMessage *msg);
 static void _gp_tile_data_destroy        (WireMessage *msg);
-static void _gp_proc_run_read            (int fd, WireMessage *msg);
-static void _gp_proc_run_write           (int fd, WireMessage *msg);
+static void _gp_proc_run_read            (GIOChannel *channel, WireMessage *msg);
+static void _gp_proc_run_write           (GIOChannel *channel, WireMessage *msg);
 static void _gp_proc_run_destroy         (WireMessage *msg);
-static void _gp_proc_return_read         (int fd, WireMessage *msg);
-static void _gp_proc_return_write        (int fd, WireMessage *msg);
+static void _gp_proc_return_read         (GIOChannel *channel, WireMessage *msg);
+static void _gp_proc_return_write        (GIOChannel *channel, WireMessage *msg);
 static void _gp_proc_return_destroy      (WireMessage *msg);
-static void _gp_temp_proc_run_read       (int fd, WireMessage *msg);
-static void _gp_temp_proc_run_write      (int fd, WireMessage *msg);
+static void _gp_temp_proc_run_read       (GIOChannel *channel, WireMessage *msg);
+static void _gp_temp_proc_run_write      (GIOChannel *channel, WireMessage *msg);
 static void _gp_temp_proc_run_destroy    (WireMessage *msg);
-static void _gp_temp_proc_return_read    (int fd, WireMessage *msg);
-static void _gp_temp_proc_return_write   (int fd, WireMessage *msg);
+static void _gp_temp_proc_return_read    (GIOChannel *channel, WireMessage *msg);
+static void _gp_temp_proc_return_write   (GIOChannel *channel, WireMessage *msg);
 static void _gp_temp_proc_return_destroy (WireMessage *msg);
-static void _gp_proc_install_read        (int fd, WireMessage *msg);
-static void _gp_proc_install_write       (int fd, WireMessage *msg);
+static void _gp_proc_install_read        (GIOChannel *channel, WireMessage *msg);
+static void _gp_proc_install_write       (GIOChannel *channel, WireMessage *msg);
 static void _gp_proc_install_destroy     (WireMessage *msg);
-static void _gp_proc_uninstall_read      (int fd, WireMessage *msg);
-static void _gp_proc_uninstall_write     (int fd, WireMessage *msg);
+static void _gp_proc_uninstall_read      (GIOChannel *channel, WireMessage *msg);
+static void _gp_proc_uninstall_write     (GIOChannel *channel, WireMessage *msg);
 static void _gp_proc_uninstall_destroy   (WireMessage *msg);
-static void _gp_extension_ack_read       (int fd, WireMessage *msg);
-static void _gp_extension_ack_write      (int fd, WireMessage *msg);
+static void _gp_extension_ack_read       (GIOChannel *channel, WireMessage *msg);
+static void _gp_extension_ack_write      (GIOChannel *channel, WireMessage *msg);
 static void _gp_extension_ack_destroy    (WireMessage *msg);
-static void _gp_params_read              (int fd, GPParam **params, guint *nparams);
-static void _gp_params_write             (int fd, GPParam *params, int nparams);
+static void _gp_params_read              (GIOChannel *channel, GPParam **params, guint *nparams);
+static void _gp_params_write             (GIOChannel *channel, GPParam *params, int nparams);
        void _gp_params_destroy           (GPParam *params, int nparams);
 
 
@@ -119,69 +119,69 @@
 }
 
 int
-gp_quit_write (int fd)
+gp_quit_write (GIOChannel *channel)
 {
   WireMessage msg;
 
   msg.type = GP_QUIT;
   msg.data = NULL;
 
-  if (!wire_write_msg (fd, &msg))
+  if (!wire_write_msg (channel, &msg))
     return FALSE;
-  if (!wire_flush (fd))
+  if (!wire_flush (channel))
     return FALSE;
   return TRUE;
 }
 
 int
-gp_config_write (int       fd,
-		 GPConfig *config)
+gp_config_write (GIOChannel *channel,
+		 GPConfig   *config)
 {
   WireMessage msg;
 
   msg.type = GP_CONFIG;
   msg.data = config;
 
-  if (!wire_write_msg (fd, &msg))
+  if (!wire_write_msg (channel, &msg))
     return FALSE;
-  if (!wire_flush (fd))
+  if (!wire_flush (channel))
     return FALSE;
   return TRUE;
 }
 
 int
-gp_tile_req_write (int        fd,
-		   GPTileReq *tile_req)
+gp_tile_req_write (GIOChannel *channel,
+		   GPTileReq  *tile_req)
 {
   WireMessage msg;
 
   msg.type = GP_TILE_REQ;
   msg.data = tile_req;
 
-  if (!wire_write_msg (fd, &msg))
+  if (!wire_write_msg (channel, &msg))
     return FALSE;
-  if (!wire_flush (fd))
+  if (!wire_flush (channel))
     return FALSE;
   return TRUE;
 }
 
 int
-gp_tile_ack_write (int fd)
+gp_tile_ack_write (GIOChannel *channel)
 {
   WireMessage msg;
 
   msg.type = GP_TILE_ACK;
   msg.data = NULL;
 
-  if (!wire_write_msg (fd, &msg))
+  if (!wire_write_msg (channel, &msg))
     return FALSE;
-  if (!wire_flush (fd))
+  if (!wire_flush (channel))
     return FALSE;
   return TRUE;
 }
 
 int
-gp_tile_data_write (int         fd,
+gp_tile_data_write (GIOChannel *channel,
 		    GPTileData *tile_data)
 {
   WireMessage msg;
@@ -189,31 +189,31 @@
   msg.type = GP_TILE_DATA;
   msg.data = tile_data;
 
-  if (!wire_write_msg (fd, &msg))
+  if (!wire_write_msg (channel, &msg))
     return FALSE;
-  if (!wire_flush (fd))
+  if (!wire_flush (channel))
     return FALSE;
   return TRUE;
 }
 
 int
-gp_proc_run_write (int        fd,
-		   GPProcRun *proc_run)
+gp_proc_run_write (GIOChannel *channel,
+		   GPProcRun  *proc_run)
 {
   WireMessage msg;
 
   msg.type = GP_PROC_RUN;
   msg.data = proc_run;
 
-  if (!wire_write_msg (fd, &msg))
+  if (!wire_write_msg (channel, &msg))
     return FALSE;
-  if (!wire_flush (fd))
+  if (!wire_flush (channel))
     return FALSE;
   return TRUE;
 }
 
 int
-gp_proc_return_write (int           fd,
+gp_proc_return_write (GIOChannel   *channel,
 		      GPProcReturn *proc_return)
 {
   WireMessage msg;
@@ -221,31 +221,31 @@
   msg.type = GP_PROC_RETURN;
   msg.data = proc_return;
 
-  if (!wire_write_msg (fd, &msg))
+  if (!wire_write_msg (channel, &msg))
     return FALSE;
-  if (!wire_flush (fd))
+  if (!wire_flush (channel))
     return FALSE;
   return TRUE;
 }
 
 int
-gp_temp_proc_run_write (int        fd,
-			GPProcRun *proc_run)
+gp_temp_proc_run_write (GIOChannel *channel,
+			GPProcRun  *proc_run)
 {
   WireMessage msg;
 
   msg.type = GP_TEMP_PROC_RUN;
   msg.data = proc_run;
 
-  if (!wire_write_msg (fd, &msg))
+  if (!wire_write_msg (channel, &msg))
     return FALSE;
-  if (!wire_flush (fd))
+  if (!wire_flush (channel))
     return FALSE;
   return TRUE;
 }
 
 int
-gp_temp_proc_return_write (int           fd,
+gp_temp_proc_return_write (GIOChannel   *channel,
 			   GPProcReturn *proc_return)
 {
   WireMessage msg;
@@ -253,15 +253,15 @@
   msg.type = GP_TEMP_PROC_RETURN;
   msg.data = proc_return;
 
-  if (!wire_write_msg (fd, &msg))
+  if (!wire_write_msg (channel, &msg))
     return FALSE;
-  if (!wire_flush (fd))
+  if (!wire_flush (channel))
     return FALSE;
   return TRUE;
 }
 
 int
-gp_proc_install_write (int            fd,
+gp_proc_install_write (GIOChannel    *channel,
 		       GPProcInstall *proc_install)
 {
   WireMessage msg;
@@ -269,15 +269,15 @@
   msg.type = GP_PROC_INSTALL;
   msg.data = proc_install;
 
-  if (!wire_write_msg (fd, &msg))
+  if (!wire_write_msg (channel, &msg))
     return FALSE;
-  if (!wire_flush (fd))
+  if (!wire_flush (channel))
     return FALSE;
   return TRUE;
 }
 
 int
-gp_proc_uninstall_write (int              fd,
+gp_proc_uninstall_write (GIOChannel	 *channel,
 			 GPProcUninstall *proc_uninstall)
 {
   WireMessage msg;
@@ -285,36 +285,36 @@
   msg.type = GP_PROC_UNINSTALL;
   msg.data = proc_uninstall;
 
-  if (!wire_write_msg (fd, &msg))
+  if (!wire_write_msg (channel, &msg))
     return FALSE;
-  if (!wire_flush (fd))
+  if (!wire_flush (channel))
     return FALSE;
   return TRUE;
 }
 
 int
-gp_extension_ack_write (int fd)
+gp_extension_ack_write (GIOChannel *channel)
 {
   WireMessage msg;
 
   msg.type = GP_EXTENSION_ACK;
   msg.data = NULL;
 
-  if (!wire_write_msg (fd, &msg))
+  if (!wire_write_msg (channel, &msg))
     return FALSE;
-  if (!wire_flush (fd))
+  if (!wire_flush (channel))
     return FALSE;
   return TRUE;
 }
 
 
 static void
-_gp_quit_read (int fd, WireMessage *msg)
+_gp_quit_read (GIOChannel *channel, WireMessage *msg)
 {
 }
 
 static void
-_gp_quit_write (int fd, WireMessage *msg)
+_gp_quit_write (GIOChannel *channel, WireMessage *msg)
 {
 }
 
@@ -324,52 +324,52 @@
 }
 
 static void
-_gp_config_read (int fd, WireMessage *msg)
+_gp_config_read (GIOChannel *channel, WireMessage *msg)
 {
   GPConfig *config;
 
   config = g_new (GPConfig, 1);
-  if (!wire_read_int32 (fd, &config->version, 1))
+  if (!wire_read_int32 (channel, &config->version, 1))
     return;
-  if (!wire_read_int32 (fd, &config->tile_width, 1))
+  if (!wire_read_int32 (channel, &config->tile_width, 1))
     return;
-  if (!wire_read_int32 (fd, &config->tile_height, 1))
+  if (!wire_read_int32 (channel, &config->tile_height, 1))
     return;
-  if (!wire_read_int32 (fd, (guint32*) &config->shm_ID, 1))
+  if (!wire_read_int32 (channel, (guint32*) &config->shm_ID, 1))
     return;
-  if (!wire_read_double (fd, &config->gamma, 1))
+  if (!wire_read_double (channel, &config->gamma, 1))
     return;
-  if (!wire_read_int8 (fd, (guint8*) &config->install_cmap, 1))
+  if (!wire_read_int8 (channel, (guint8*) &config->install_cmap, 1))
     return;
-  if (!wire_read_int8 (fd, (guint8*) config->color_cube, 3))
+  if (!wire_read_int8 (channel, (guint8*) config->color_cube, 3))
     return;
-  if (!wire_read_int32 (fd, (guint32*) &config->gdisp_ID, 1))
+  if (!wire_read_int32 (channel, (guint32*) &config->gdisp_ID, 1))
     return;
 
   msg->data = config;
 }
 
 static void
-_gp_config_write (int fd, WireMessage *msg)
+_gp_config_write (GIOChannel *channel, WireMessage *msg)
 {
   GPConfig *config;
 
   config = msg->data;
-  if (!wire_write_int32 (fd, &config->version, 1))
+  if (!wire_write_int32 (channel, &config->version, 1))
     return;
-  if (!wire_write_int32 (fd, &config->tile_width, 1))
+  if (!wire_write_int32 (channel, &config->tile_width, 1))
     return;
-  if (!wire_write_int32 (fd, &config->tile_height, 1))
+  if (!wire_write_int32 (channel, &config->tile_height, 1))
     return;
-  if (!wire_write_int32 (fd, (guint32*) &config->shm_ID, 1))
+  if (!wire_write_int32 (channel, (guint32*) &config->shm_ID, 1))
     return;
-  if (!wire_write_double (fd, &config->gamma, 1))
+  if (!wire_write_double (channel, &config->gamma, 1))
     return;
-  if (!wire_write_int8 (fd, (guint8*) &config->install_cmap, 1))
+  if (!wire_write_int8 (channel, (guint8*) &config->install_cmap, 1))
     return;
-  if (!wire_write_int8 (fd, (guint8*) config->color_cube, 3))
+  if (!wire_write_int8 (channel, (guint8*) config->color_cube, 3))
     return;
-  if (!wire_write_int32 (fd, (guint32*) &config->gdisp_ID, 1))
+  if (!wire_write_int32 (channel, (guint32*) &config->gdisp_ID, 1))
     return;
 }
 
@@ -380,32 +380,32 @@
 }
 
 static void
-_gp_tile_req_read (int fd, WireMessage *msg)
+_gp_tile_req_read (GIOChannel *channel, WireMessage *msg)
 {
   GPTileReq *tile_req;
 
   tile_req = g_new (GPTileReq, 1);
-  if (!wire_read_int32 (fd, (guint32*) &tile_req->drawable_ID, 1))
+  if (!wire_read_int32 (channel, (guint32*) &tile_req->drawable_ID, 1))
     return;
-  if (!wire_read_int32 (fd, &tile_req->tile_num, 1))
+  if (!wire_read_int32 (channel, &tile_req->tile_num, 1))
     return;
-  if (!wire_read_int32 (fd, &tile_req->shadow, 1))
+  if (!wire_read_int32 (channel, &tile_req->shadow, 1))
     return;
 
   msg->data = tile_req;
 }
 
 static void
-_gp_tile_req_write (int fd, WireMessage *msg)
+_gp_tile_req_write (GIOChannel *channel, WireMessage *msg)
 {
   GPTileReq *tile_req;
 
   tile_req = msg->data;
-  if (!wire_write_int32 (fd, (guint32*) &tile_req->drawable_ID, 1))
+  if (!wire_write_int32 (channel, (guint32*) &tile_req->drawable_ID, 1))
     return;
-  if (!wire_write_int32 (fd, &tile_req->tile_num, 1))
+  if (!wire_write_int32 (channel, &tile_req->tile_num, 1))
     return;
-  if (!wire_write_int32 (fd, &tile_req->shadow, 1))
+  if (!wire_write_int32 (channel, &tile_req->shadow, 1))
     return;
 }
 
@@ -416,12 +416,12 @@
 }
 
 static void
-_gp_tile_ack_read (int fd, WireMessage *msg)
+_gp_tile_ack_read (GIOChannel *channel, WireMessage *msg)
 {
 }
 
 static void
-_gp_tile_ack_write (int fd, WireMessage *msg)
+_gp_tile_ack_write (GIOChannel *channel, WireMessage *msg)
 {
 }
 
@@ -431,25 +431,25 @@
 }
 
 static void
-_gp_tile_data_read (int fd, WireMessage *msg)
+_gp_tile_data_read (GIOChannel *channel, WireMessage *msg)
 {
   GPTileData *tile_data;
   guint length;
 
   tile_data = g_new (GPTileData, 1);
-  if (!wire_read_int32 (fd, (guint32*) &tile_data->drawable_ID, 1))
+  if (!wire_read_int32 (channel, (guint32*) &tile_data->drawable_ID, 1))
     return;
-  if (!wire_read_int32 (fd, &tile_data->tile_num, 1))
+  if (!wire_read_int32 (channel, &tile_data->tile_num, 1))
     return;
-  if (!wire_read_int32 (fd, &tile_data->shadow, 1))
+  if (!wire_read_int32 (channel, &tile_data->shadow, 1))
     return;
-  if (!wire_read_int32 (fd, &tile_data->bpp, 1))
+  if (!wire_read_int32 (channel, &tile_data->bpp, 1))
     return;
-  if (!wire_read_int32 (fd, &tile_data->width, 1))
+  if (!wire_read_int32 (channel, &tile_data->width, 1))
     return;
-  if (!wire_read_int32 (fd, &tile_data->height, 1))
+  if (!wire_read_int32 (channel, &tile_data->height, 1))
     return;
-  if (!wire_read_int32 (fd, &tile_data->use_shm, 1))
+  if (!wire_read_int32 (channel, &tile_data->use_shm, 1))
     return;
   tile_data->data = NULL;
 
@@ -457,7 +457,7 @@
     {
       length = tile_data->width * tile_data->height * tile_data->bpp;
       tile_data->data = g_new (guchar, length);
-      if (!wire_read_int8 (fd, (guint8*) tile_data->data, length))
+      if (!wire_read_int8 (channel, (guint8*) tile_data->data, length))
 	return;
     }
 
@@ -465,31 +465,31 @@
 }
 
 static void
-_gp_tile_data_write (int fd, WireMessage *msg)
+_gp_tile_data_write (GIOChannel *channel, WireMessage *msg)
 {
   GPTileData *tile_data;
   guint length;
 
   tile_data = msg->data;
-  if (!wire_write_int32 (fd, (guint32*) &tile_data->drawable_ID, 1))
+  if (!wire_write_int32 (channel, (guint32*) &tile_data->drawable_ID, 1))
     return;
-  if (!wire_write_int32 (fd, &tile_data->tile_num, 1))
+  if (!wire_write_int32 (channel, &tile_data->tile_num, 1))
     return;
-  if (!wire_write_int32 (fd, &tile_data->shadow, 1))
+  if (!wire_write_int32 (channel, &tile_data->shadow, 1))
     return;
-  if (!wire_write_int32 (fd, &tile_data->bpp, 1))
+  if (!wire_write_int32 (channel, &tile_data->bpp, 1))
     return;
-  if (!wire_write_int32 (fd, &tile_data->width, 1))
+  if (!wire_write_int32 (channel, &tile_data->width, 1))
     return;
-  if (!wire_write_int32 (fd, &tile_data->height, 1))
+  if (!wire_write_int32 (channel, &tile_data->height, 1))
     return;
-  if (!wire_write_int32 (fd, &tile_data->use_shm, 1))
+  if (!wire_write_int32 (channel, &tile_data->use_shm, 1))
     return;
 
   if (!tile_data->use_shm)
     {
       length = tile_data->width * tile_data->height * tile_data->bpp;
-      if (!wire_write_int8 (fd, (guint8*) tile_data->data, length))
+      if (!wire_write_int8 (channel, (guint8*) tile_data->data, length))
 	return;
     }
 }
@@ -506,31 +506,31 @@
 }
 
 static void
-_gp_proc_run_read (int fd, WireMessage *msg)
+_gp_proc_run_read (GIOChannel *channel, WireMessage *msg)
 {
   GPProcRun *proc_run;
 
   proc_run = g_new (GPProcRun, 1);
-  if (!wire_read_string (fd, &proc_run->name, 1))
+  if (!wire_read_string (channel, &proc_run->name, 1))
     {
       g_free (proc_run);
       return;
     }
-  _gp_params_read (fd, &proc_run->params, (guint*) &proc_run->nparams);
+  _gp_params_read (channel, &proc_run->params, (guint*) &proc_run->nparams);
 
   msg->data = proc_run;
 }
 
 static void
-_gp_proc_run_write (int fd, WireMessage *msg)
+_gp_proc_run_write (GIOChannel *channel, WireMessage *msg)
 {
   GPProcRun *proc_run;
 
   proc_run = msg->data;
 
-  if (!wire_write_string (fd, &proc_run->name, 1))
+  if (!wire_write_string (channel, &proc_run->name, 1))
     return;
-  _gp_params_write (fd, proc_run->params, proc_run->nparams);
+  _gp_params_write (channel, proc_run->params, proc_run->nparams);
 }
 
 static void
@@ -545,28 +545,28 @@
 }
 
 static void
-_gp_proc_return_read (int fd, WireMessage *msg)
+_gp_proc_return_read (GIOChannel *channel, WireMessage *msg)
 {
   GPProcReturn *proc_return;
 
   proc_return = g_new (GPProcReturn, 1);
-  if (!wire_read_string (fd, &proc_return->name, 1))
+  if (!wire_read_string (channel, &proc_return->name, 1))
     return;
-  _gp_params_read (fd, &proc_return->params, (guint*) &proc_return->nparams);
+  _gp_params_read (channel, &proc_return->params, (guint*) &proc_return->nparams);
 
   msg->data = proc_return;
 }
 
 static void
-_gp_proc_return_write (int fd, WireMessage *msg)
+_gp_proc_return_write (GIOChannel *channel, WireMessage *msg)
 {
   GPProcReturn *proc_return;
 
   proc_return = msg->data;
 
-  if (!wire_write_string (fd, &proc_return->name, 1))
+  if (!wire_write_string (channel, &proc_return->name, 1))
     return;
-  _gp_params_write (fd, proc_return->params, proc_return->nparams);
+  _gp_params_write (channel, proc_return->params, proc_return->nparams);
 }
 
 static void
@@ -580,15 +580,15 @@
 }
 
 static void
-_gp_temp_proc_run_read (int fd, WireMessage *msg)
+_gp_temp_proc_run_read (GIOChannel *channel, WireMessage *msg)
 {
-  _gp_proc_run_read (fd, msg);
+  _gp_proc_run_read (channel, msg);
 }
 
 static void
-_gp_temp_proc_run_write (int fd, WireMessage *msg)
+_gp_temp_proc_run_write (GIOChannel *channel, WireMessage *msg)
 {
-  _gp_proc_run_write (fd, msg);
+  _gp_proc_run_write (channel, msg);
 }
 
 static void
@@ -598,15 +598,15 @@
 }
 
 static void
-_gp_temp_proc_return_read (int fd, WireMessage *msg)
+_gp_temp_proc_return_read (GIOChannel *channel, WireMessage *msg)
 {
-  _gp_proc_return_read (fd, msg);
+  _gp_proc_return_read (channel, msg);
 }
 
 static void
-_gp_temp_proc_return_write (int fd, WireMessage *msg)
+_gp_temp_proc_return_write (GIOChannel *channel, WireMessage *msg)
 {
-  _gp_proc_return_write (fd, msg);
+  _gp_proc_return_write (channel, msg);
 }
 
 static void
@@ -616,35 +616,35 @@
 }
 
 static void
-_gp_proc_install_read (int fd, WireMessage *msg)
+_gp_proc_install_read (GIOChannel *channel, WireMessage *msg)
 {
   GPProcInstall *proc_install;
   int i;
 
   proc_install = g_new (GPProcInstall, 1);
 
-  if (!wire_read_string (fd, &proc_install->name, 1))
+  if (!wire_read_string (channel, &proc_install->name, 1))
     return;
-  if (!wire_read_string (fd, &proc_install->blurb, 1))
+  if (!wire_read_string (channel, &proc_install->blurb, 1))
     return;
-  if (!wire_read_string (fd, &proc_install->help, 1))
+  if (!wire_read_string (channel, &proc_install->help, 1))
     return;
-  if (!wire_read_string (fd, &proc_install->author, 1))
+  if (!wire_read_string (channel, &proc_install->author, 1))
     return;
-  if (!wire_read_string (fd, &proc_install->copyright, 1))
+  if (!wire_read_string (channel, &proc_install->copyright, 1))
     return;
-  if (!wire_read_string (fd, &proc_install->date, 1))
+  if (!wire_read_string (channel, &proc_install->date, 1))
     return;
-  if (!wire_read_string (fd, &proc_install->menu_path, 1))
+  if (!wire_read_string (channel, &proc_install->menu_path, 1))
     return;
-  if (!wire_read_string (fd, &proc_install->image_types, 1))
+  if (!wire_read_string (channel, &proc_install->image_types, 1))
     return;
 
-  if (!wire_read_int32 (fd, &proc_install->type, 1))
+  if (!wire_read_int32 (channel, &proc_install->type, 1))
     return;
-  if (!wire_read_int32 (fd, &proc_install->nparams, 1))
+  if (!wire_read_int32 (channel, &proc_install->nparams, 1))
     return;
-  if (!wire_read_int32 (fd, &proc_install->nreturn_vals, 1))
+  if (!wire_read_int32 (channel, &proc_install->nreturn_vals, 1))
     return;
 
   proc_install->params = g_new (GPParamDef, proc_install->nparams);
@@ -652,21 +652,21 @@
 
   for (i = 0; i < proc_install->nparams; i++)
     {
-      if (!wire_read_int32 (fd, (guint32*) &proc_install->params[i].type, 1))
+      if (!wire_read_int32 (channel, (guint32*) &proc_install->params[i].type, 1))
 	return;
-      if (!wire_read_string (fd, &proc_install->params[i].name, 1))
+      if (!wire_read_string (channel, &proc_install->params[i].name, 1))
 	return;
-      if (!wire_read_string (fd, &proc_install->params[i].description, 1))
+      if (!wire_read_string (channel, &proc_install->params[i].description, 1))
 	return;
     }
 
   for (i = 0; i < proc_install->nreturn_vals; i++)
     {
-      if (!wire_read_int32 (fd, (guint32*) &proc_install->return_vals[i].type, 1))
+      if (!wire_read_int32 (channel, (guint32*) &proc_install->return_vals[i].type, 1))
 	return;
-      if (!wire_read_string (fd, &proc_install->return_vals[i].name, 1))
+      if (!wire_read_string (channel, &proc_install->return_vals[i].name, 1))
 	return;
-      if (!wire_read_string (fd, &proc_install->return_vals[i].description, 1))
+      if (!wire_read_string (channel, &proc_install->return_vals[i].description, 1))
 	return;
     }
 
@@ -674,54 +674,54 @@
 }
 
 static void
-_gp_proc_install_write (int fd, WireMessage *msg)
+_gp_proc_install_write (GIOChannel *channel, WireMessage *msg)
 {
   GPProcInstall *proc_install;
   int i;
 
   proc_install = msg->data;
 
-  if (!wire_write_string (fd, &proc_install->name, 1))
+  if (!wire_write_string (channel, &proc_install->name, 1))
     return;
-  if (!wire_write_string (fd, &proc_install->blurb, 1))
+  if (!wire_write_string (channel, &proc_install->blurb, 1))
     return;
-  if (!wire_write_string (fd, &proc_install->help, 1))
+  if (!wire_write_string (channel, &proc_install->help, 1))
     return;
-  if (!wire_write_string (fd, &proc_install->author, 1))
+  if (!wire_write_string (channel, &proc_install->author, 1))
     return;
-  if (!wire_write_string (fd, &proc_install->copyright, 1))
+  if (!wire_write_string (channel, &proc_install->copyright, 1))
     return;
-  if (!wire_write_string (fd, &proc_install->date, 1))
+  if (!wire_write_string (channel, &proc_install->date, 1))
     return;
-  if (!wire_write_string (fd, &proc_install->menu_path, 1))
+  if (!wire_write_string (channel, &proc_install->menu_path, 1))
     return;
-  if (!wire_write_string (fd, &proc_install->image_types, 1))
+  if (!wire_write_string (channel, &proc_install->image_types, 1))
     return;
 
-  if (!wire_write_int32 (fd, &proc_install->type, 1))
+  if (!wire_write_int32 (channel, &proc_install->type, 1))
     return;
-  if (!wire_write_int32 (fd, &proc_install->nparams, 1))
+  if (!wire_write_int32 (channel, &proc_install->nparams, 1))
     return;
-  if (!wire_write_int32 (fd, &proc_install->nreturn_vals, 1))
+  if (!wire_write_int32 (channel, &proc_install->nreturn_vals, 1))
     return;
 
   for (i = 0; i < proc_install->nparams; i++)
     {
-      if (!wire_write_int32 (fd, (guint32*) &proc_install->params[i].type, 1))
+      if (!wire_write_int32 (channel, (guint32*) &proc_install->params[i].type, 1))
 	return;
-      if (!wire_write_string (fd, &proc_install->params[i].name, 1))
+      if (!wire_write_string (channel, &proc_install->params[i].name, 1))
 	return;
-      if (!wire_write_string (fd, &proc_install->params[i].description, 1))
+      if (!wire_write_string (channel, &proc_install->params[i].description, 1))
 	return;
     }
 
   for (i = 0; i < proc_install->nreturn_vals; i++)
     {
-      if (!wire_write_int32 (fd, (guint32*) &proc_install->return_vals[i].type, 1))
+      if (!wire_write_int32 (channel, (guint32*) &proc_install->return_vals[i].type, 1))
 	return;
-      if (!wire_write_string (fd, &proc_install->return_vals[i].name, 1))
+      if (!wire_write_string (channel, &proc_install->return_vals[i].name, 1))
 	return;
-      if (!wire_write_string (fd, &proc_install->return_vals[i].description, 1))
+      if (!wire_write_string (channel, &proc_install->return_vals[i].description, 1))
 	return;
     }
 }
@@ -761,26 +761,26 @@
 }
 
 static void
-_gp_proc_uninstall_read (int fd, WireMessage *msg)
+_gp_proc_uninstall_read (GIOChannel *channel, WireMessage *msg)
 {
   GPProcUninstall *proc_uninstall;
 
   proc_uninstall = g_new (GPProcUninstall, 1);
 
-  if (!wire_read_string (fd, &proc_uninstall->name, 1))
+  if (!wire_read_string (channel, &proc_uninstall->name, 1))
     return;
 
   msg->data = proc_uninstall;
 }
 
 static void
-_gp_proc_uninstall_write (int fd, WireMessage *msg)
+_gp_proc_uninstall_write (GIOChannel *channel, WireMessage *msg)
 {
   GPProcUninstall *proc_uninstall;
 
   proc_uninstall = msg->data;
 
-  if (!wire_write_string (fd, &proc_uninstall->name, 1))
+  if (!wire_write_string (channel, &proc_uninstall->name, 1))
     return;
 }
 
@@ -796,11 +796,11 @@
 }
 
 static void
-_gp_params_read (int fd, GPParam **params, guint *nparams)
+_gp_params_read (GIOChannel *channel, GPParam **params, guint *nparams)
 {
   int i;
 
-  if (!wire_read_int32 (fd, (guint32*) nparams, 1))
+  if (!wire_read_int32 (channel, (guint32*) nparams, 1))
     return;
 
   if (*nparams == 0)
@@ -813,115 +813,115 @@
 
   for (i = 0; i < *nparams; i++)
     {
-      if (!wire_read_int32 (fd, (guint32*) &(*params)[i].type, 1))
+      if (!wire_read_int32 (channel, (guint32*) &(*params)[i].type, 1))
 	return;
 
       switch ((*params)[i].type)
 	{
 	case PARAM_INT32:
-	  if (!wire_read_int32 (fd, (guint32*) &(*params)[i].data.d_int32, 1))
+	  if (!wire_read_int32 (channel, (guint32*) &(*params)[i].data.d_int32, 1))
 	    return;
 	  break;
 	case PARAM_INT16:
-	  if (!wire_read_int16 (fd, (guint16*) &(*params)[i].data.d_int16, 1))
+	  if (!wire_read_int16 (channel, (guint16*) &(*params)[i].data.d_int16, 1))
 	    return;
 	  break;
 	case PARAM_INT8:
-	  if (!wire_read_int8 (fd, (guint8*) &(*params)[i].data.d_int8, 1))
+	  if (!wire_read_int8 (channel, (guint8*) &(*params)[i].data.d_int8, 1))
 	    return;
 	  break;
         case PARAM_FLOAT:
-	  if (!wire_read_double (fd, &(*params)[i].data.d_float, 1))
+	  if (!wire_read_double (channel, &(*params)[i].data.d_float, 1))
 	    return;
           break;
         case PARAM_STRING:
-	  if (!wire_read_string (fd, &(*params)[i].data.d_string, 1))
+	  if (!wire_read_string (channel, &(*params)[i].data.d_string, 1))
 	    return;
           break;
         case PARAM_INT32ARRAY:
 	  (*params)[i].data.d_int32array = g_new (gint32, (*params)[i-1].data.d_int32);
-	  if (!wire_read_int32 (fd, (guint32*) (*params)[i].data.d_int32array,
+	  if (!wire_read_int32 (channel, (guint32*) (*params)[i].data.d_int32array,
 				(*params)[i-1].data.d_int32))
 	    return;
           break;
         case PARAM_INT16ARRAY:
 	  (*params)[i].data.d_int16array = g_new (gint16, (*params)[i-1].data.d_int32);
-	  if (!wire_read_int16 (fd, (guint16*) (*params)[i].data.d_int16array,
+	  if (!wire_read_int16 (channel, (guint16*) (*params)[i].data.d_int16array,
 				(*params)[i-1].data.d_int32))
 	    return;
           break;
         case PARAM_INT8ARRAY:
 	  (*params)[i].data.d_int8array = g_new (gint8, (*params)[i-1].data.d_int32);
-	  if (!wire_read_int8 (fd, (guint8*) (*params)[i].data.d_int8array,
+	  if (!wire_read_int8 (channel, (guint8*) (*params)[i].data.d_int8array,
 			       (*params)[i-1].data.d_int32))
 	    return;
           break;
         case PARAM_FLOATARRAY:
 	  (*params)[i].data.d_floatarray = g_new (gdouble, (*params)[i-1].data.d_int32);
-	  if (!wire_read_double (fd, (*params)[i].data.d_floatarray,
+	  if (!wire_read_double (channel, (*params)[i].data.d_floatarray,
 				 (*params)[i-1].data.d_int32))
 	    return;
           break;
         case PARAM_STRINGARRAY:
 	  (*params)[i].data.d_stringarray = g_new (gchar*, (*params)[i-1].data.d_int32);
-	  if (!wire_read_string (fd, (*params)[i].data.d_stringarray,
+	  if (!wire_read_string (channel, (*params)[i].data.d_stringarray,
 				 (*params)[i-1].data.d_int32))
 	    return;
           break;
         case PARAM_COLOR:
-	  if (!wire_read_int8 (fd, (guint8*) &(*params)[i].data.d_color.red, 1))
+	  if (!wire_read_int8 (channel, (guint8*) &(*params)[i].data.d_color.red, 1))
 	    return;
-	  if (!wire_read_int8 (fd, (guint8*) &(*params)[i].data.d_color.green, 1))
+	  if (!wire_read_int8 (channel, (guint8*) &(*params)[i].data.d_color.green, 1))
 	    return;
-	  if (!wire_read_int8 (fd, (guint8*) &(*params)[i].data.d_color.blue, 1))
+	  if (!wire_read_int8 (channel, (guint8*) &(*params)[i].data.d_color.blue, 1))
 	    return;
           break;
         case PARAM_REGION:
           break;
         case PARAM_DISPLAY:
-	  if (!wire_read_int32 (fd, (guint32*) &(*params)[i].data.d_display, 1))
+	  if (!wire_read_int32 (channel, (guint32*) &(*params)[i].data.d_display, 1))
 	    return;
           break;
         case PARAM_IMAGE:
-	  if (!wire_read_int32 (fd, (guint32*) &(*params)[i].data.d_image, 1))
+	  if (!wire_read_int32 (channel, (guint32*) &(*params)[i].data.d_image, 1))
 	    return;
           break;
         case PARAM_LAYER:
-	  if (!wire_read_int32 (fd, (guint32*) &(*params)[i].data.d_layer, 1))
+	  if (!wire_read_int32 (channel, (guint32*) &(*params)[i].data.d_layer, 1))
 	    return;
           break;
         case PARAM_CHANNEL:
-	  if (!wire_read_int32 (fd, (guint32*) &(*params)[i].data.d_channel, 1))
+	  if (!wire_read_int32 (channel, (guint32*) &(*params)[i].data.d_channel, 1))
 	    return;
           break;
         case PARAM_DRAWABLE:
-	  if (!wire_read_int32 (fd, (guint32*) &(*params)[i].data.d_drawable, 1))
+	  if (!wire_read_int32 (channel, (guint32*) &(*params)[i].data.d_drawable, 1))
 	    return;
           break;
         case PARAM_SELECTION:
-	  if (!wire_read_int32 (fd, (guint32*) &(*params)[i].data.d_selection, 1))
+	  if (!wire_read_int32 (channel, (guint32*) &(*params)[i].data.d_selection, 1))
 	    return;
           break;
         case PARAM_BOUNDARY:
-	  if (!wire_read_int32 (fd, (guint32*) &(*params)[i].data.d_boundary, 1))
+	  if (!wire_read_int32 (channel, (guint32*) &(*params)[i].data.d_boundary, 1))
 	    return;
           break;
         case PARAM_PATH:
-	  if (!wire_read_int32 (fd, (guint32*) &(*params)[i].data.d_path, 1))
+	  if (!wire_read_int32 (channel, (guint32*) &(*params)[i].data.d_path, 1))
 	    return;
           break;
         case PARAM_PARASITE:
 	{
-	  if (!wire_read_string (fd, &(*params)[i].data.d_parasite.name, 1))
+	  if (!wire_read_string (channel, &(*params)[i].data.d_parasite.name, 1))
 	    return;
-	  if (!wire_read_int32 (fd, &((*params)[i].data.d_parasite.flags), 1))
+	  if (!wire_read_int32 (channel, &((*params)[i].data.d_parasite.flags), 1))
 	    return;
-	  if (!wire_read_int32 (fd, &((*params)[i].data.d_parasite.size), 1))
+	  if (!wire_read_int32 (channel, &((*params)[i].data.d_parasite.size), 1))
 	    return;
 	  if ((*params)[i].data.d_parasite.size > 0)
 	  {
 	    (*params)[i].data.d_parasite.data = g_malloc((*params)[i].data.d_parasite.size);
-	    if (!wire_read_int8 (fd, (*params)[i].data.d_parasite.data,
+	    if (!wire_read_int8 (channel, (*params)[i].data.d_parasite.data,
 				 (*params)[i].data.d_parasite.size))
 	    {
 	      g_free((*params)[i].data.d_parasite.data);
@@ -933,7 +933,7 @@
 	    (*params)[i].data.d_parasite.data = NULL;
 	} break;
         case PARAM_STATUS:
-	  if (!wire_read_int32 (fd, (guint32*) &(*params)[i].data.d_status, 1))
+	  if (!wire_read_int32 (channel, (guint32*) &(*params)[i].data.d_status, 1))
 	    return;
           break;
 	case PARAM_END:
@@ -943,124 +943,124 @@
 }
 
 static void
-_gp_params_write (int fd, GPParam *params, int nparams)
+_gp_params_write (GIOChannel *channel, GPParam *params, int nparams)
 {
   int i;
 
-  if (!wire_write_int32 (fd, (guint32*) &nparams, 1))
+  if (!wire_write_int32 (channel, (guint32*) &nparams, 1))
     return;
 
   for (i = 0; i < nparams; i++)
     {
-      if (!wire_write_int32 (fd, (guint32*) &params[i].type, 1))
+      if (!wire_write_int32 (channel, (guint32*) &params[i].type, 1))
 	return;
 
       switch (params[i].type)
 	{
 	case PARAM_INT32:
-	  if (!wire_write_int32 (fd, (guint32*) &params[i].data.d_int32, 1))
+	  if (!wire_write_int32 (channel, (guint32*) &params[i].data.d_int32, 1))
 	    return;
 	  break;
 	case PARAM_INT16:
-	  if (!wire_write_int16 (fd, (guint16*) &params[i].data.d_int16, 1))
+	  if (!wire_write_int16 (channel, (guint16*) &params[i].data.d_int16, 1))
 	    return;
 	  break;
 	case PARAM_INT8:
-	  if (!wire_write_int8 (fd, (guint8*) &params[i].data.d_int8, 1))
+	  if (!wire_write_int8 (channel, (guint8*) &params[i].data.d_int8, 1))
 	    return;
 	  break;
         case PARAM_FLOAT:
-	  if (!wire_write_double (fd, &params[i].data.d_float, 1))
+	  if (!wire_write_double (channel, &params[i].data.d_float, 1))
 	    return;
           break;
         case PARAM_STRING:
-	  if (!wire_write_string (fd, &params[i].data.d_string, 1))
+	  if (!wire_write_string (channel, &params[i].data.d_string, 1))
 	    return;
           break;
         case PARAM_INT32ARRAY:
-	  if (!wire_write_int32 (fd, (guint32*) params[i].data.d_int32array,
+	  if (!wire_write_int32 (channel, (guint32*) params[i].data.d_int32array,
 				 params[i-1].data.d_int32))
 	    return;
           break;
         case PARAM_INT16ARRAY:
-	  if (!wire_write_int16 (fd, (guint16*) params[i].data.d_int16array,
+	  if (!wire_write_int16 (channel, (guint16*) params[i].data.d_int16array,
 				 params[i-1].data.d_int32))
 	    return;
           break;
         case PARAM_INT8ARRAY:
-	  if (!wire_write_int8 (fd, (guint8*) params[i].data.d_int8array,
+	  if (!wire_write_int8 (channel, (guint8*) params[i].data.d_int8array,
 				params[i-1].data.d_int32))
 	    return;
           break;
         case PARAM_FLOATARRAY:
-	  if (!wire_write_double (fd, params[i].data.d_floatarray,
+	  if (!wire_write_double (channel, params[i].data.d_floatarray,
 				  params[i-1].data.d_int32))
 	    return;
           break;
         case PARAM_STRINGARRAY:
-	  if (!wire_write_string (fd, params[i].data.d_stringarray,
+	  if (!wire_write_string (channel, params[i].data.d_stringarray,
 				  params[i-1].data.d_int32))
 	    return;
           break;
         case PARAM_COLOR:
-	  if (!wire_write_int8 (fd, (guint8*) &params[i].data.d_color.red, 1))
+	  if (!wire_write_int8 (channel, (guint8*) &params[i].data.d_color.red, 1))
 	    return;
-	  if (!wire_write_int8 (fd, (guint8*) &params[i].data.d_color.green, 1))
+	  if (!wire_write_int8 (channel, (guint8*) &params[i].data.d_color.green, 1))
 	    return;
-	  if (!wire_write_int8 (fd, (guint8*) &params[i].data.d_color.blue, 1))
+	  if (!wire_write_int8 (channel, (guint8*) &params[i].data.d_color.blue, 1))
 	    return;
           break;
         case PARAM_REGION:
           break;
         case PARAM_DISPLAY:
-	  if (!wire_write_int32 (fd, (guint32*) &params[i].data.d_display, 1))
+	  if (!wire_write_int32 (channel, (guint32*) &params[i].data.d_display, 1))
 	    return;
           break;
         case PARAM_IMAGE:
-	  if (!wire_write_int32 (fd, (guint32*) &params[i].data.d_image, 1))
+	  if (!wire_write_int32 (channel, (guint32*) &params[i].data.d_image, 1))
 	    return;
           break;
         case PARAM_LAYER:
-	  if (!wire_write_int32 (fd, (guint32*) &params[i].data.d_layer, 1))
+	  if (!wire_write_int32 (channel, (guint32*) &params[i].data.d_layer, 1))
 	    return;
           break;
         case PARAM_CHANNEL:
-	  if (!wire_write_int32 (fd, (guint32*) &params[i].data.d_channel, 1))
+	  if (!wire_write_int32 (channel, (guint32*) &params[i].data.d_channel, 1))
 	    return;
           break;
         case PARAM_DRAWABLE:
-	  if (!wire_write_int32 (fd, (guint32*) &params[i].data.d_drawable, 1))
+	  if (!wire_write_int32 (channel, (guint32*) &params[i].data.d_drawable, 1))
 	    return;
           break;
         case PARAM_SELECTION:
-	  if (!wire_write_int32 (fd, (guint32*) &params[i].data.d_selection, 1))
+	  if (!wire_write_int32 (channel, (guint32*) &params[i].data.d_selection, 1))
 	    return;
           break;
         case PARAM_BOUNDARY:
-	  if (!wire_write_int32 (fd, (guint32*) &params[i].data.d_boundary, 1))
+	  if (!wire_write_int32 (channel, (guint32*) &params[i].data.d_boundary, 1))
 	    return;
           break;
         case PARAM_PATH:
-	  if (!wire_write_int32 (fd, (guint32*) &params[i].data.d_path, 1))
+	  if (!wire_write_int32 (channel, (guint32*) &params[i].data.d_path, 1))
 	    return;
           break;
         case PARAM_PARASITE:
 	{
 	  Parasite *p = (Parasite *)&params[i].data.d_parasite;
-	  if (!wire_write_string (fd, &p->name, 1))
+	  if (!wire_write_string (channel, &p->name, 1))
 	    return;
-	  if (!wire_write_int32 (fd, &p->flags, 1))
+	  if (!wire_write_int32 (channel, &p->flags, 1))
 	    return;
-	  if (!wire_write_int32 (fd, &p->size, 1))
+	  if (!wire_write_int32 (channel, &p->size, 1))
 	    return;
 	  if (p->size > 0)
 	  {
-	    if (!wire_write_int8 (fd, p->data, p->size))
+	    if (!wire_write_int8 (channel, p->data, p->size))
 	      return;
 	  }
 	} break;
         case PARAM_STATUS:
-	  if (!wire_write_int32 (fd, (guint32*) &params[i].data.d_status, 1))
+	  if (!wire_write_int32 (channel, (guint32*) &params[i].data.d_status, 1))
 	    return;
           break;
 	case PARAM_END:
@@ -1070,12 +1070,12 @@
 }
 
 static void
-_gp_extension_ack_read (int fd, WireMessage *msg)
+_gp_extension_ack_read (GIOChannel *channel, WireMessage *msg)
 {
 }
 
 static void
-_gp_extension_ack_write (int fd, WireMessage *msg)
+_gp_extension_ack_write (GIOChannel *channel, WireMessage *msg)
 {
 }
 
diff -ru3 /home/src/gnomecvs/gimp/libgimp/gimpprotocol.h ./libgimp/gimpprotocol.h
--- /home/src/gnomecvs/gimp/libgimp/gimpprotocol.h	Wed Oct 14 12:57:15 1998
+++ ./libgimp/gimpprotocol.h	Tue Oct 27 14:26:22 1998
@@ -177,27 +177,27 @@
 
 
 void gp_init                   (void);
-int  gp_quit_write             (int            fd);
-int  gp_config_write           (int            fd,
+int  gp_quit_write             (GIOChannel    *channel);
+int  gp_config_write           (GIOChannel    *channel,
 				GPConfig      *config);
-int  gp_tile_req_write         (int            fd,
+int  gp_tile_req_write         (GIOChannel    *channel,
 				GPTileReq     *tile_req);
-int  gp_tile_ack_write         (int            fd);
-int  gp_tile_data_write        (int            fd,
+int  gp_tile_ack_write         (GIOChannel    *channel);
+int  gp_tile_data_write        (GIOChannel    *channel,
 				GPTileData    *tile_data);
-int  gp_proc_run_write         (int            fd,
+int  gp_proc_run_write         (GIOChannel    *channel,
 				GPProcRun     *proc_run);
-int  gp_proc_return_write      (int            fd,
+int  gp_proc_return_write      (GIOChannel    *channel,
 				GPProcReturn  *proc_return);
-int  gp_temp_proc_run_write    (int            fd,
+int  gp_temp_proc_run_write    (GIOChannel    *channel,
 				GPProcRun     *proc_run);
-int  gp_temp_proc_return_write (int            fd,
+int  gp_temp_proc_return_write (GIOChannel    *channel,
 				GPProcReturn  *proc_return);
-int  gp_proc_install_write     (int            fd,
+int  gp_proc_install_write     (GIOChannel    *channel,
 				GPProcInstall *proc_install);
-int  gp_proc_uninstall_write   (int            fd,
+int  gp_proc_uninstall_write   (GIOChannel    *channel,
 				GPProcUninstall *proc_uninstall);
-int  gp_extension_ack_write    (int            fd);
+int  gp_extension_ack_write    (GIOChannel    *channel);
 
 
 #endif /* __GIMP_PROTOCOL_H__ */
diff -ru3 /home/src/gnomecvs/gimp/libgimp/gimptile.c ./libgimp/gimptile.c
--- /home/src/gnomecvs/gimp/libgimp/gimptile.c	Tue Oct 13 12:32:41 1998
+++ ./libgimp/gimptile.c	Tue Oct 27 14:04:00 1998
@@ -138,7 +138,7 @@
 static void
 gimp_tile_get (GTile *tile)
 {
-  extern int _writefd;
+  extern GIOChannel *_writechannel;
   extern guchar* _shm_addr;
 
   GPTileReq tile_req;
@@ -148,7 +148,7 @@
   tile_req.drawable_ID = tile->drawable->id;
   tile_req.tile_num = tile->tile_num;
   tile_req.shadow = tile->shadow;
-  if (!gp_tile_req_write (_writefd, &tile_req))
+  if (!gp_tile_req_write (_writechannel, &tile_req))
     gimp_quit ();
 
   gimp_read_expect_msg(&msg,GP_TILE_DATA);
@@ -176,7 +176,7 @@
       tile_data->data = NULL;
     }
 
-  if (!gp_tile_ack_write (_writefd))
+  if (!gp_tile_ack_write (_writechannel))
     gimp_quit ();
 
   wire_destroy (&msg);
@@ -185,7 +185,7 @@
 static void
 gimp_tile_put (GTile *tile)
 {
-  extern int _writefd;
+  extern GIOChannel *_writechannel;
   extern guchar* _shm_addr;
 
   GPTileReq tile_req;
@@ -196,7 +196,7 @@
   tile_req.drawable_ID = -1;
   tile_req.tile_num = 0;
   tile_req.shadow = 0;
-  if (!gp_tile_req_write (_writefd, &tile_req))
+  if (!gp_tile_req_write (_writechannel, &tile_req))
     gimp_quit ();
 
   gimp_read_expect_msg(&msg,GP_TILE_DATA);
@@ -217,7 +217,7 @@
   else
     tile_data.data = tile->data;
 
-  if (!gp_tile_data_write (_writefd, &tile_data))
+  if (!gp_tile_data_write (_writechannel, &tile_data))
     gimp_quit ();
 
   gimp_read_expect_msg(&msg,GP_TILE_ACK);
diff -ru3 /home/src/gnomecvs/gimp/libgimp/gimpwire.c ./libgimp/gimpwire.c
--- /home/src/gnomecvs/gimp/libgimp/gimpwire.c	Tue Oct 13 12:32:41 1998
+++ ./libgimp/gimpwire.c	Tue Oct 27 14:12:14 1998
@@ -93,13 +93,13 @@
 }
 
 int
-wire_read (int     fd,
-	   guint8 *buf,
-	   gulong  count)
+wire_read (GIOChannel *channel,
+	   guint8     *buf,
+	   gulong      count)
 {
   if (wire_read_func)
     {
-      if (!(* wire_read_func) (fd, buf, count))
+      if (!(* wire_read_func) (channel, buf, count))
 	{
 	  g_print ("wire_read: error\n");
 	  wire_error_val = TRUE;
@@ -113,7 +113,7 @@
       while (count > 0)
 	{
 	  do {
-	    bytes = read (fd, (char*) buf, count);
+	    bytes = read (channel->fd, (char*) buf, count);
 	  } while ((bytes == -1) && ((errno == EAGAIN) || (errno == EINTR)));
 
 	  if (bytes == -1)
@@ -139,13 +139,13 @@
 }
 
 int
-wire_write (int     fd,
-	    guint8 *buf,
-	    gulong  count)
+wire_write (GIOChannel *channel,
+	    guint8     *buf,
+	    gulong	count)
 {
   if (wire_write_func)
     {
-      if (!(* wire_write_func) (fd, buf, count))
+      if (!(* wire_write_func) (channel, buf, count))
 	{
 	  g_print ("wire_write: error\n");
 	  wire_error_val = TRUE;
@@ -159,7 +159,7 @@
       while (count > 0)
 	{
 	  do {
-	    bytes = write (fd, (char*) buf, count);
+	    bytes = write (channel->fd, (char*) buf, count);
 	  } while ((bytes == -1) && ((errno == EAGAIN) || (errno == EINTR)));
 
 	  if (bytes == -1)
@@ -178,10 +178,13 @@
 }
 
 int
-wire_flush (int fd)
+wire_flush (GIOChannel *channel)
 {
   if (wire_flush_func)
-    return (* wire_flush_func) (fd);
+    return (* wire_flush_func) (channel);
+
+  g_iochannel_wakeup_peer (channel);
+
   return FALSE;
 }
 
@@ -198,7 +201,7 @@
 }
 
 int
-wire_read_msg (int          fd,
+wire_read_msg (GIOChannel  *channel,
 	       WireMessage *msg)
 {
   WireHandler *handler;
@@ -206,20 +209,20 @@
   if (wire_error_val)
     return !wire_error_val;
 
-  if (!wire_read_int32 (fd, &msg->type, 1))
+  if (!wire_read_int32 (channel, &msg->type, 1))
     return FALSE;
 
   handler = g_hash_table_lookup (wire_ht, &msg->type);
   if (!handler)
     g_error ("could not find handler for message: %d\n", msg->type);
 
-  (* handler->read_func) (fd, msg);
+  (* handler->read_func) (channel, msg);
 
   return !wire_error_val;
 }
 
 int
-wire_write_msg (int          fd,
+wire_write_msg (GIOChannel  *channel,
 		WireMessage *msg)
 {
   WireHandler *handler;
@@ -231,10 +234,10 @@
   if (!handler)
     g_error ("could not find handler for message: %d\n", msg->type);
 
-  if (!wire_write_int32 (fd, &msg->type, 1))
+  if (!wire_write_int32 (channel, &msg->type, 1))
     return FALSE;
 
-  (* handler->write_func) (fd, msg);
+  (* handler->write_func) (channel, msg);
 
   return !wire_error_val;
 }
@@ -252,13 +255,13 @@
 }
 
 int
-wire_read_int32 (int      fd,
-		 guint32 *data,
-		 gint     count)
+wire_read_int32 (GIOChannel *channel,
+		 guint32    *data,
+		 gint	     count)
 {
   if (count > 0)
     {
-      if (!wire_read_int8 (fd, (guint8*) data, count * 4))
+      if (!wire_read_int8 (channel, (guint8*) data, count * 4))
 	return FALSE;
 
       while (count--)
@@ -272,13 +275,13 @@
 }
 
 int
-wire_read_int16 (int      fd,
-		 guint16 *data,
-		 gint     count)
+wire_read_int16 (GIOChannel *channel,
+		 guint16    *data,
+		 gint	     count)
 {
   if (count > 0)
     {
-      if (!wire_read_int8 (fd, (guint8*) data, count * 2))
+      if (!wire_read_int8 (channel, (guint8*) data, count * 2))
 	return FALSE;
 
       while (count--)
@@ -292,24 +295,24 @@
 }
 
 int
-wire_read_int8 (int     fd,
-		guint8 *data,
-		gint    count)
+wire_read_int8 (GIOChannel *channel,
+		guint8	   *data,
+		gint	    count)
 {
-  return wire_read (fd, data, count);
+  return wire_read (channel, data, count);
 }
 
 int
-wire_read_double (int      fd,
-		  gdouble *data,
-		  gint     count)
+wire_read_double (GIOChannel *channel,
+		  gdouble    *data,
+		  gint	      count)
 {
   char *str;
   int i;
 
   for (i = 0; i < count; i++)
     {
-      if (!wire_read_string (fd, &str, 1))
+      if (!wire_read_string (channel, &str, 1))
 	return FALSE;
       sscanf (str, "%le", &data[i]);
       g_free (str);
@@ -319,22 +322,22 @@
 }
 
 int
-wire_read_string (int     fd,
-		  gchar **data,
-		  gint    count)
+wire_read_string (GIOChannel *channel,
+		  gchar	    **data,
+		  gint	      count)
 {
   guint32 tmp;
   int i;
 
   for (i = 0; i < count; i++)
     {
-      if (!wire_read_int32 (fd, &tmp, 1))
+      if (!wire_read_int32 (channel, &tmp, 1))
 	return FALSE;
 
       if (tmp > 0)
 	{
 	  data[i] = g_new (gchar, tmp);
-	  if (!wire_read_int8 (fd, (guint8*) data[i], tmp))
+	  if (!wire_read_int8 (channel, (guint8*) data[i], tmp))
 	    {
 	      g_free (data[i]);
 	      return FALSE;
@@ -350,9 +353,9 @@
 }
 
 int
-wire_write_int32 (int      fd,
-		  guint32 *data,
-		  gint     count)
+wire_write_int32 (GIOChannel *channel,
+		  guint32    *data,
+		  gint	      count)
 {
   guint32 tmp;
   int i;
@@ -362,7 +365,7 @@
       for (i = 0; i < count; i++)
 	{
 	  tmp = htonl (data[i]);
-	  if (!wire_write_int8 (fd, (guint8*) &tmp, 4))
+	  if (!wire_write_int8 (channel, (guint8*) &tmp, 4))
 	    return FALSE;
 	}
     }
@@ -371,9 +374,9 @@
 }
 
 int
-wire_write_int16 (int      fd,
-		  guint16 *data,
-		  gint     count)
+wire_write_int16 (GIOChannel *channel,
+		  guint16    *data,
+		  gint	      count)
 {
   guint16 tmp;
   int i;
@@ -383,7 +386,7 @@
       for (i = 0; i < count; i++)
 	{
 	  tmp = htons (data[i]);
-	  if (!wire_write_int8 (fd, (guint8*) &tmp, 2))
+	  if (!wire_write_int8 (channel, (guint8*) &tmp, 2))
 	    return FALSE;
 	}
     }
@@ -392,17 +395,17 @@
 }
 
 int
-wire_write_int8 (int     fd,
-		 guint8 *data,
-		 gint    count)
+wire_write_int8 (GIOChannel *channel,
+		 guint8	    *data,
+		 gint	    count)
 {
-  return wire_write (fd, data, count);
+  return wire_write (channel, data, count);
 }
 
 int
-wire_write_double (int      fd,
-		   gdouble *data,
-		   gint     count)
+wire_write_double (GIOChannel *channel,
+		   gdouble    *data,
+		   gint	       count)
 {
   gchar *t, buf[128];
   int i;
@@ -411,7 +414,7 @@
   for (i = 0; i < count; i++)
     {
       sprintf (buf, "%0.50e", data[i]);
-      if (!wire_write_string (fd, &t, 1))
+      if (!wire_write_string (channel, &t, 1))
 	return FALSE;
     }
 
@@ -419,9 +422,9 @@
 }
 
 int
-wire_write_string (int     fd,
-		   gchar **data,
-		   gint    count)
+wire_write_string (GIOChannel *channel,
+		   gchar     **data,
+		   gint	       count)
 {
   guint32 tmp;
   int i;
@@ -433,10 +436,10 @@
       else
 	tmp = 0;
 
-      if (!wire_write_int32 (fd, &tmp, 1))
+      if (!wire_write_int32 (channel, &tmp, 1))
 	return FALSE;
       if (tmp > 0)
-	if (!wire_write_int8 (fd, (guint8*) data[i], tmp))
+	if (!wire_write_int8 (channel, (guint8*) data[i], tmp))
 	  return FALSE;
     }
 
diff -ru3 /home/src/gnomecvs/gimp/libgimp/gimpwire.h ./libgimp/gimpwire.h
--- /home/src/gnomecvs/gimp/libgimp/gimpwire.h	Tue Oct 13 12:32:41 1998
+++ ./libgimp/gimpwire.h	Tue Oct 27 14:14:33 1998
@@ -25,11 +25,11 @@
 
 typedef struct _WireMessage  WireMessage;
 
-typedef void (* WireReadFunc)    (int fd, WireMessage *msg);
-typedef void (* WireWriteFunc)   (int fd, WireMessage *msg);
+typedef void (* WireReadFunc)    (GIOChannel *channel, WireMessage *msg);
+typedef void (* WireWriteFunc)   (GIOChannel *channel, WireMessage *msg);
 typedef void (* WireDestroyFunc) (WireMessage *msg);
-typedef int  (* WireIOFunc)      (int fd, guint8 *buf, gulong count);
-typedef int  (* WireFlushFunc)   (int fd);
+typedef int  (* WireIOFunc)      (GIOChannel *channel, guint8 *buf, gulong count);
+typedef int  (* WireFlushFunc)   (GIOChannel *channel);
 
 
 struct _WireMessage
@@ -46,48 +46,48 @@
 void wire_set_reader   (WireIOFunc       read_func);
 void wire_set_writer   (WireIOFunc       write_func);
 void wire_set_flusher  (WireFlushFunc    flush_func);
-int  wire_read         (int              fd,
+int  wire_read         (GIOChannel	*channel,
 			guint8          *buf,
 			gulong           count);
-int  wire_write        (int              fd,
+int  wire_write        (GIOChannel	*channel,
 			guint8          *buf,
 			gulong           count);
-int  wire_flush        (int              fd);
+int  wire_flush        (GIOChannel	*channel);
 int  wire_error        (void);
 void wire_clear_error  (void);
-int  wire_read_msg     (int              fd,
+int  wire_read_msg     (GIOChannel	*channel,
 		        WireMessage     *msg);
-int  wire_write_msg    (int              fd,
+int  wire_write_msg    (GIOChannel	*channel,
 		        WireMessage     *msg);
 void wire_destroy      (WireMessage     *msg);
-int  wire_read_int32   (int              fd,
+int  wire_read_int32   (GIOChannel	*channel,
 		        guint32         *data,
 		        gint             count);
-int  wire_read_int16   (int              fd,
+int  wire_read_int16   (GIOChannel      *channel,
 		        guint16         *data,
 		        gint             count);
-int  wire_read_int8    (int              fd,
+int  wire_read_int8    (GIOChannel      *channel,
 		        guint8          *data,
 		        gint             count);
-int  wire_read_double  (int              fd,
+int  wire_read_double  (GIOChannel      *channel,
 		        gdouble         *data,
 		        gint             count);
-int  wire_read_string  (int              fd,
+int  wire_read_string  (GIOChannel      *channel,
 			gchar          **data,
 			gint             count);
-int  wire_write_int32  (int              fd,
+int  wire_write_int32  (GIOChannel      *channel,
 		        guint32         *data,
 		        gint             count);
-int  wire_write_int16  (int              fd,
+int  wire_write_int16  (GIOChannel      *channel,
 		        guint16         *data,
 		        gint             count);
-int  wire_write_int8   (int              fd,
+int  wire_write_int8   (GIOChannel      *channel,
 		        guint8          *data,
 		        gint             count);
-int  wire_write_double (int              fd,
+int  wire_write_double (GIOChannel      *channel,
 			gdouble         *data,
 			gint             count);
-int  wire_write_string (int              fd,
+int  wire_write_string (GIOChannel      *channel,
 			gchar          **data,
 			gint             count);
 
diff -ru3 /home/src/gnomecvs/gimp/plug-ins/script-fu/script-fu-console.c ./plug-ins/script-fu/script-fu-console.c
--- /home/src/gnomecvs/gimp/plug-ins/script-fu/script-fu-console.c	Tue Oct 13 12:32:55 1998
+++ ./plug-ins/script-fu/script-fu-console.c	Tue Oct 27 14:31:20 1998
@@ -60,7 +60,7 @@
 static void  script_fu_browse_callback    (GtkWidget        *widget,
 					  gpointer          data);
 static void  script_fu_siod_read         (gpointer          data,
-					  gint              id,
+					  GIOChannel       *channel,
 					  GdkInputCondition cond);
 static gint  script_fu_cc_is_empty       (void);
 static gint  script_fu_cc_key_function   (GtkWidget         *widget,
@@ -158,6 +158,7 @@
   GtkWidget *hbox;
   gchar **argv;
   gint argc;
+  GIOChannel *input;
 
   argc = 1;
   argv = g_new (gchar *, 1);
@@ -295,7 +296,8 @@
   gtk_widget_show (button);
   gtk_widget_show (cint.cc);
 
-  cint.input_id = gdk_input_add (siod_output_pipe[0],
+  input = g_iochannel_new (siod_output_pipe[0]);
+  cint.input_id = gdk_input_add (input,
 				 GDK_INPUT_READ,
 				 script_fu_siod_read,
 				 NULL);
@@ -309,6 +311,7 @@
   gtk_main ();
 
   gdk_input_remove (cint.input_id);
+  g_iochannel_close_and_free (input);
   if (dlg)
     gtk_widget_destroy (dlg);
   gdk_flush ();
@@ -376,12 +379,12 @@
 
 static void
 script_fu_siod_read (gpointer          data,
-		     gint              id,
+		     GIOChannel       *channel,
 		     GdkInputCondition cond)
 {
   int count;
 
-  if ((count = read (id, read_buffer, BUFSIZE - 1)) != 0)
+  if ((count = read (channel->fd, read_buffer, BUFSIZE - 1)) != 0)
     {
       read_buffer[count] = '\0';
       gtk_text_freeze (GTK_TEXT (cint.console));
