diff -u -u -r1.221 configure.ac
--- configure.ac	27 Mar 2006 02:17:13 -0000	1.221
+++ configure.ac	27 Mar 2006 05:40:18 -0000
@@ -228,7 +228,7 @@
 dnl DAAP (iTunes Music Shares)
 AC_ARG_ENABLE(daap,
 	      AC_HELP_STRING([--enable-daap],
-			     [Enable Digital Audio Access Protocol (music sharing) in rhythmbox **EXPERIMENTAL**]))
+			     [Enable Digital Audio Access Protocol (music sharing) in rhythmbox]))
 
 AC_ARG_WITH(mdns,
    AC_HELP_STRING([--with-mdns=auto|howl|avahi],
@@ -855,6 +855,7 @@
 plugins/Makefile
 plugins/sample/Makefile
 plugins/audioscrobbler/Makefile
+plugins/daap/Makefile
 plugins/sample-python/Makefile
 plugins/pythonconsole/Makefile
 bindings/Makefile
diff -u -u -r1.1 rb-proxy-config.c
--- lib/rb-proxy-config.c	20 Mar 2006 09:29:52 -0000	1.1
+++ lib/rb-proxy-config.c	27 Mar 2006 05:40:19 -0000
@@ -20,6 +20,9 @@
 
 #include "config.h"
 
+#include <libsoup/soup.h>
+#include <libsoup/soup-uri.h>
+
 #include "rb-proxy-config.h"
 #include "eel-gconf-extensions.h"
 #include "rb-debug.h"
@@ -195,10 +198,10 @@
 	}
 }
 
-#if defined(HAVE_LIBSOUP)
-SoupUri *
+gpointer
 rb_proxy_config_get_libsoup_uri (RBProxyConfig *config)
 {
+#if defined(HAVE_LIBSOUP)
 	SoupUri *uri = NULL;
 
 	if (!config->enabled)
@@ -215,6 +218,8 @@
 	}
 
 	return uri;
-}
+#else
+	return NULL;
 #endif
+}
 
diff -u -u -r1.1 rb-proxy-config.h
--- lib/rb-proxy-config.h	20 Mar 2006 09:29:52 -0000	1.1
+++ lib/rb-proxy-config.h	27 Mar 2006 05:40:19 -0000
@@ -23,11 +23,6 @@
 #include <glib.h>
 #include <glib-object.h>
 
-#if defined(HAVE_LIBSOUP)
-#include <libsoup/soup.h>
-#include <libsoup/soup-uri.h>
-#endif
-
 G_BEGIN_DECLS
 
 #define RB_TYPE_PROXY_CONFIG			(rb_proxy_config_get_type ())
@@ -65,9 +60,8 @@
 
 RBProxyConfig *	rb_proxy_config_new (void);
 
-#if defined(HAVE_LIBSOUP)
-SoupUri *	rb_proxy_config_get_libsoup_uri (RBProxyConfig *config);
-#endif
+/* returns SoupUri* */
+gpointer	rb_proxy_config_get_libsoup_uri (RBProxyConfig *config);
 
 #endif	/* RB_PROXY_CONFIG_H */
 
diff -u -u -r1.14 Makefile.am
--- player/Makefile.am	21 Mar 2006 06:56:34 -0000	1.14
+++ player/Makefile.am	27 Mar 2006 05:40:20 -0000
@@ -25,15 +25,9 @@
 	-I$(top_srcdir)/shell				\
 	-I$(top_srcdir)/rhythmdb			\
 	-I$(top_srcdir)/widgets				\
-	-I$(top_srcdir)/daapsharing			\
 	-I$(top_builddir)/lib                           \
 	$(LIBNAUTILUS_BURN_CFLAGS)			\
 	$(RHYTHMBOX_CFLAGS)
-
-
-if USE_DAAP
-INCLUDES += -I$(top_srcdir)/daapsharing			
-endif
 
 
 BUILT_SOURCES = rb-recorder-marshal.c rb-recorder-marshal.h
diff -u -u -r1.58 rb-player-gst.c
--- player/rb-player-gst.c	23 Feb 2006 03:54:50 -0000	1.58
+++ player/rb-player-gst.c	27 Mar 2006 05:40:20 -0000
@@ -40,10 +40,6 @@
 #include "rb-debug.h"
 #include "rb-marshal.h"
 
-#ifdef WITH_DAAP_SUPPORT
-#include "rb-daap-src.h"
-#endif
-
 G_DEFINE_TYPE(RBPlayer, rb_player, G_TYPE_OBJECT)
 
 static void rb_player_finalize (GObject *object);
@@ -1003,24 +999,6 @@
 	}
 #endif
 
-#ifdef WITH_DAAP_SUPPORT
-	/* FIXME?
-	 * This is sorta hack/sorta best way to do it.
-	 * If we set up the daapsrc to do regular GStreamer seeking,
-	 * GStreamer goes ape-shit and tries to seek all over the 
-	 * place (typefinding), which can cause iTunes to return errors
-	 * (probably cause we're requesting the same file too often)
- 	 *
-	 * So, we do it this way.  Doesn't that suck?
-	 */
-	if (mp->priv->uri && g_strncasecmp (mp->priv->uri, "daap://", 7) == 0) {
-		GstElement *src;
-
-		g_object_get (G_OBJECT (mp->priv->playbin), "source", &src, NULL);
-		if (src)
-			rb_daap_src_set_time (src, time);
-	} else {
-#endif
 #ifdef HAVE_GSTREAMER_0_8
 	gst_element_seek (mp->priv->playbin, 
 			  GST_FORMAT_TIME 
@@ -1034,9 +1012,6 @@
 			  GST_SEEK_TYPE_NONE, -1);
 #endif
 	
-#ifdef WITH_DAAP_SUPPORT
-	}
-#endif
 	if (mp->priv->playing) {
 		gst_element_set_state (mp->priv->playbin, GST_STATE_PLAYING);
 	}
@@ -1058,21 +1033,6 @@
 #endif
 		if (position != -1)
 			position /= GST_SECOND;
-
-		/* FIXME whether this is a good idea or not depends on gstreamer version 
-		 * and filetype.  ugh.  for now, disabling it with gstreamer 0.8 seems to 
-		 * give the best results.
-		 */
-#ifdef HAVE_GSTREAMER_0_8
-#ifdef WITH_DAAP_SUPPORT
-		if (mp->priv->uri && g_strncasecmp (mp->priv->uri, "daap://", 7) == 0) {
-			GstElement *src;
-			g_object_get (G_OBJECT (mp->priv->playbin), "source", &src, NULL);
-			if (src) 
-				position += rb_daap_src_get_time (src);
-		}
-#endif
-#endif
 
 		return (long) position;
 	} else
diff -u -u -r1.2 Makefile.am
--- plugins/Makefile.am	19 Mar 2006 22:39:40 -0000	1.2
+++ plugins/Makefile.am	27 Mar 2006 05:40:20 -0000
@@ -6,6 +6,10 @@
 SUBDIRS += audioscrobbler
 endif
 
+if USE_DAAP
+SUBDIRS += daap
+endif
+
 if ENABLE_PYTHON
 SUBDIRS += pythonconsole sample-python
 endif
@@ -50,7 +54,6 @@
 	rb-python-plugin.h	
 
 INCLUDES += \
-	$(NO_STRICT_ALIASING_CFLAGS)	\
 	$(PYGTK_CFLAGS)			\
 	$(PYTHON_CFLAGS)
 endif
diff -u -u -r1.74 Makefile.am
--- shell/Makefile.am	21 Mar 2006 08:42:04 -0000	1.74
+++ shell/Makefile.am	27 Mar 2006 05:40:21 -0000
@@ -120,18 +120,6 @@
 rhythmbox_LDADD += $(IPOD_LIBS)
 endif
 
-if USE_DAAP
-INCLUDES += -I$(top_srcdir)/daapsharing
-
-rhythmbox_LDADD += $(MDNS_LIBS) \
-		   $(top_builddir)/daapsharing/libdaapsharing.la
-endif
-
-if USE_LIBSOUP
-rhythmbox_LDADD += $(SOUP_LIBS)
-INCLUDES += $(SOUP_CFLAGS)
-endif
-
 if USE_NOTIFY
 rhythmbox_LDADD += $(NOTIFY_LIBS)
 INCLUDES += $(NOTIFY_CFLAGS)
diff -u -u -r1.16 rb-audioscrobbler.c
--- shell/rb-audioscrobbler.c	25 Mar 2006 03:37:22 -0000	1.16
+++ shell/rb-audioscrobbler.c	27 Mar 2006 05:40:22 -0000
@@ -629,12 +629,15 @@
 	if (!audioscrobbler->priv->soup_session) {
 		SoupUri *uri;
 		
-		uri = rb_proxy_config_get_libsoup_uri (audioscrobbler->priv->proxy_config);
-		audioscrobbler->priv->soup_session = soup_session_async_new_with_options (
-					"proxy-uri", uri,
-					NULL);
-		if (uri)
+		uri = (SoupUri*)rb_proxy_config_get_libsoup_uri (audioscrobbler->priv->proxy_config);
+		if (uri) {
+			audioscrobbler->priv->soup_session = soup_session_async_new_with_options (
+						"proxy-uri", uri,
+						NULL);
 			soup_uri_free (uri);
+		} else {
+			audioscrobbler->priv->soup_session = soup_session_async_new ();
+		}
 	}
 	
 	soup_session_queue_message (audioscrobbler->priv->soup_session,
@@ -881,10 +884,10 @@
 rb_audioscrobbler_proxy_config_changed_cb (RBProxyConfig *config,
 					   RBAudioscrobbler *audioscrobbler)
 {
-	SoupUri *uri;
-
 	if (audioscrobbler->priv->soup_session) {
-		uri = rb_proxy_config_get_libsoup_uri (config);
+		SoupUri *uri;
+
+		uri = (SoupUri*)rb_proxy_config_get_libsoup_uri (config);
 		g_object_set (G_OBJECT (audioscrobbler->priv->soup_session),
 					"proxy-uri", uri,
 					NULL);
diff -u -u -r1.57 rb-shell-preferences.c
--- shell/rb-shell-preferences.c	18 Feb 2006 06:56:17 -0000	1.57
+++ shell/rb-shell-preferences.c	27 Mar 2006 05:40:23 -0000
@@ -245,158 +245,6 @@
 	rb_shell_preferences_append_page (prefs, name, widget);
 }
 
-#ifdef WITH_DAAP_SUPPORT
-
-static void
-share_check_button_toggled_cb (GtkToggleButton *button,
-			       GtkWidget *widget)
-{
-	gboolean b;
-
-	b = gtk_toggle_button_get_active (button);
-
-	eel_gconf_set_boolean (CONF_DAAP_ENABLE_SHARING, b);
-
-	gtk_widget_set_sensitive (widget, b);
-	
-	return;
-}
-
-static void
-password_check_button_toggled_cb (GtkToggleButton *button,
-				  GtkWidget *widget)
-{
-	gboolean b;
-
-	b = gtk_toggle_button_get_active (button);
-
-	eel_gconf_set_boolean (CONF_DAAP_REQUIRE_PASSWORD, b);
-
-	gtk_widget_set_sensitive (widget, b);
-	
-	return;
-}
-
-static gboolean
-share_name_entry_focus_out_event_cb (GtkEntry *entry,
-				     GdkEventFocus *event,
-				     gpointer data)
-{
-	gboolean    changed;
-	const char *name;
-	char       *old_name;
-
-	name = gtk_entry_get_text (entry);
-	old_name = eel_gconf_get_string (CONF_DAAP_SHARE_NAME);
-
-	if (name == NULL && old_name == NULL) {
-		changed = FALSE;
-	} else if (name == NULL || old_name == NULL) {
-		changed = TRUE;
-	} else if (strcmp (name, old_name) != 0) {
-		changed = TRUE;
-	} else {
-		changed = FALSE;
-	}
-
-	if (changed) {
-		eel_gconf_set_string (CONF_DAAP_SHARE_NAME, name);
-	}
-
-	g_free (old_name);
-
-	return FALSE;
-}
-
-static gboolean
-share_password_entry_focus_out_event_cb (GtkEntry *entry,
-					 GdkEventFocus *event,
-					 gpointer data)
-{
-	gboolean    changed;
-	const char *pw;
-	char       *old_pw;
-
-	pw = gtk_entry_get_text (entry);
-	old_pw = eel_gconf_get_string (CONF_DAAP_SHARE_PASSWORD);
-
-	if (pw == NULL && old_pw == NULL) {
-		changed = FALSE;
-	} else if (pw == NULL || old_pw == NULL) {
-		changed = TRUE;
-	} else if (strcmp (pw, old_pw) != 0) {
-		changed = TRUE;
-	} else {
-		changed = FALSE;
-	}
-
-	if (changed) {
-		eel_gconf_set_string (CONF_DAAP_SHARE_PASSWORD, pw);
-	}
-
-	g_free (old_pw);
-
-	return FALSE;
-}
-
-static void
-add_daap_preferences (RBShellPreferences *shell_preferences)
-{
-	GladeXML *xml;
-	GtkWidget *check;
-	GtkWidget *name_entry;
-	GtkWidget *password_entry;
-	GtkWidget *password_check;
-	GtkWidget *box;
-	gboolean sharing_enabled;
-	gboolean require_password;
-
-	char *name;
-	char *password;
-
-	xml = rb_glade_xml_new ("daap-prefs.glade",
-				"daap_vbox",
-				shell_preferences);
-
-	check = glade_xml_get_widget (xml, "daap_enable_check");
-	password_check = glade_xml_get_widget (xml, "daap_password_check");
-	name_entry = glade_xml_get_widget (xml, "daap_name_entry");
-	password_entry = glade_xml_get_widget (xml, "daap_password_entry");
-	box = glade_xml_get_widget (xml, "daap_box");
-	
-	sharing_enabled = eel_gconf_get_boolean (CONF_DAAP_ENABLE_SHARING);
-	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), sharing_enabled);
-	g_signal_connect (check, "toggled", G_CALLBACK (share_check_button_toggled_cb), box);
-
-	require_password = eel_gconf_get_boolean (CONF_DAAP_REQUIRE_PASSWORD);
-	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (password_check), require_password);
-	g_signal_connect (password_check, "toggled", G_CALLBACK (password_check_button_toggled_cb), password_entry);
-	
-	name = eel_gconf_get_string (CONF_DAAP_SHARE_NAME);
-	if (name != NULL) {
-		gtk_entry_set_text (GTK_ENTRY (name_entry), name);
-	}
-	g_free (name);
-	g_signal_connect (name_entry, "focus-out-event",
-			  G_CALLBACK (share_name_entry_focus_out_event_cb), NULL);	
-
-	password = eel_gconf_get_string (CONF_DAAP_SHARE_PASSWORD);
-	if (password != NULL) {
-		gtk_entry_set_text (GTK_ENTRY (password_entry), password);
-	}
-	g_free (password);
-	g_signal_connect (password_entry, "focus-out-event",
-			  G_CALLBACK (share_password_entry_focus_out_event_cb), NULL);	
-
-	gtk_widget_set_sensitive (box, sharing_enabled);
-	gtk_widget_set_sensitive (password_entry, require_password);
-
-	gtk_notebook_append_page (GTK_NOTEBOOK (shell_preferences->priv->notebook),
-				  glade_xml_get_widget (xml, "daap_vbox"),
-				  gtk_label_new (_("Sharing")));
-}
-#endif /* WITH_DAAP_SUPPORT */
-
 GtkWidget *
 rb_shell_preferences_new (GList *views)
 {
@@ -416,10 +264,6 @@
 						       name,
 						       RB_SOURCE (views->data));
 	}
-
-#ifdef WITH_DAAP_SUPPORT
-	add_daap_preferences (shell_preferences);
-#endif /* WITH_DAAP_SUPPORT */
 
 	return GTK_WIDGET (shell_preferences);
 }
diff -u -u -r1.415 rb-shell.c
--- shell/rb-shell.c	22 Mar 2006 11:40:44 -0000	1.415
+++ shell/rb-shell.c	27 Mar 2006 05:40:24 -0000
@@ -73,10 +73,6 @@
 #include "rb-library-source.h"
 #include "rb-podcast-source.h"
 #include "totem-pl-parser.h"
-#ifdef WITH_DAAP_SUPPORT
-#include "rb-daap-source.h"
-#include "rb-daap-sharing.h"
-#endif /* WITH_DAAP_SUPPORT */
 #include "rb-iradio-source.h"
 #include "rb-shell-preferences.h"
 #include "rb-playlist-source.h"
@@ -1223,11 +1219,6 @@
 	g_signal_connect_object (G_OBJECT (shell->priv->playlist_manager), "playlist_created",
 				 G_CALLBACK (rb_shell_playlist_created_cb), shell, 0);
 
-#ifdef WITH_DAAP_SUPPORT
-	rb_daap_sources_init (shell);
-	rb_daap_sharing_init (shell);
-#endif
-
 	/* Initialize removable media manager */
 	rb_debug ("shell: creating removable media manager");
 	shell->priv->removable_media_manager = rb_removable_media_manager_new (shell,
@@ -2305,11 +2296,7 @@
 	rb_plugins_engine_shutdown ();
 
 	rb_podcast_source_shutdown (shell->priv->podcast_source);	
-	
-#ifdef WITH_DAAP_SUPPORT
-	rb_daap_sources_shutdown (shell);
-	rb_daap_sharing_shutdown (shell);
-#endif /* WITH_DAAP_SUPPORT */
+
 	rb_shell_shutdown (shell);
 	rb_shell_sync_state (shell);
 	g_object_unref (G_OBJECT (shell));
diff -u -u -r1.36 Makefile.am
--- sources/Makefile.am	2 Mar 2006 18:31:41 -0000	1.36
+++ sources/Makefile.am	27 Mar 2006 05:40:24 -0000
@@ -54,7 +54,6 @@
 	-I$(top_srcdir)/iradio				\
 	-I$(top_srcdir)/podcast				\
 	-I$(top_srcdir)/shell				\
-	-I$(top_srcdir)/daapsharing			\
 	-I$(top_srcdir)/metadata			\
 	-DPIXMAP_DIR=\""$(datadir)/pixmaps"\"		\
 	-DSHARE_DIR=\"$(pkgdatadir)\"                   \
@@ -84,15 +83,4 @@
 libsourcesimpl_la_SOURCES += $(hal_files)
 endif
 
-daap_files =				\
-	rb-daap-source.c		\
-	rb-daap-source.h
-if USE_DAAP
-libsourcesimpl_la_SOURCES += $(daap_files)
-endif
-
-if USE_LIBSOUP
-INCLUDES += $(SOUP_CFLAGS)
-endif
-
-EXTRA_DIST = $(ipod_files) $(hal_files) $(daap_files)
+EXTRA_DIST = $(ipod_files) $(hal_files)
--- /dev/null	2006-03-24 05:28:51.000000000 +1100
+++ plugins/daap/Makefile.am	2006-03-27 15:42:37.000000000 +1100
@@ -0,0 +1,50 @@
+plugindir = $(PLUGINDIR)
+plugin_LTLIBRARIES = libdaap.la
+
+libdaap_la_SOURCES = \
+	rb-daap-plugin.c			\
+	$(top_srcdir)/sources/rb-daap-source.c	\
+	$(top_srcdir)/sources/rb-daap-source.h
+	
+libdaap_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS)
+libdaap_la_LIBADD = 				\
+	$(top_builddir)/lib/librb.la			\
+	$(top_builddir)/daapsharing/libdaapsharing.la	\
+	$(SOUP_LIBS)					\
+	$(MDNS_LIBS)
+INCLUDES = 						\
+        -DGNOMELOCALEDIR=\""$(datadir)/locale"\"        \
+	-DG_LOG_DOMAIN=\"Rhythmbox\"		 	\
+	-I$(top_srcdir) 				\
+	-I$(top_srcdir)/lib                        	\
+	-I$(top_srcdir)/metadata                       	\
+	-I$(top_srcdir)/player                       	\
+	-I$(top_srcdir)/rhythmdb                       	\
+	-I$(top_srcdir)/widgets                    	\
+	-I$(top_srcdir)/sources                    	\
+	-I$(top_srcdir)/iradio                    	\
+	-I$(top_srcdir)/podcast                    	\
+	-I$(top_srcdir)/remote				\
+	-I$(top_builddir)/remote			\
+	-I$(top_srcdir)/plugins				\
+	-I$(top_srcdir)/shell				\
+	-I$(top_srcdir)/daapsharing			\
+	-DPIXMAP_DIR=\""$(datadir)/pixmaps"\"		\
+	-DSHARE_DIR=\"$(pkgdatadir)\"                   \
+	-DDATADIR=\""$(datadir)"\"			\
+	$(SOUP_CFLAGS)					\
+	$(MDNS_CFLAGS)					\
+	$(RHYTHMBOX_CFLAGS)				\
+	$(WARN_CFLAGS)					\
+	-D_XOPEN_SOURCE -D_BSD_SOURCE
+
+plugin_in_files = daap.rb-plugin.desktop.in
+
+%.rb-plugin: %.rb-plugin.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
+
+plugin_DATA = $(plugin_in_files:.rb-plugin.desktop.in=.rb-plugin)
+
+EXTRA_DIST = $(plugin_in_files)
+
+CLEANFILES = $(plugin_DATA)
+DISTCLEANFILES = $(plugin_DATA)
--- /dev/null	2006-03-24 05:28:51.000000000 +1100
+++ plugins/daap/daap.rb-plugin.desktop.in	2006-03-27 15:37:03.000000000 +1100
@@ -0,0 +1,8 @@
+[RB Plugin]
+Module=daap
+IAge=1
+_Name=DAAP Music Sharing
+_Description=
+Authors=Charles Schmidt  <cschmidt2@emich.edu>, the Rhythmbox Developers
+Copyright=Copyright © 2005-2006 Charles Schmidt, the Rhythmbox Developers
+Website=http://www.rhythmbox.org
--- /dev/null	2006-03-24 05:28:51.000000000 +1100
+++ plugins/daap/rb-daap-plugin.c	2006-03-27 16:14:42.000000000 +1100
@@ -0,0 +1,317 @@
+/*
+ * rb-daap-plugin.c
+ * 
+ * Copyright (C) 2006 James Livingston <jrl@ids.org.au>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+#include <glib/gi18n-lib.h>
+#include <gmodule.h>
+#include <gtk/gtk.h>
+#include <glib.h>
+#include <glib-object.h>
+
+#include "rb-plugin.h"
+#include "rb-debug.h"
+#include "rb-shell.h"
+#include "rb-dialog.h"
+#include "rb-glade-helpers.h"
+#include "eel-gconf-extensions.h"
+#include "rb-daap-source.h"
+#include "rb-daap-sharing.h"
+
+
+#define RB_TYPE_DAAP_PLUGIN		(rb_daap_plugin_get_type ())
+#define RB_DAAP_PLUGIN(o)		(G_TYPE_CHECK_INSTANCE_CAST ((o), RB_TYPE_DAAP_PLUGIN, RBDaapPlugin))
+#define RB_DAAP_PLUGIN_CLASS(k)	(G_TYPE_CHECK_CLASS_CAST((k), RB_TYPE_DAAP_PLUGIN, RBDaapPluginClass))
+#define RB_IS_DAAP_PLUGIN(o)		(G_TYPE_CHECK_INSTANCE_TYPE ((o), RB_TYPE_DAAP_PLUGIN))
+#define RB_IS_DAAP_PLUGIN_CLASS(k)	(G_TYPE_CHECK_CLASS_TYPE ((k), RB_TYPE_DAAP_PLUGIN))
+#define RB_DAAP_PLUGIN_GET_CLASS(o)	(G_TYPE_INSTANCE_GET_CLASS ((o), RB_TYPE_DAAP_PLUGIN, RBDaapPluginClass))
+
+typedef struct
+{
+	RBPlugin parent;
+
+	GtkWidget *preferences;
+	gboolean sharing;
+} RBDaapPlugin;
+
+typedef struct
+{
+	RBPluginClass parent_class;
+} RBDaapPluginClass;
+
+
+G_MODULE_EXPORT GType register_rb_plugin (GTypeModule *module);
+GType	rb_daap_plugin_get_type		(void) G_GNUC_CONST;
+
+
+
+static void rb_daap_plugin_init (RBDaapPlugin *plugin);
+static void rb_daap_plugin_finalize (GObject *object);
+static void impl_activate (RBPlugin *plugin, RBShell *shell);
+static void impl_deactivate (RBPlugin *plugin, RBShell *shell);
+static GtkWidget* impl_create_configure_dialog (RBPlugin *plugin);
+
+RB_PLUGIN_REGISTER(RBDaapPlugin, rb_daap_plugin)
+
+static void
+rb_daap_plugin_class_init (RBDaapPluginClass *klass)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (klass);
+	RBPluginClass *plugin_class = RB_PLUGIN_CLASS (klass);
+
+	object_class->finalize = rb_daap_plugin_finalize;
+
+	plugin_class->activate = impl_activate;
+	plugin_class->deactivate = impl_deactivate;
+	plugin_class->create_configure_dialog = impl_create_configure_dialog;
+}
+
+static void
+rb_daap_plugin_init (RBDaapPlugin *plugin)
+{
+	rb_debug ("RBDaapPlugin initialising");
+}
+
+static void
+rb_daap_plugin_finalize (GObject *object)
+{
+	RBDaapPlugin *plugin = RB_DAAP_PLUGIN (object);
+
+	rb_debug ("RBDaapPlugin finalising");
+
+	if (plugin->preferences)
+		gtk_widget_destroy (plugin->preferences);
+
+	G_OBJECT_CLASS (rb_daap_plugin_parent_class)->finalize (object);
+}
+
+
+
+static void
+impl_activate (RBPlugin *bplugin,
+	       RBShell *shell)
+{
+	RBDaapPlugin *plugin = RB_DAAP_PLUGIN (bplugin);
+	gboolean no_registration;
+
+	rb_daap_sources_init (shell);
+
+	/* 
+	 * Don't use daap when the no-registration flag is set.
+	 * This flag is only used to run multiple instances at the same time, and
+	 * sharing from two instances would be silly
+	 */
+	g_object_get (G_OBJECT (shell), 
+		      "no-registration", &no_registration,
+		      NULL);
+	plugin->sharing = !no_registration;
+	if (plugin->sharing)
+		rb_daap_sharing_init (shell);
+}
+
+static void
+impl_deactivate	(RBPlugin *bplugin,
+		 RBShell *shell)
+{
+	RBDaapPlugin *plugin = RB_DAAP_PLUGIN (bplugin);
+
+	if (plugin->sharing)
+		rb_daap_sharing_shutdown (shell);
+
+	rb_daap_sources_shutdown (shell);
+}
+
+
+static void
+preferences_response_cb (GtkWidget *dialog, gint response, RBPlugin *plugin)
+{
+	gtk_widget_hide (dialog);
+}
+
+static void
+share_check_button_toggled_cb (GtkToggleButton *button,
+			       GtkWidget *widget)
+{
+	gboolean b;
+
+	b = gtk_toggle_button_get_active (button);
+
+	eel_gconf_set_boolean (CONF_DAAP_ENABLE_SHARING, b);
+
+	gtk_widget_set_sensitive (widget, b);
+}
+
+static void
+password_check_button_toggled_cb (GtkToggleButton *button,
+				  GtkWidget *widget)
+{
+	gboolean b;
+
+	b = gtk_toggle_button_get_active (button);
+
+	eel_gconf_set_boolean (CONF_DAAP_REQUIRE_PASSWORD, b);
+
+	gtk_widget_set_sensitive (widget, b);
+}
+
+static gboolean
+share_name_entry_focus_out_event_cb (GtkEntry *entry,
+				     GdkEventFocus *event,
+				     gpointer data)
+{
+	gboolean    changed;
+	const char *name;
+	char       *old_name;
+
+	name = gtk_entry_get_text (entry);
+	old_name = eel_gconf_get_string (CONF_DAAP_SHARE_NAME);
+
+	if (name == NULL && old_name == NULL) {
+		changed = FALSE;
+	} else if (name == NULL || old_name == NULL) {
+		changed = TRUE;
+	} else if (strcmp (name, old_name) != 0) {
+		changed = TRUE;
+	} else {
+		changed = FALSE;
+	}
+
+	if (changed)
+		eel_gconf_set_string (CONF_DAAP_SHARE_NAME, name);
+
+	g_free (old_name);
+
+	return FALSE;
+}
+
+static gboolean
+share_password_entry_focus_out_event_cb (GtkEntry *entry,
+					 GdkEventFocus *event,
+					 gpointer data)
+{
+	gboolean    changed;
+	const char *pw;
+	char       *old_pw;
+
+	pw = gtk_entry_get_text (entry);
+	old_pw = eel_gconf_get_string (CONF_DAAP_SHARE_PASSWORD);
+
+	if (pw == NULL && old_pw == NULL) {
+		changed = FALSE;
+	} else if (pw == NULL || old_pw == NULL) {
+		changed = TRUE;
+	} else if (strcmp (pw, old_pw) != 0) {
+		changed = TRUE;
+	} else {
+		changed = FALSE;
+	}
+
+	if (changed)
+		eel_gconf_set_string (CONF_DAAP_SHARE_PASSWORD, pw);
+
+	g_free (old_pw);
+
+	return FALSE;
+}
+
+static GtkWidget *
+make_config_widget(void)
+{
+	GladeXML *xml;
+	GtkWidget *check;
+	GtkWidget *name_entry;
+	GtkWidget *password_entry;
+	GtkWidget *password_check;
+	GtkWidget *box;
+	gboolean sharing_enabled;
+	gboolean require_password;
+
+	char *name;
+	char *password;
+
+	xml = rb_glade_xml_new ("daap-prefs.glade",
+				"daap_vbox",
+				NULL);
+
+	check = glade_xml_get_widget (xml, "daap_enable_check");
+	password_check = glade_xml_get_widget (xml, "daap_password_check");
+	name_entry = glade_xml_get_widget (xml, "daap_name_entry");
+	password_entry = glade_xml_get_widget (xml, "daap_password_entry");
+	box = glade_xml_get_widget (xml, "daap_box");
+	
+	sharing_enabled = eel_gconf_get_boolean (CONF_DAAP_ENABLE_SHARING);
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), sharing_enabled);
+	g_signal_connect (check, "toggled", G_CALLBACK (share_check_button_toggled_cb), box);
+
+	require_password = eel_gconf_get_boolean (CONF_DAAP_REQUIRE_PASSWORD);
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (password_check), require_password);
+	g_signal_connect (password_check, "toggled", G_CALLBACK (password_check_button_toggled_cb), password_entry);
+	
+	name = eel_gconf_get_string (CONF_DAAP_SHARE_NAME);
+	if (name != NULL)
+		gtk_entry_set_text (GTK_ENTRY (name_entry), name);
+	g_free (name);
+	g_signal_connect (name_entry, "focus-out-event",
+			  G_CALLBACK (share_name_entry_focus_out_event_cb), NULL);	
+
+	password = eel_gconf_get_string (CONF_DAAP_SHARE_PASSWORD);
+	if (password != NULL)
+		gtk_entry_set_text (GTK_ENTRY (password_entry), password);
+	g_free (password);
+	g_signal_connect (password_entry, "focus-out-event",
+			  G_CALLBACK (share_password_entry_focus_out_event_cb), NULL);	
+
+	gtk_widget_set_sensitive (box, sharing_enabled);
+	gtk_widget_set_sensitive (password_entry, require_password);
+
+	return glade_xml_get_widget (xml, "daap_vbox");
+}
+
+static GtkWidget*
+impl_create_configure_dialog (RBPlugin *bplugin)
+{
+	RBDaapPlugin *plugin = RB_DAAP_PLUGIN (bplugin);
+
+	if (plugin->preferences == NULL) {
+		GtkWidget *widget;
+
+		widget =  make_config_widget ();
+
+		plugin->preferences = gtk_dialog_new_with_buttons (_("DAAP Music Sharing Preferences"),
+								   NULL,
+								   GTK_DIALOG_DESTROY_WITH_PARENT,
+								   GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
+								   NULL);
+		g_signal_connect (G_OBJECT (plugin->preferences),
+				  "response",
+				  G_CALLBACK (preferences_response_cb),
+				  plugin);
+		gtk_widget_hide_on_delete (plugin->preferences);
+		
+		gtk_container_add (GTK_CONTAINER (GTK_DIALOG (plugin->preferences)->vbox), widget);
+	}
+	
+	gtk_widget_show_all (plugin->preferences);
+	return plugin->preferences;
+}
+
