diff -u -p -u -r1.270 configure.in
--- configure.in	25 May 2006 13:40:26 -0000	1.270
+++ configure.in	9 Jun 2006 11:49:40 -0000
@@ -102,6 +102,8 @@ if test x$ENABLE_GST = xno || test x$ENA
 	PKG_CHECK_MODULES(XINE, $MM, HAVE_XINE=yes, HAVE_XINE=no)
 	if test x$HAVE_XINE = xyes; then
 		AC_MSG_RESULT(xine-lib)
+		BACKEND_LIBS="$XINE_LIBS"
+		BACKEND_CFLAGS="$XINE_CFLAGS"
 	fi
 fi
 
@@ -117,9 +119,8 @@ if test x$HAVE_XINE = xno; then
 	PKG_CHECK_MODULES(GST, $MM,
 			HAVE_GSTREAMER=yes, HAVE_GSTREAMER=no)
 	if test x$GST_MAJORMINOR = x0.10; then
-		GST_LIBS="$GST_LIBS -lgstinterfaces-$GST_MAJORMINOR -lgstvideo-$GST_MAJORMINOR -lgstaudio-$GST_MAJORMINOR"
-		AC_SUBST(GST_LIBS)
-		EXTRA_BACKEND_LIBS="-lgstinterfaces-$GST_MAJORMINOR -lgstvideo-$GST_MAJORMINOR -lgstaudio-$GST_MAJORMINOR"
+		BACKEND_LIBS="$GST_LIBS -lgstinterfaces-$GST_MAJORMINOR -lgstvideo-$GST_MAJORMINOR -lgstaudio-$GST_MAJORMINOR"
+		BACKEND_CFLAGS="$GST_CFLAGS"
 		AC_DEFINE(HAVE_GSTREAMER_010, 1, [Whether we use Gst 0.8 or 0.10])
 	fi
 
@@ -179,6 +180,8 @@ if test x$HAVE_XINE = xno; then
 fi
 
 AM_CONDITIONAL(TOTEM_GST, test "x$HAVE_GSTREAMER" = "xyes")
+AC_SUBST(BACKEND_LIBS)
+AC_SUBST(BACKEND_CFLAGS)
 
 AC_ARG_ENABLE(vanity,
 	AC_HELP_STRING([--enable-vanity],[do not compile and install vanity]),
@@ -224,10 +227,10 @@ AC_ARG_ENABLE(gtk,
 dnl Seems that the order matters because libtool blows
 dnl Also check if we're going to be using GTK+ only
 if test x$ENABLE_GTK = "xno" ; then
-	PKG_CHECK_MODULES(EXTRA_GNOME, glib-2.0 >= $GLIB_REQS gtk+-2.0 >= $GTK_REQS libgnomeui-2.0 >= $GNOMEUI_REQS libglade-2.0 gnome-vfs-2.0 >= $GNOMEVFS_REQS gnome-vfs-module-2.0 >= $GNOMEVFS_REQS gnome-desktop-2.0 >= 2.1.5 gnome-icon-theme >= $GNOMEICON_REQS gmodule-2.0 iso-codes $MM)
+	PKG_CHECK_MODULES(EXTRA_GNOME, glib-2.0 >= $GLIB_REQS gtk+-2.0 >= $GTK_REQS libgnomeui-2.0 >= $GNOMEUI_REQS libglade-2.0 gnome-vfs-2.0 >= $GNOMEVFS_REQS gnome-vfs-module-2.0 >= $GNOMEVFS_REQS gnome-desktop-2.0 >= 2.1.5 gnome-icon-theme >= $GNOMEICON_REQS gmodule-2.0 iso-codes)
 	HAVE_GNOME=yes
 else
-	PKG_CHECK_MODULES(EXTRA_GNOME, glib-2.0 >= $GLIB_REQS gtk+-2.0 >= $GTK_REQS libglade-2.0 gnome-vfs-2.0 >= $GNOMEVFS_REQS gnome-vfs-module-2.0 >= $GNOMEVFS_REQS gnome-icon-theme >= $GNOMEICON_REQS gmodule-2.0 iso-codes $MM)
+	PKG_CHECK_MODULES(EXTRA_GNOME, glib-2.0 >= $GLIB_REQS gtk+-2.0 >= $GTK_REQS libglade-2.0 gnome-vfs-2.0 >= $GNOMEVFS_REQS gnome-vfs-module-2.0 >= $GNOMEVFS_REQS gnome-icon-theme >= $GNOMEICON_REQS gmodule-2.0 iso-codes)
 	AC_DEFINE(USE_STABLE_LIBGNOMEUI, 1, [defined if we don't have GNOME])
 	AC_DEFINE(HAVE_GTK_ONLY, 1, [defined if GNOME isn't used])
 	HAVE_GNOME=no
@@ -265,13 +268,21 @@ AC_DEFINE_UNQUOTED([ISO_CODES_PREFIX],["
 
 AM_CONDITIONAL(HAVE_GNOME, test x$HAVE_GNOME = "xyes")
 EXTRA_GNOME_CFLAGS="$EXTRA_GNOME_CFLAGS"
-EXTRA_GNOME_LIBS="$EXTRA_GNOME_LIBS $EXTRA_BACKEND_LIBS"
+EXTRA_GNOME_LIBS="$EXTRA_GNOME_LIBS"
 AC_SUBST(EXTRA_GNOME_CFLAGS)
 AC_SUBST(EXTRA_GNOME_LIBS)
 
-PKG_CHECK_MODULES(GTK, gtk+-x11-2.0 $MM gthread-2.0)
+case "`$PKG_CONFIG gtk+-2.0 --variable=target`" in
+	x11)
+		AC_DEFINE([HAVE_GTK_X11],[1],[Define if GTK+ is build for X11])
+		PKG_CHECK_MODULES(GTK, gtk+-x11-2.0 gthread-2.0) ;;
+	win32)
+		AC_DEFINE([HAVE_GTK_WIN32],[1],[Define if GTK+ is build for Win32])
+		PKG_CHECK_MODULES(GTK, gtk+-win32-2.0 gthread-2.0) ;;
+	*)
+		PKG_CHECK_MODULES(GTK, gtk+-2.0 gthread-2.0) ;;
+esac
 AC_SUBST(GTK_CFLAGS)
-GTK_LIBS="$GTK_LIBS $EXTRA_BACKEND_LIBS"
 AC_SUBST(GTK_LIBS)
 
 dnl *******
@@ -339,8 +350,7 @@ fi
 dnl Check for mozilla CFLAGS/LDFLAGS
 if test "x$ENABLE_MOZILLA" = "xyes" ; then
 	PKG_CHECK_MODULES([MOZILLA],
-		[gtk+-x11-2.0 \
-		 $MM \
+		[gtk+-2.0 \
 		 gthread-2.0 \
 		 $MOZILLA-xpcom >= $MOZILLA_VERSION_MIN \
 		 $MOZILLA-plugin \
@@ -419,7 +429,7 @@ AC_ARG_ENABLE(nautilus,
 	[ENABLE_NAUTILUS=yes]) dnl Default value
 
 if test x$ENABLE_NAUTILUS = "xyes" ; then
-	PKG_CHECK_MODULES(NAUTILUS, gtk+-x11-2.0 $MM gthread-2.0 libnautilus-extension,
+	PKG_CHECK_MODULES(NAUTILUS, gtk+-2.0 gthread-2.0 libnautilus-extension,
 			[HAVE_NAUTILUS=yes], [HAVE_NAUTILUS=no])
 fi
 
@@ -531,7 +541,7 @@ if test $have_randr = yes -a $have_xvidm
 fi
 
 dnl Explicitely link against libX11 to avoid problems with crappy linkers
-X_LIBS="$X_LIBRARIES -lX11"
+dnl X_LIBS="$X_LIBRARIES -lX11"
 AC_SUBST(X_LIBS)
 
 dnl Multimedia keys
diff -u -p -u -r1.23 totem-scrsaver.c
--- src/totem-scrsaver.c	23 Apr 2006 23:06:10 -0000	1.23
+++ src/totem-scrsaver.c	9 Jun 2006 11:49:42 -0000
@@ -24,12 +24,14 @@
 #include "config.h"
 
 #include <glib/gi18n.h>
+#if HAVE_GTK_X11
 #include <gdk/gdkx.h>
 
 #ifdef HAVE_XTEST
 #include <X11/extensions/XTest.h>
 #endif /* HAVE_XTEST */
 #include <X11/keysym.h>
+#endif
 
 #ifdef WITH_DBUS
 #include <dbus/dbus.h>
@@ -69,7 +71,7 @@ struct TotemScrsaverPrivate {
 	/* For use with XTest */
 	int keycode1, keycode2;
 	int *keycode;
-	Bool have_xtest;
+	gboolean have_xtest;
 };
 
 G_DEFINE_TYPE(TotemScrsaver, totem_scrsaver, G_TYPE_OBJECT)
@@ -240,8 +242,9 @@ static void
 screensaver_enable_x11 (TotemScrsaver *scr)
 {
 
+#if HAVE_GTK_X11
 #ifdef HAVE_XTEST
-	if (scr->priv->have_xtest == True)
+	if (scr->priv->have_xtest)
 	{
 		g_source_remove_by_user_data (scr);
 		return;
@@ -255,6 +258,7 @@ screensaver_enable_x11 (TotemScrsaver *s
 			scr->priv->prefer_blanking,
 			scr->priv->allow_exposures);
 	XUnlockDisplay (GDK_DISPLAY());
+#endif
 }
 
 #ifdef HAVE_XTEST
@@ -284,8 +288,9 @@ static void
 screensaver_disable_x11 (TotemScrsaver *scr)
 {
 
+#if HAVE_GTK_X11
 #ifdef HAVE_XTEST
-	if (scr->priv->have_xtest == True)
+	if (scr->priv->have_xtest)
 	{
 		XLockDisplay (GDK_DISPLAY());
 		XGetScreenSaver(GDK_DISPLAY(), &scr->priv->timeout,
@@ -315,17 +320,19 @@ screensaver_disable_x11 (TotemScrsaver *
 	XSetScreenSaver(GDK_DISPLAY(), 0, 0,
 			DontPreferBlanking, DontAllowExposures);
 	XUnlockDisplay (GDK_DISPLAY());
+#endif
 }
 
 static void
 screensaver_init_x11 (TotemScrsaver *scr)
 {
+#if HAVE_GTK_X11
 #ifdef HAVE_XTEST
 	int a, b, c, d;
 
 	XLockDisplay (GDK_DISPLAY());
-	scr->priv->have_xtest = XTestQueryExtension (GDK_DISPLAY(), &a, &b, &c, &d);
-	if(scr->priv->have_xtest == True)
+	scr->priv->have_xtest = (XTestQueryExtension (GDK_DISPLAY(), &a, &b, &c, &d) == True);
+	if(scr->priv->have_xtest)
 	{
 		scr->priv->keycode1 = XKeysymToKeycode (GDK_DISPLAY(), XK_Alt_L);
 		if (scr->priv->keycode1 == 0) {
@@ -342,6 +349,7 @@ screensaver_init_x11 (TotemScrsaver *scr
 	}
 	XUnlockDisplay (GDK_DISPLAY());
 #endif /* HAVE_XTEST */
+#endif
 }
 
 static void
diff -u -p -u -r1.498 totem.c
--- src/totem.c	14 May 2006 10:32:38 -0000	1.498
+++ src/totem.c	9 Jun 2006 11:49:44 -0000
@@ -40,12 +40,14 @@
 
 #include <string.h>
 
+#if HAVE_GTK_X11
 /* X11 headers */
 #include <gdk/gdkx.h>
 #include <X11/Xlib.h>
 #ifdef HAVE_XFREE
 #include <X11/XF86keysym.h>
 #endif
+#endif
 
 #include "bacon-video-widget.h"
 #include "bacon-video-widget-properties.h"
@@ -3524,12 +3526,14 @@ main (int argc, char **argv)
 	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
 	textdomain (GETTEXT_PACKAGE);
 
+#if HAVE_GTK_X11
 	if (XInitThreads () == 0)
 	{
 		gtk_init (&argc, &argv);
 		g_set_application_name (_("Totem Movie Player"));
 		totem_action_error_and_exit (_("Could not initialize the thread-safe libraries."), _("Verify your system installation. Totem will now exit."), NULL);
 	}
+#endif
 
 	g_thread_init (NULL);
 
diff -u -p -u -r1.9 video-dev.c
--- src/video-dev.c	17 Mar 2005 23:47:28 -0000	1.9
+++ src/video-dev.c	9 Jun 2006 11:49:44 -0000
@@ -37,7 +37,6 @@
 #include <stdlib.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <sys/ioctl.h>
 #include <string.h>
 #include <unistd.h>
 #include <fcntl.h>
diff -u -p -u -r1.6 Makefile.am
--- src/backend/Makefile.am	10 May 2006 10:11:10 -0000	1.6
+++ src/backend/Makefile.am	9 Jun 2006 11:49:44 -0000
@@ -39,7 +39,10 @@ libbaconvideowidget_la_SOURCES = \
 libbaconvideowidget_la_CFLAGS = \
 	-D_REENTRANT \
 	$(NVTV_CFLAGS) \
+	$(BACKEND_CFLAGS) \
 	-DGCONF_PREFIX=\""/apps/totem"\"
+libbaconvideowidget_la_LIBADD = \
+	$(BACKEND_LIBS)
 
 CLEANFILES = $(BUILT_SOURCES)
 
diff -u -p -u -r1.71 bacon-video-widget-gst-0.10.c
--- src/backend/bacon-video-widget-gst-0.10.c	23 May 2006 08:55:23 -0000	1.71
+++ src/backend/bacon-video-widget-gst-0.10.c	9 Jun 2006 11:49:46 -0000
@@ -51,7 +51,9 @@
 #include <stdio.h>
 
 /* gtk+/gnome */
+#if HAVE_GTK_X11
 #include <gdk/gdkx.h>
+#endif
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
 #include <gconf/gconf-client.h>
@@ -483,7 +485,9 @@ bacon_video_widget_expose_event (GtkWidg
   BaconVideoWidget *bvw = BACON_VIDEO_WIDGET (widget);
   GstXOverlay *xoverlay;
   gboolean draw_logo;
+#if HAVE_GTK_X11
   XID window;
+#endif
 
   if (event && event->count > 0)
     return TRUE;
@@ -499,10 +503,12 @@ bacon_video_widget_expose_event (GtkWidg
 
   g_mutex_unlock (bvw->priv->lock);
 
+#if HAVE_GTK_X11
   window = GDK_WINDOW_XWINDOW (bvw->priv->video_window);
 
   if (xoverlay != NULL && GST_IS_X_OVERLAY (xoverlay))
     gst_x_overlay_set_xwindow_id (xoverlay, window);
+#endif
 
   /* Start with a nice black canvas */
   gdk_draw_rectangle (widget->window, widget->style->black_gc, TRUE, 0, 0,
@@ -4090,7 +4096,9 @@ bvw_element_msg_sync (GstBus *bus, GstMe
   /* This only gets sent if we haven't set an ID yet. This is our last
    * chance to set it before the video sink will create its own window */
   if (gst_structure_has_name (msg->structure, "prepare-xwindow-id")) {
+#if HAVE_GTK_X11
     XID window;
+#endif
 
     GST_DEBUG ("Handling sync prepare-xwindow-id message");
 
@@ -4101,8 +4109,10 @@ bvw_element_msg_sync (GstBus *bus, GstMe
     g_return_if_fail (bvw->priv->xoverlay != NULL);
     g_return_if_fail (bvw->priv->video_window != NULL);
 
+#if HAVE_GTK_X11
     window = GDK_WINDOW_XWINDOW (bvw->priv->video_window);
     gst_x_overlay_set_xwindow_id (bvw->priv->xoverlay, window);
+#endif
   }
 }
 
diff -u -p -u -r1.8 bvw-test.c
--- src/backend/bvw-test.c	22 May 2006 16:27:47 -0000	1.8
+++ src/backend/bvw-test.c	9 Jun 2006 11:49:47 -0000
@@ -2,7 +2,9 @@
 #include <gtk/gtk.h>
 #include <gdk/gdk.h>
 #include "bacon-video-widget.h"
+#if HAVE_GTK_X11
 #include <X11/Xlib.h>
+#endif
 
 GtkWidget *win;
 GtkWidget *xine;
@@ -35,7 +37,9 @@ int main(int argc, char *argv[])
 		return 1;
 	}
 
+#if HAVE_GTK_X11
 	XInitThreads();
+#endif
 	gtk_init (&argc, &argv);
 	g_thread_init (NULL);
 	bacon_video_widget_init_backend (NULL, NULL);
diff -u -p -u -r1.31 video-utils.c
--- src/backend/video-utils.c	17 May 2006 14:49:22 -0000	1.31
+++ src/backend/video-utils.c	9 Jun 2006 11:49:47 -0000
@@ -7,8 +7,6 @@
 #include <libintl.h>
 
 #include <gdk/gdk.h>
-#include <gdk/gdkx.h>
-#include <X11/Xlib.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
diff -u -p -u -r1.33 totem-disc.c
--- src/plparse/totem-disc.c	25 May 2006 15:37:48 -0000	1.33
+++ src/plparse/totem-disc.c	9 Jun 2006 11:49:47 -0000
@@ -36,7 +36,9 @@
 #include <errno.h>
 #include <string.h>
 
+#ifndef HAVE_GTK_WIN32
 #include <sys/ioctl.h>
+#endif
 #include <sys/stat.h>
 
 #include <glib.h>
@@ -71,6 +73,7 @@ typedef struct _CdCache {
   gboolean mounted;
 } CdCache;
 
+#ifndef HAVE_GTK_WIN32
 /* 
  * Resolve relative paths
  */
@@ -97,6 +100,7 @@ totem_disc_resolve_link (const char *dev
 
   return result;
 }
+#endif
 
 /*
  * So, devices can be symlinks and that screws up.
@@ -106,6 +110,7 @@ static char *
 get_device (const char *device,
 	    GError     **error)
 {
+#ifndef HAVE_GTK_WIN32
   char *buf;
   char *dev = g_strdup (device);
   struct stat st;
@@ -138,6 +143,9 @@ get_device (const char *device,
   }
 
   return dev;
+#else
+  return NULL;
+#endif
 }
 
 static gboolean
