diff --git a/configure.ac b/configure.ac
index b591426..86478fa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -29,8 +29,8 @@ AC_CHECK_SIZEOF(long)
 
 DBUS_MIN_REQS=0.35
 GST_0_10_REQS=0.10.12
-GTK_REQS=2.12.0
-GLIB_REQS=2.15.5
+GTK_REQS=2.14.0
+GLIB_REQS=2.16.0
 GNOME_MEDIA_PROFILES_REQS=2.8
 LIBNOTIFY_REQS=0.3.2
 LIBGPOD_REQS=0.6
@@ -70,7 +70,6 @@ PKG_CHECK_MODULES(RHYTHMBOX,				\
 		  glib-2.0 >= $GLIB_REQS		\
 		  gio-2.0 >= $GLIB_REQS			\
 		  gnome-media-profiles >= $GNOME_MEDIA_PROFILES_REQS \
-		  libgnomeui-2.0			\
 		  libglade-2.0				\
 		  libsoup-2.4)
 
diff --git a/lib/Makefile.am b/lib/Makefile.am
index f47db58..4be754c 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -14,6 +14,12 @@ librb_la_SOURCES =					\
 	rb-debug.h					\
 	eel-gconf-extensions.c				\
 	eel-gconf-extensions.h				\
+	eggdesktopfile.c				\
+	eggdesktopfile.h				\
+	eggsmclient.c					\
+	eggsmclient.h					\
+	eggsmclient-private.h				\
+	eggsmclient-xsmp.c				\
 	rb-file-helpers.c				\
 	rb-file-helpers.h				\
 	rb-glade-helpers.c				\
@@ -39,12 +45,13 @@ INCLUDES =						\
 	-DG_LOG_DOMAIN=\"Rhythmbox\"		 	\
 	-DSHARE_DIR=\"$(pkgdatadir)\"			\
 	-DDATADIR=\""$(datadir)"\"			\
+	-DEGG_SM_CLIENT_BACKEND_XSMP			\
 	-I$(top_srcdir) 				\
 	-I$(top_srcdir)/widgets				\
 	$(SOUP_CFLAGS)					\
 	$(RHYTHMBOX_CFLAGS)
 
-librb_la_LIBADD = $(SOUP_LIBS)
+librb_la_LIBADD = $(SOUP_LIBS) -lSM -lICE
 
 BUILT_SOURCES=
 
diff --git a/shell/main.c b/shell/main.c
index 988891b..9348b9b 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -53,9 +53,6 @@
 #include <gdk/gdkx.h> /* For _get_user_time... */
 #include <gtk/gtk.h>
 #include <glade/glade-init.h>
-#include <libgnome/gnome-program.h>
-#include <libgnomeui/gnome-ui-init.h>
-#include <libgnomeui/gnome-app-helper.h>
 
 #include <gst/gst.h>
 
@@ -73,6 +70,8 @@
 #include "rb-util.h"
 #include "eel-gconf-extensions.h"
 #include "rb-util.h"
+#include "eggdesktopfile.h"
+#include "eggsmclient.h"
 
 #include <dbus/dbus-glib.h>
 #include "rb-shell-glue.h"
@@ -80,7 +79,6 @@
 #include "rb-playlist-manager.h"
 #include "rb-playlist-manager-glue.h"
 
-#define HAVE_LIBGNOME_GOPTION defined(GNOME_PARAM_GOPTION_CONTEXT)
 
 static gboolean debug           = FALSE;
 static char *debug_match        = NULL;
@@ -102,12 +100,12 @@ static void main_shell_weak_ref_cb (gpointer data, GObject *objptr);
 int
 main (int argc, char **argv)
 {
-	GnomeProgram *program = NULL;
 	DBusGConnection *session_bus;
 	GError *error = NULL;
 	RBShell *rb_shell;
-	char **new_argv;
 	gboolean activated;
+	char *accel_map_file = NULL;
+	char *desktop_file_path;
 
 	GOptionContext *context;
 	static const GOptionEntry options []  = {
@@ -124,47 +122,39 @@ main (int argc, char **argv)
 	};
 
 	g_thread_init (NULL);
+	gtk_init (&argc, &argv);		/* does this really go here? */
 
 	rb_profile_start ("starting rhythmbox");
 
+#ifdef USE_UNINSTALLED_DIRS
+	desktop_file_path = g_build_filename (SHARE_UNINSTALLED_BUILDDIR, "rhythmbox.desktop", NULL);
+#else
+	desktop_file_path = g_build_filename (DATADIR, "applications", "rhythmbox.desktop", NULL);
+#endif
+	egg_set_desktop_file (desktop_file_path);
+	g_free (desktop_file_path);
+
 	context = g_option_context_new (NULL);
 	g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);
 
-	/* Disable event sounds for now by passing "--disable-sound" to libgnomeui.
-	 * See: http://bugzilla.gnome.org/show_bug.cgi?id=119222 */
-	new_argv = g_strdupv (argv);
-	new_argv = g_realloc (new_argv, (argc+2)*sizeof(char*));
-	new_argv[argc] = g_strdup ("--disable-sound");
-	new_argv[argc+1] = NULL;
-
 	rb_profile_start ("initializing gstreamer");
 	g_option_context_add_group (context, gst_init_get_option_group ());
 	rb_profile_end ("initializing gstreamer");
 
+	g_option_context_add_group (context, egg_sm_client_get_option_group ());
+
 	gtk_set_locale ();
-	rb_profile_start ("initializing gnome program");
-
-	g_set_application_name (_("Rhythmbox"));
-#if HAVE_LIBGNOME_GOPTION
-	program = gnome_program_init (PACKAGE, VERSION,
-				      LIBGNOMEUI_MODULE,
-				      argc+1, new_argv,
-				      GNOME_PARAM_GOPTION_CONTEXT, context,
-				      GNOME_PARAM_HUMAN_READABLE_NAME, _("Rhythmbox"),
-				      GNOME_PARAM_APP_DATADIR, DATADIR,
-				      NULL);
-#else
-	g_option_context_parse (context, &argc, &argv, NULL);
-	g_option_context_free (context);
-	program = gnome_program_init (PACKAGE, VERSION,
-				      LIBGNOMEUI_MODULE,
-				      argc+1, new_argv,
-				      GNOME_PARAM_HUMAN_READABLE_NAME, _("Rhythmbox"),
-				      GNOME_PARAM_APP_DATADIR, DATADIR,
-				      NULL);
-#endif
 
-	rb_profile_end ("initializing gnome program");
+	rb_profile_start ("parsing command line options");
+	if (g_option_context_parse (context, &argc, &argv, &error) == FALSE) {
+		g_print (_("%s\nRun '%s --help' to see a full list of available command line options.\n"),
+			 error->message, argv[0]);
+		g_error_free (error);
+		g_option_context_free (context);
+		exit (1);
+	}
+	g_option_context_free (context);
+	rb_profile_end ("parsing command line options");
 
 	g_random_set_seed (time (0));
 
@@ -263,13 +253,20 @@ main (int argc, char **argv)
 		rb_file_helpers_init (FALSE);
 #endif
 
-		rb_debug ("Going to create a new shell");
+		/* XXX not sure what to do with this.  should we move it to
+		 * the config dir, or leave it where it is?
+		 */
+		accel_map_file = g_build_filename (g_get_home_dir (),
+						   ".gnome2",
+						   "accels",
+						   "rhythmbox",
+						   NULL);
+		gtk_accel_map_load (accel_map_file);
 
-		glade_gnome_init ();
 
-		rb_stock_icons_init ();
+		rb_debug ("Going to create a new shell");
 
-		gtk_window_set_default_icon_name ("rhythmbox");
+		rb_stock_icons_init ();
 
 		g_setenv ("PULSE_PROP_media.role", "music", TRUE);
 
@@ -348,13 +345,13 @@ main (int argc, char **argv)
 
 	gst_deinit ();
 
-	g_strfreev (new_argv);
-
 	rb_debug ("THE END");
 	rb_profile_end ("starting rhythmbox");
-	g_object_unref (program);
 
-	gnome_accelerators_sync ();
+	if (accel_map_file != NULL) {
+		gtk_accel_map_save (accel_map_file);
+	}
+
 	gdk_threads_leave ();
 
 	exit (0);
diff --git a/shell/rb-shell-preferences.c b/shell/rb-shell-preferences.c
index c1c9872..2731db7 100644
--- a/shell/rb-shell-preferences.c
+++ b/shell/rb-shell-preferences.c
@@ -56,10 +56,6 @@
 #include <gtk/gtk.h>
 #include <glade/glade.h>
 
-#if !GTK_CHECK_VERSION(2,13,1)
-#include <libgnome/gnome-help.h>
-#endif
-
 #include "rb-file-helpers.h"
 #include "rb-shell-preferences.h"
 #include "rb-source.h"
@@ -157,14 +153,10 @@ help_cb (GtkWidget *widget,
 {
 	GError *error = NULL;
 
-#if GTK_CHECK_VERSION(2,13,1)
 	gtk_show_uri (gtk_widget_get_screen (widget),
-		      "ghelp:rhythmbox",
+		      "ghelp:rhythmbox?prefs",
 		      gtk_get_current_event_time (),
 		      &error);
-#else
-	gnome_help_display ("rhythmbox.xml", "prefs", &error);
-#endif
 
 	if (error != NULL) {
 		rb_error_dialog (NULL,
diff --git a/shell/rb-shell.c b/shell/rb-shell.c
index 817d633..d9e8f4f 100644
--- a/shell/rb-shell.c
+++ b/shell/rb-shell.c
@@ -47,11 +47,6 @@
 #include <X11/XF86keysym.h>
 #endif /* HAVE_MMKEYS */
 
-#if !GTK_CHECK_VERSION(2,13,1)
-#include <libgnome/libgnome.h>
-#endif
-#include <libgnomeui/gnome-client.h>
-
 #include "rb-shell.h"
 #include "rb-debug.h"
 #include "rb-dialog.h"
@@ -92,6 +87,8 @@
 #include "rb-marshal.h"
 #include "rb-missing-plugins.h"
 
+#include "eggsmclient.h"
+
 #define PLAYING_ENTRY_NOTIFY_TIME 4
 
 static void rb_shell_class_init (RBShellClass *klass);
@@ -240,13 +237,6 @@ static gboolean tray_destroy_cb (GtkObject *object, RBShell *shell);
 static void rb_shell_construct_notify_titles (RBShell *shell,
 					      RhythmDBEntry *entry);
 
-static gboolean save_yourself_cb (GnomeClient *client,
-                                  gint phase,
-                                  GnomeSaveStyle save_style,
-                                  gboolean shutdown,
-                                  GnomeInteractStyle interact_style,
-                                  gboolean fast,
-                                  RBShell *shell);
 static void paned_size_allocate_cb (GtkWidget *widget,
 				    GtkAllocation *allocation,
 				    RBShell *shell);
@@ -260,7 +250,6 @@ static void rb_shell_player_volume_changed_cb (RBShellPlayer *player,
 					       GParamSpec *arg,
 					       RBShell *shell);
 
-static void session_die_cb (GnomeClient *client, RBShell *shell);
 static void rb_shell_session_init (RBShell *shell);
 
 enum
@@ -981,12 +970,7 @@ rb_shell_new (gboolean no_registration,
 static GMountOperation *
 rb_shell_create_mount_op_cb (RhythmDB *db, RBShell *shell)
 {
-	/* create a gtk mount operation if possible, otherwise don't use one at all */
-#if GTK_CHECK_VERSION(2,13,1)
 	return gtk_mount_operation_new (GTK_WINDOW (shell->priv->window));
-#else
-	return NULL;
-#endif
 }
 
 static void
@@ -2381,14 +2365,10 @@ rb_shell_cmd_contents (GtkAction *action,
 {
 	GError *error = NULL;
 
-#if GTK_CHECK_VERSION(2,13,1)
 	gtk_show_uri (gtk_widget_get_screen (shell->priv->window),
 		      "ghelp:rhythmbox",
 		      gtk_get_current_event_time (),
 		      &error);
-#else
-	gnome_help_display ("rhythmbox.xml", NULL, &error);
-#endif
 
 	if (error != NULL) {
 		rb_error_dialog (NULL, _("Couldn't display help"),
@@ -3178,14 +3158,6 @@ rb_shell_do_notify (RBShell *shell, gboolean requested, GError **error)
 	return TRUE;
 }
 
-static void
-session_die_cb (GnomeClient *client,
-                RBShell *shell)
-{
-        rb_debug ("session die");
-        rb_shell_quit (shell, NULL);
-}
-
 GQuark
 rb_shell_error_quark (void)
 {
@@ -3196,36 +3168,31 @@ rb_shell_error_quark (void)
 	return quark;
 }
 
-static gboolean
-save_yourself_cb (GnomeClient *client,
-                  gint phase,
-                  GnomeSaveStyle save_style,
-                  gboolean shutdown,
-                  GnomeInteractStyle interact_style,
-                  gboolean fast,
-                  RBShell *shell)
-{
-        rb_debug ("session save yourself");
+static void
+session_save_state_cb (EggSMClient *client,
+		       GKeyFile *key_file,
+		       RBShell *shell)
+{
+	rb_debug ("session save-state");
 	rb_shell_sync_state (shell);
-        return TRUE;
 }
 
 static void
-rb_shell_session_init (RBShell *shell)
+session_quit_cb (EggSMClient *client,
+		 RBShell *shell)
 {
-        GnomeClient *client;
-
-        client = gnome_master_client ();
+	rb_debug ("session quit");
+	rb_shell_quit (shell, NULL);
+}
 
-        g_signal_connect_object (G_OBJECT (client),
-				 "save_yourself",
-				 G_CALLBACK (save_yourself_cb),
-				 shell, 0);
+static void
+rb_shell_session_init (RBShell *shell)
+{
+	EggSMClient *sm_client;
 
-        g_signal_connect_object (G_OBJECT (client),
-				 "die",
-				 G_CALLBACK (session_die_cb),
-				 shell, 0);
+	sm_client = egg_sm_client_get ();
+	g_signal_connect (sm_client, "save-state", G_CALLBACK (session_save_state_cb), shell);
+	g_signal_connect (sm_client, "quit", G_CALLBACK (session_quit_cb), shell);
 }
 
 RBSource *
