Index: pan/gui/pan.cc
===================================================================
--- pan/gui/pan.cc	(revision 226)
+++ pan/gui/pan.cc	(working copy)
@@ -211,7 +211,6 @@
   textdomain (GETTEXT_PACKAGE);
 
   g_thread_init (0);
-  gtk_init (&argc, &argv);
   g_mime_init (GMIME_INIT_FLAG_UTF8);
 
   bool gui(true), nzb(false);
@@ -249,6 +248,11 @@
     }
   }
 
+  if (gui)
+    gtk_init (&argc, &argv); /* NB: gtk_init() implicitly contacts the
+                                X server so it should only be called 
+                                if we are sure we will have a gui */
+
   if (!gui && nzb_files.empty() && url.empty() && groups.empty()) {
     std::cerr << _("Error: --no-gui used without nzb files or news:message-id.") << std::endl;
     return 0;
