=== modified file 'Makefile.am'
--- Makefile.am	
+++ Makefile.am	
@@ -1,4 +1,4 @@
-SUBDIRS = po data src tests help
+SUBDIRS = po data libguniqueapp src tests help
 
 INTLTOOL_BUILT = \
         intltool-extract \
=== modified file 'configure.in'
--- configure.in	
+++ configure.in	
@@ -92,6 +92,29 @@ else
         AC_MSG_WARN([taglib not found, cannot handle missing id3mux])
 fi
 
+GTK_RECCOMENDED=2.12.0
+DBUS_GLIB_REQUIRED=0.33
+
+if $PKG_CONFIG --atleast-version $GTK_RECCOMENDED gtk+-2.0; then
+   have_recent_gtk=yes
+else
+   have_recent_gtk=no
+   AC_DEFINE(OLDER_GTK_VERSION, , [Building with GTK+ older than 2.12]) 
+fi
+
+if $PKG_CONFIG --atleast-version $DBUS_GLIB_REQUIRED dbus-glib-1; then
+   have_dbus=yes
+   PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= $DBUS_GLIB_REQUIRED)
+   AC_SUBST(DBUS_CFLAGS)
+   AC_SUBST(DBUS_LIBS)
+   AC_DEFINE(HAVE_DBUS, , [Building with DBus support]) 
+   AC_PATH_PROG(DBUS_BINDING_TOOL, dbus-binding-tool)
+else
+   have_dbus=no
+fi
+
+AM_CONDITIONAL([HAVE_DBUS], [test $have_dbus = yes])
+
 # Find how and where to put the GConf schemas
 AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
 if test x"$GCONFTOOL" = xno; then
@@ -128,6 +151,8 @@ AC_ARG_ENABLE(debug,
 SCROLLKEEPER_BUILD_REQUIRED=0.3.5
 AC_SUBST(SCROLLKEEPER_BUILD_REQUIRED)
 
+AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
+
 
 # Finally, generate the files
 AC_OUTPUT([
@@ -137,6 +162,7 @@ help/Makefile
 help/sound-juicer/Makefile
 data/Makefile
 po/Makefile.in
+libguniqueapp/Makefile
 src/Makefile
 tests/Makefile
 ])
=== modified file 'src/Makefile.am'
--- src/Makefile.am	
+++ src/Makefile.am	
@@ -13,7 +13,8 @@ AM_CPPFLAGS = \
 	-DPIXMAPDIR=\""$(datadir)/pixmaps"\" \
 	-DPKGDATADIR=\""$(datadir)/sound-juicer"\" \
 	@MUSICBRAINZ_CFLAGS@ @GSTREAMER_CFLAGS@ \
-	@MEDIA_PROFILES_CFLAGS@ @BURN_CFLAGS@ @UI_CFLAGS@
+	@MEDIA_PROFILES_CFLAGS@ @BURN_CFLAGS@ @UI_CFLAGS@ \
+	-I../libguniqueapp
 
 if HAVE_TAGLIB
 AM_CPPFLAGS += @TAGLIB_CFLAGS@
@@ -59,24 +60,25 @@ sound_juicer_SOURCES = \
 	gconf-bridge.c \
 	bacon-volume.c \
 	bacon-volume.h \
-	$(BACON_FILES) \
 	$(ID3MUX_FILES) \
 	$(MARSHALFILES)
 
-sound_juicer_LDFLAGS = @MUSICBRAINZ_LIBS@ @MEDIA_PROFILES_LIBS@ @GSTREAMER_LIBS@ @BURN_LIBS@ @UI_LIBS@
+sound_juicer_LDFLAGS = @MUSICBRAINZ_LIBS@ @MEDIA_PROFILES_LIBS@ @GSTREAMER_LIBS@ @BURN_LIBS@ @UI_LIBS@ ../libguniqueapp/libguniqueapp.la
 if HAVE_CDIO
 sound_juicer_LDFLAGS += @CDIO_LIBS@
 endif
 if HAVE_TAGLIB
 sound_juicer_LDFLAGS += @TAGLIB_LIBS@ -lgsttag-0.10
 endif
+if HAVE_DBUS
+sound_juicer_LDFLAGS += @DBUS_LIBS@
+endif
 
 #
 # Build the GValue marshals
 #
 
 MARSHALFILES = sj-metadata-marshal.h sj-metadata-marshal.c
-GLIB_GENMARSHAL =`pkg-config --variable=glib_genmarshal glib-2.0`
 
 sj-metadata-marshal.h: sj-metadata-marshal.list
 	( $(GLIB_GENMARSHAL) --prefix=metadata_marshal $< \
@@ -95,9 +97,3 @@ sj-metadata-marshal.c: sj-metadata-marsh
 BUILT_SOURCES = $(MARSHALFILES)
 CLEANFILES = $(BUILT_SOURCES)
 EXTRA_DIST = sj-metadata-marshal.list
-
-BACON_DIR=$(srcdir)/../../libbacon/src/
-BACON_FILES=bacon-message-connection.h bacon-message-connection.c
-
-regenerate-built-sources:
-	BACONFILES="$(BACON_FILES)" BACONDIR="$(BACON_DIR)" $(top_srcdir)/src/update-from-bacon.sh
=== modified file 'src/sj-main.c'
--- src/sj-main.c	
+++ src/sj-main.c	
@@ -37,8 +37,8 @@
 #include <libgnomevfs/gnome-vfs-utils.h>
 #include <profiles/gnome-media-profiles.h>
 #include <gst/gst.h>
+#include <guniqueapp.h>
 
-#include "bacon-message-connection.h"
 #include "gconf-bridge.h"
 #include "sj-about.h"
 #include "sj-metadata.h"
@@ -74,7 +74,6 @@ static GtkWidget *status_bar;
 static GtkWidget *extract_menuitem, *play_menuitem, *next_menuitem, *prev_menuitem, *select_all_menuitem, *deselect_all_menuitem;
 static GtkWidget *submit_menuitem;
 GtkListStore *track_store;
-static BaconMessageConnection *connection;
 GtkCellRenderer *toggle_renderer, *title_renderer, *artist_renderer;
 
 const char *base_uri, *path_pattern, *file_pattern;
@@ -94,7 +93,6 @@ gboolean autostart = FALSE, autoplay = F
 static GList *cdroms = NULL;
 
 #define DEFAULT_PARANOIA 4
-#define RAISE_WINDOW "raise-window"
 #define SOURCE_GLADE "../data/sound-juicer.glade"
 #define INSTALLED_GLADE DATADIR"/sound-juicer/sound-juicer.glade"
 
@@ -1211,18 +1209,18 @@ upgrade_gconf (void)
 }
 
 static void
-on_message_received (const char *message, gpointer user_data)
+on_message_received (GUniqueApp *app, GUniqueAppCommand command, gchar* data, gchar* startup_id, guint workspace, gpointer user_data)
 {
-  if (message == NULL)
-    return;
-  if (strcmp (RAISE_WINDOW, message) == 0) {
-    gtk_window_present (GTK_WINDOW (main_window));
+  if (command == G_UNIQUE_APP_ACTIVATE) {
+    gtk_window_set_startup_id (GTK_WINDOW (main_window), startup_id);
   }
 }
 
 int main (int argc, char **argv)
 {
   GnomeProgram *program;
+  GUniqueApp *app;
+  gchar* startup_id = NULL;
   GError *error = NULL;
   GtkTreeSelection *selection;
   char *device = NULL;
@@ -1233,6 +1231,10 @@ int main (int argc, char **argv)
     { "device", 'd', 0, G_OPTION_ARG_FILENAME, &device, N_("What CD device to read"), N_("DEVICE") },
     { NULL }
   };
+  
+#ifdef OLDER_GTK_VERSION
+  startup_id = g_getenv ("DESKTOP_STARTUP_ID");
+#endif
 
   bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
   bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
@@ -1256,14 +1258,19 @@ int main (int argc, char **argv)
 
   gtk_window_set_default_icon_name ("sound-juicer");
   
-  connection = bacon_message_connection_new ("sound-juicer");
-  if (bacon_message_connection_get_is_server (connection) == FALSE) {
-	  bacon_message_connection_send (connection, RAISE_WINDOW);
-	  bacon_message_connection_free (connection);
-	  exit (0);
-  } else {
-    bacon_message_connection_set_callback (connection, on_message_received, NULL);
+  app = g_unique_app_get_with_startup_id ("sound-juicer", startup_id);
+
+  if (g_unique_app_is_running (app)) {		
+    g_unique_app_activate (app);
+    
+#ifdef OLDER_GTK_VERSION
+    gdk_notify_startup_complete (); 
+#endif
+	
+    g_object_unref (app);
+    exit(1);
   }
+  else g_signal_connect (G_OBJECT (app), "message", (GCallback) on_message_received, NULL);
 
   metadata = SJ_METADATA (sj_metadata_musicbrainz_new ());
   error = sj_metadata_get_new_error (metadata);
@@ -1464,6 +1471,7 @@ int main (int argc, char **argv)
   g_object_unref (metadata);
   g_object_unref (extractor);
   g_object_unref (gconf_client);
-  g_object_unref (program);
+  g_object_unref (app);
+  g_object_unref (program); 
   return 0;
 }
