diff --git a/configure.ac b/configure.ac
index 41bbd67..11de801 100644
--- a/configure.ac
+++ b/configure.ac
@@ -139,7 +139,7 @@ PKG_CHECK_EXISTS([gnome-bluetooth-1.0 >= 3.1.0],
 	 AC_SUBST([HAVE_BLUETOOTH],[0])
 	 AC_MSG_RESULT([no])])
 
-PKG_CHECK_MODULES(CALENDAR_SERVER, libecal-1.2 >= $LIBECAL_MIN_VERSION libedataserver-1.2 >= $LIBEDATASERVER_MIN_VERSION libedataserverui-3.0 >= $LIBEDATASERVERUI_MIN_VERSION gio-2.0)
+PKG_CHECK_MODULES(CALENDAR_SERVER, libecal-1.2 >= $LIBECAL_MIN_VERSION libedataserver-1.2 >= $LIBEDATASERVER_MIN_VERSION gio-2.0)
 AC_SUBST(CALENDAR_SERVER_CFLAGS)
 AC_SUBST(CALENDAR_SERVER_LIBS)
 
diff --git a/src/calendar-server/calendar-sources.c b/src/calendar-server/calendar-sources.c
index c507f0f..b0dbb20 100644
--- a/src/calendar-server/calendar-sources.c
+++ b/src/calendar-server/calendar-sources.c
@@ -31,7 +31,6 @@
 #include <string.h>
 #define HANDLE_LIBICAL_MEMORY
 #include <libecal/libecal.h>
-#include <libedataserverui/libedataserverui.h>
 
 #undef CALENDAR_ENABLE_DEBUG
 #include "calendar-debug.h"
diff --git a/src/calendar-server/gnome-shell-calendar-server.c b/src/calendar-server/gnome-shell-calendar-server.c
index 2ceb058..bdbe172 100644
--- a/src/calendar-server/gnome-shell-calendar-server.c
+++ b/src/calendar-server/gnome-shell-calendar-server.c
@@ -34,7 +34,6 @@
 #include <unistd.h>
 
 #include <gio/gio.h>
-#include <gtk/gtk.h>
 
 #define HANDLE_LIBICAL_MEMORY
 #include <libecal/libecal.h>
@@ -985,9 +984,11 @@ on_name_lost (GDBusConnection *connection,
               const gchar     *name,
               gpointer         user_data)
 {
+  GMainLoop *main_loop = user_data;
+
   g_print ("gnome-shell-calendar-server[%d]: Lost (or failed to acquire) the name " BUS_NAME " - exiting\n",
            (gint) getpid ());
-  gtk_main_quit ();
+  g_main_loop_quit (main_loop);
 }
 
 static void
@@ -1003,11 +1004,13 @@ stdin_channel_io_func (GIOChannel *source,
                        GIOCondition condition,
                        gpointer data)
 {
+  GMainLoop *main_loop = data;
+
   if (condition & G_IO_HUP)
     {
       g_debug ("gnome-shell-calendar-server[%d]: Got HUP on stdin - exiting\n",
                (gint) getpid ());
-      gtk_main_quit ();
+      g_main_loop_quit (main_loop);
     }
   else
     {
@@ -1022,6 +1025,7 @@ main (int    argc,
 {
   GError *error;
   GOptionContext *opt_context;
+  GMainLoop *main_loop;
   gint ret;
   guint name_owner_id;
   GIOChannel *stdin_channel;
@@ -1031,9 +1035,7 @@ main (int    argc,
   name_owner_id = 0;
   stdin_channel = NULL;
 
-  /* We need to initialize GTK+ since evolution-data-server may decide to use
-   * GTK+ to pop up a dialog box */
-  gtk_init (&argc, &argv);
+  g_type_init ();
 
   introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL);
   g_assert (introspection_data != NULL);
@@ -1048,11 +1050,15 @@ main (int    argc,
       goto out;
     }
 
+  main_loop = g_main_loop_new (NULL, FALSE);
+
   stdin_channel = g_io_channel_unix_new (STDIN_FILENO);
-  g_io_add_watch (stdin_channel,
-                  G_IO_HUP,
-                  stdin_channel_io_func,
-                  NULL);
+  g_io_add_watch_full (stdin_channel,
+                       G_PRIORITY_DEFAULT,
+                       G_IO_HUP,
+                       stdin_channel_io_func,
+                       g_main_loop_ref (main_loop),
+                       (GDestroyNotify) g_main_loop_unref);
 
   name_owner_id = g_bus_own_name (G_BUS_TYPE_SESSION,
                                   BUS_NAME,
@@ -1061,10 +1067,12 @@ main (int    argc,
                                   on_bus_acquired,
                                   on_name_acquired,
                                   on_name_lost,
-                                  NULL,
-                                  NULL);
+                                  g_main_loop_ref (main_loop),
+                                  (GDestroyNotify) g_main_loop_unref);
+
+  g_main_loop_run (main_loop);
 
-  gtk_main ();
+  g_main_loop_unref (main_loop);
 
   ret = 0;
 
