diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c
index 440b401..662a57c 100644
--- a/src/gui_gtk_x11.c
+++ b/src/gui_gtk_x11.c
@@ -6464,17 +6464,31 @@ input_timer_cb(gpointer data)
 /*
  * Callback function, used when data is available on the SNiFF connection.
  */
+# if GTK_CHECK_VERSION(3,0,0)
+    static gboolean
+# else
     static void
+# endif
 sniff_request_cb(
+# if GTK_CHECK_VERSION(3,0,0)
+    GIOChannel   *source UNUSED,
+    GIOCondition  condition UNUSED,
+    gpointer      data UNUSED
+# else
     gpointer	data UNUSED,
     gint	source_fd UNUSED,
-    GdkInputCondition condition UNUSED)
+    GdkInputCondition condition UNUSED
+# endif
+    )
 {
     static char_u bytes[3] = {CSI, (int)KS_EXTRA, (int)KE_SNIFF};
 
     add_to_input_buf(bytes, 3);
+# if GTK_CHECK_VERSION(3,0,0)
+    return TRUE;
+# endif
 }
-#endif
+#endif /* defined(FEAT_SNIFF) */
 
 /*
  * GUI input routine called by gui_wait_for_chars().  Waits for a character
@@ -6500,17 +6514,31 @@ gui_mch_wait_for_chars(long wtime)
     if (sniff_on && !want_sniff_request)
     {
 	if (sniff_input_id)
+# if GTK_CHECK_VERSION(3,0,0)
+	    g_source_remove(sniff_input_id);
+# else
 	    gdk_input_remove(sniff_input_id);
+# endif
+	sniff_input_id = 0;
 	sniff_on = 0;
     }
     else if (!sniff_on && want_sniff_request)
     {
 	/* Add fd_from_sniff to watch for available data in main loop. */
+# if GTK_CHECK_VERSION(3,0,0)
+	{
+	    GIOChannel *chnnl = g_io_channel_unix_new((gint)fd_from_sniff);
+	    sniff_input_id = g_io_add_watch(chnnl, G_IO_IN|G_IO_HUP|G_IO_ERR,
+		    sniff_request_cb, NULL);
+	    g_io_channel_unref(chnnl);
+	}
+# else
 	sniff_input_id = gdk_input_add(fd_from_sniff,
 			       GDK_INPUT_READ, sniff_request_cb, NULL);
+# endif
 	sniff_on = 1;
     }
-#endif
+#endif /* defined(FEAT_SNIFF) */
 
     timed_out = FALSE;
 
