Index: bindings/python/rb.defs
===================================================================
RCS file: /cvs/gnome/rhythmbox/bindings/python/rb.defs,v
retrieving revision 1.31
diff -u -p -r1.31 rb.defs
--- bindings/python/rb.defs	12 Jul 2006 09:56:55 -0000	1.31
+++ bindings/python/rb.defs	31 Jul 2006 05:48:26 -0000
@@ -238,10 +238,10 @@
   )
 )
 
-(define-method guess_type_for_uri
+(define-method guess_source_for_uri
   (of-object "RBShell")
-  (c-name "rb_shell_guess_type_for_uri")
-  (return-type "RhythmDBEntryType_*")
+  (c-name "rb_shell_guess_source_for_uri")
+  (return-type "RBSource*")
   (parameters
     '("const-char*" "uri")
   )
@@ -252,7 +252,6 @@
   (c-name "rb_shell_add_uri")
   (return-type "gboolean")
   (parameters
-    '("RhythmDBEntryType_*" "entry_type")
     '("const-char*" "uri")
     '("const-char*" "title")
     '("const-char*" "genre")
@@ -823,12 +822,6 @@
   (return-type "RBSourceEOFType")
 )
 
-(define-method have_url
-  (of-object "RBSource")
-  (c-name "rb_source_have_url")
-  (return-type "gboolean")
-)
-
 (define-method receive_drag
   (of-object "RBSource")
   (c-name "rb_source_receive_drag")
@@ -1038,11 +1031,6 @@
 (define-virtual impl_handle_eos
   (of-object "RBSource")
   (return-type "RBSourceEOFType")
-)
-
-(define-virtual impl_have_url
-  (of-object "RBSource")
-  (return-type "gboolean")
 )
 
 (define-virtual impl_receive_drag
Index: shell/rb-playlist-manager.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/shell/rb-playlist-manager.c,v
retrieving revision 1.113
diff -u -p -r1.113 rb-playlist-manager.c
--- shell/rb-playlist-manager.c	23 Jul 2006 16:04:11 -0000	1.113
+++ shell/rb-playlist-manager.c	31 Jul 2006 05:48:44 -0000
@@ -464,33 +464,32 @@ rb_playlist_manager_error_quark (void)
 }
 
 static void
-handle_playlist_entry_cb (TotemPlParser *playlist, const char *uri_maybe,
+handle_playlist_entry_cb (TotemPlParser *playlist,
+			  const char *uri_maybe,
 			  const char *title,
-			  const char *genre, RBPlaylistManager *mgr)
+			  const char *genre,
+			  RBPlaylistManager *mgr)
 {
-	char *uri = rb_canonicalise_uri (uri_maybe);
-	RhythmDBEntryType entry_type;
-
+	char *uri;
+	
+	uri = rb_canonicalise_uri (uri_maybe);
 	g_return_if_fail (uri != NULL);
 
-	entry_type = rb_shell_guess_type_for_uri (mgr->priv->shell, uri);
-	if (entry_type == RHYTHMDB_ENTRY_TYPE_INVALID) {
-		g_free (uri);
+	rb_debug ("adding uri %s (title %s, genre %s) from playlist",
+		  uri, title, genre);
+	if (!rb_shell_add_uri (mgr->priv->shell, 
+			       uri, 
+			       title, 
+			       genre, 
+			       NULL))
 		return;
-	}
 
-	rb_shell_add_uri (mgr->priv->shell,
-			  entry_type,
-			  uri,
-			  title,
-			  genre,
-			  NULL);
-
-	if (entry_type == RHYTHMDB_ENTRY_TYPE_SONG) {
-		if (!mgr->priv->loading_playlist) {
-			mgr->priv->loading_playlist =
-				RB_STATIC_PLAYLIST_SOURCE (rb_playlist_manager_new_playlist (mgr, NULL, FALSE));
-		}
+	if (!mgr->priv->loading_playlist) {
+		mgr->priv->loading_playlist =
+			RB_STATIC_PLAYLIST_SOURCE (rb_playlist_manager_new_playlist (mgr, NULL, FALSE));
+	}
+	if (rb_source_want_uri (RB_SOURCE (mgr->priv->loading_playlist), uri) > 0) {
+		rb_debug ("adding uri %s to playlist", uri);
 		rb_static_playlist_source_add_location (mgr->priv->loading_playlist, uri, -1);
 	}
 
Index: shell/rb-shell-player.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/shell/rb-shell-player.c,v
retrieving revision 1.254
diff -u -p -r1.254 rb-shell-player.c
--- shell/rb-shell-player.c	23 Jul 2006 16:04:11 -0000	1.254
+++ shell/rb-shell-player.c	31 Jul 2006 05:48:44 -0000
@@ -187,7 +187,6 @@ struct RBShellPlayerPrivate
 	RBPlayer *mmplayer;
 
 	char *song;
-	gboolean have_url;
 	char *url;
 	long elapsed;
 
@@ -2487,7 +2486,6 @@ rb_shell_player_set_playing_source_inter
 	g_free (player->priv->song);
 	player->priv->song = NULL;
 	player->priv->url = NULL;
-	player->priv->have_url = FALSE;
 
 	if (player->priv->current_playing_source == NULL)
 		rb_shell_player_stop (player);
@@ -2656,9 +2654,6 @@ rb_shell_player_sync_with_selected_sourc
 	if (player->priv->source == NULL)
 	{
 		rb_debug ("no playing source, new source is %p", player->priv->selected_source);
-
-		player->priv->have_url = rb_source_have_url (player->priv->selected_source);
-
 		rb_shell_player_sync_with_source (player);
 	}
 }
Index: shell/rb-shell.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/shell/rb-shell.c,v
retrieving revision 1.468
diff -u -p -r1.468 rb-shell.c
--- shell/rb-shell.c	27 Jul 2006 02:11:53 -0000	1.468
+++ shell/rb-shell.c	31 Jul 2006 05:48:44 -0000
@@ -1892,29 +1892,8 @@ rb_shell_playing_entry_changed_cb (RBShe
 				   RhythmDBEntry *entry,
 				   RBShell *shell)
 {
-/*	RBRemoteSong song; */
 	char *notifytitle;
 
-	/* emit remote song_changed notification */
-	/*
-	song.title = g_strdup (rb_refstring_get (entry->title));
-	song.artist = g_strdup (rb_refstring_get (entry->artist));
-	song.genre = g_strdup (rb_refstring_get (entry->genre));
-	song.album = g_strdup (rb_refstring_get (entry->album));
-	song.uri = g_strdup (entry->location);
-
-	song.track_number = entry->tracknum;
-	song.disc_number = entry->discnum;
-	song.duration = entry->duration;
-	song.bitrate = entry->bitrate;
-	song.filesize = entry->file_size;
-	song.rating = entry->rating;
-	song.play_count = entry->play_count;
-	song.last_played = entry->last_played;
-
-	g_signal_emit_by_name (RB_REMOTE_PROXY (shell), "song_changed", &song);
-	*/
-
 	/* Translators: by Artist from Album*/
 	notifytitle = g_strdup_printf (_("by %s from %s"),
 				       rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ARTIST),
@@ -2932,45 +2911,34 @@ rb_shell_session_init (RBShell *shell)
 				 shell, 0);
 }
 
-RhythmDBEntryType
-rb_shell_guess_type_for_uri (RBShell *shell,
-			     const char *uri)
-{
-	GnomeVFSURI *vfs_uri;
-	RhythmDBEntryType entry_type = RHYTHMDB_ENTRY_TYPE_SONG;
-	const char *scheme;
-	const char *path;
-	const char *pathend;
-
-	if (uri == NULL)
-		return RHYTHMDB_ENTRY_TYPE_INVALID;
-
-	vfs_uri = gnome_vfs_uri_new (uri);
-	if (vfs_uri == NULL) {
-		rb_debug ("Invalid uri: %s", uri);
-		return RHYTHMDB_ENTRY_TYPE_INVALID;
-	}
-	scheme = gnome_vfs_uri_get_scheme (vfs_uri);
-	path = gnome_vfs_uri_get_scheme (vfs_uri);
-	pathend = path + strlen (path);
-
-	if (strcmp ("file", scheme) == 0) {
-		entry_type = RHYTHMDB_ENTRY_TYPE_SONG;
-	} else if (strcmp ("http", scheme) == 0) {
-		if ((strcasecmp (".xml", pathend-4) == 0)
-		    || strcasecmp (".rss", pathend-4) == 0)
-			entry_type = RHYTHMDB_ENTRY_TYPE_PODCAST_FEED;
-		else
-			entry_type = RHYTHMDB_ENTRY_TYPE_IRADIO_STATION;
-	} else if ((strcmp ("pnm", scheme) == 0) ||
-		  (strcmp ("rtsp", scheme) == 0) ||
-		  (strcmp ("mms", scheme) == 0) ||
-		  (strcmp ("mmsh", scheme) == 0)) {
-		entry_type = RHYTHMDB_ENTRY_TYPE_IRADIO_STATION;
+RBSource *
+rb_shell_guess_source_for_uri (RBShell *shell,
+			       const char *uri)
+{
+	GList *t;
+	RBSource *best = NULL;
+	guint strength = 0;
+
+	for (t = shell->priv->sources; t != NULL; t = t->next) {
+		guint s;
+		RBSource *source;
+
+		source = (RBSource *)t->data;
+		s = rb_source_want_uri (source, uri);
+		if (s > strength) {
+			gchar *name;
+			
+			g_object_get (source, "name", &name, NULL);
+			rb_debug ("source %s returned strength %u for uri %s",
+				  name, s, uri);
+			g_free (name);
+
+			strength = s;
+			best = source;
+		}
 	}
 
-	gnome_vfs_uri_unref (vfs_uri);
-	return entry_type;
+	return best;
 }
 
 /* Load a URI representing an element of the given type, with
@@ -2978,7 +2946,6 @@ rb_shell_guess_type_for_uri (RBShell *sh
  */
 gboolean
 rb_shell_add_uri (RBShell *shell,
-		  RhythmDBEntryType entrytype,
 		  const char *uri,
 		  const char *title,
 		  const char *genre,
@@ -2986,35 +2953,24 @@ rb_shell_add_uri (RBShell *shell,
 {
 	RBSource *source;
 
-	/* FIXME should abstract this... */
-	source = rb_shell_get_source_by_entry_type (shell, entrytype);
-	if (source == RB_SOURCE (shell->priv->iradio_source)) {
-		if (rb_uri_is_local (uri)) {
-			rb_iradio_source_add_from_playlist (shell->priv->iradio_source,
-							    uri);
-		} else {
-			rb_iradio_source_add_station (shell->priv->iradio_source,
-						      uri,
-						      title,
-						      genre);
-		}
-		return TRUE;
-	} else if (source == RB_SOURCE (shell->priv->podcast_source)) {
-		rb_podcast_source_add_feed (shell->priv->podcast_source, uri);
-		return TRUE;
-	} else if (entrytype == RHYTHMDB_ENTRY_TYPE_SONG) {
-		/* FIXME should be sync... */
-		rhythmdb_add_uri (shell->priv->db, uri);
-		return TRUE;
-	} else {
-		g_assert_not_reached ();
+	source = rb_shell_guess_source_for_uri (shell, uri);
+	if (source == NULL) {
+		g_set_error (error,
+			     RB_SHELL_ERROR,
+			     RB_SHELL_ERROR_NO_SOURCE_FOR_URI,
+			     _("No registered source can handle URI %s"),
+			     uri);
 		return FALSE;
 	}
+
+	rb_source_add_uri (source, uri, title, genre);
+	return TRUE;
 }
 
 typedef struct {
 	RBShell *shell;
-	gboolean iradio_playlist;
+	gboolean can_use_playlist;
+	RBSource *playlist_source;
 } PlaylistParseData;
 
 static void
@@ -3024,14 +2980,28 @@ handle_playlist_entry_cb (TotemPlParser 
 			  const char *genre,
 			  PlaylistParseData *data)
 {
-	RhythmDBEntryType entry_type;
-
-	g_return_if_fail (uri != NULL);
+	RBSource *source;
 
-	entry_type = rb_shell_guess_type_for_uri (data->shell, uri);
+	/* 
+	 * Track whether the same playlist-handling source
+	 * wants all the URIs from the playlist; if it does,
+	 * then we'll just give the playlist URI to the source.
+	 */
+	if (data->can_use_playlist == FALSE)
+		return;
 
-	if (entry_type != RHYTHMDB_ENTRY_TYPE_IRADIO_STATION)
-		data->iradio_playlist = FALSE;
+	source = rb_shell_guess_source_for_uri (data->shell, uri);
+	if (data->playlist_source == NULL) {
+		if (rb_source_try_playlist (source)) {
+			data->playlist_source = RB_SOURCE (g_object_ref (source));
+		} else {
+			data->can_use_playlist = FALSE;
+		}
+	} else if (data->playlist_source != source) {
+		g_object_unref (data->playlist_source);
+		data->playlist_source = NULL;
+		data->can_use_playlist = FALSE;
+	}
 }
 
 /* Load a URI representing a single song, a directory, a playlist, or
@@ -3051,7 +3021,6 @@ rb_shell_load_uri (RBShell *shell,
 		   GError **error)
 {
 	RhythmDBEntry *entry;
-
 	entry = rhythmdb_entry_lookup_by_location (shell->priv->db, uri);
 
 	if (entry == NULL) {
@@ -3060,12 +3029,16 @@ rb_shell_load_uri (RBShell *shell,
 		PlaylistParseData data;
 
 		data.shell = shell;
+		data.can_use_playlist = TRUE;
+		data.playlist_source = NULL;
+#if 0
 		if (rb_uri_is_local (uri)) {
 			/* TODO: we'd need to grab the first stream URL from the playlist
 			 * to be able to play stations added this way.
 			 */
 			play = FALSE;
 		}
+#endif
 
 		rb_debug ("adding uri %s", uri);
 		parser = totem_pl_parser_new ();
@@ -3081,25 +3054,21 @@ rb_shell_load_uri (RBShell *shell,
 		result = totem_pl_parser_parse (parser, uri, FALSE);
 		g_object_unref (parser);
 
-		if (result == TOTEM_PL_PARSER_RESULT_SUCCESS && data.iradio_playlist == FALSE) {
-			rb_debug ("adding %s as a static playlist", uri);
-			if (!rb_playlist_manager_parse_file (shell->priv->playlist_manager,
-							     uri, error))
-				return FALSE;
-		} else {
-			RhythmDBEntryType entrytype;
-
-			if (result == TOTEM_PL_PARSER_RESULT_SUCCESS) {
-				rb_debug ("adding %s as an iradio playlist", uri);
-				entrytype = RHYTHMDB_ENTRY_TYPE_IRADIO_STATION;
+		if (result == TOTEM_PL_PARSER_RESULT_SUCCESS) {
+			if (data.can_use_playlist && data.playlist_source) {
+				rb_debug ("adding playlist %s to source", uri);
+				rb_source_add_uri (data.playlist_source, uri, NULL, NULL);
+				g_object_unref (data.playlist_source);
 			} else {
-				rb_debug ("%s didn't parse as a playlist", uri);
-				entrytype = rb_shell_guess_type_for_uri (shell, uri);
-				if (entrytype < 0)
+				rb_debug ("adding %s as a static playlist", uri);
+				if (!rb_playlist_manager_parse_file (shell->priv->playlist_manager,
+								     uri, error))
 					return FALSE;
 			}
-
-			rb_shell_add_uri (shell, entrytype, uri, NULL, NULL, NULL);
+		} else {
+			rb_debug ("%s didn't parse as a playlist", uri);
+			if (!rb_shell_add_uri (shell, uri, NULL, NULL, error))
+				return FALSE;
 		}
 	}
 
Index: shell/rb-shell.h
===================================================================
RCS file: /cvs/gnome/rhythmbox/shell/rb-shell.h,v
retrieving revision 1.36
diff -u -p -r1.36 rb-shell.h
--- shell/rb-shell.h	23 Jul 2006 10:29:40 -0000	1.36
+++ shell/rb-shell.h	31 Jul 2006 05:48:44 -0000
@@ -41,7 +41,8 @@ enum
 	RB_SHELL_ERROR_NO_SUCH_URI,
 	RB_SHELL_ERROR_NO_SUCH_PROPERTY,
 	RB_SHELL_ERROR_IMMUTABLE_PROPERTY,
-	RB_SHELL_ERROR_INVALID_PROPERTY_TYPE
+	RB_SHELL_ERROR_INVALID_PROPERTY_TYPE,
+	RB_SHELL_ERROR_NO_SOURCE_FOR_URI
 };
 
 #define RB_SHELL_ERROR rb_shell_error_quark ()
@@ -87,10 +88,9 @@ RBShell *	rb_shell_new		(int argc, char 
 
 gboolean        rb_shell_present        (RBShell *shell, guint32 timestamp, GError **error);
 
-RhythmDBEntryType rb_shell_guess_type_for_uri (RBShell *shell, const char *uri);
+RBSource *	rb_shell_guess_source_for_uri (RBShell *shell, const char *uri);
 
 gboolean        rb_shell_add_uri        (RBShell *shell,
-					 RhythmDBEntryType entry_type,
 					 const char *uri,
 					 const char *title,
 					 const char *genre,
Index: sources/rb-browser-source.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/sources/rb-browser-source.c,v
retrieving revision 1.19
diff -u -p -r1.19 rb-browser-source.c
--- sources/rb-browser-source.c	30 Jul 2006 12:30:16 -0000	1.19
+++ sources/rb-browser-source.c	31 Jul 2006 05:48:44 -0000
@@ -197,7 +197,6 @@ rb_browser_source_class_init (RBBrowserS
 	source_class->impl_can_add_to_queue = (RBSourceFeatureFunc) rb_true_function;
 	source_class->impl_can_move_to_trash = (RBSourceFeatureFunc) rb_true_function;
 	source_class->impl_delete = impl_delete;
-	source_class->impl_have_url = (RBSourceFeatureFunc) rb_false_function;
 	source_class->impl_show_popup = impl_show_popup;
 	source_class->impl_get_search_actions = impl_get_search_actions;
 	source_class->impl_browser_toggled = impl_browser_toggled;
Index: sources/rb-import-errors-source.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/sources/rb-import-errors-source.c,v
retrieving revision 1.11
diff -u -p -r1.11 rb-import-errors-source.c
--- sources/rb-import-errors-source.c	25 Jul 2006 12:06:09 -0000	1.11
+++ sources/rb-import-errors-source.c	31 Jul 2006 05:48:44 -0000
@@ -78,7 +78,6 @@ rb_import_errors_source_class_init (RBIm
 	source_class->impl_try_playlist = (RBSourceFeatureFunc) rb_false_function;
 	source_class->impl_can_pause = (RBSourceFeatureFunc) rb_false_function;
 
-	source_class->impl_have_url = (RBSourceFeatureFunc) rb_false_function;
 	source_class->impl_get_status = impl_get_status;
 
 	g_type_class_add_private (klass, sizeof (RBImportErrorsSourcePrivate));
Index: sources/rb-iradio-source.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/sources/rb-iradio-source.c,v
retrieving revision 1.128
diff -u -p -r1.128 rb-iradio-source.c
--- sources/rb-iradio-source.c	25 Jul 2006 12:06:09 -0000	1.128
+++ sources/rb-iradio-source.c	31 Jul 2006 05:48:44 -0000
@@ -94,6 +94,8 @@ static void impl_song_properties (RBSour
 static RBSourceEOFType impl_handle_eos (RBSource *asource);
 static gboolean impl_show_popup (RBSource *source);
 static GList *impl_get_ui_actions (RBSource *source);
+static guint impl_want_uri (RBSource *source, const char *uri);
+static gboolean impl_add_uri (RBSource *source, const char *uri, const char *title, const char *genre);
 
 static void rb_iradio_source_do_query (RBIRadioSource *source);
 
@@ -190,11 +192,12 @@ rb_iradio_source_class_init (RBIRadioSou
 	source_class->impl_get_status  = impl_get_status;
 	source_class->impl_get_ui_actions = impl_get_ui_actions;
 	source_class->impl_handle_eos = impl_handle_eos;
-	source_class->impl_have_url = (RBSourceFeatureFunc) rb_true_function;
 	source_class->impl_search = impl_search;
 	source_class->impl_show_popup = impl_show_popup;
 	source_class->impl_song_properties = impl_song_properties;
 	source_class->impl_try_playlist = (RBSourceFeatureFunc) rb_true_function;
+	source_class->impl_want_uri = impl_want_uri;
+	source_class->impl_add_uri = impl_add_uri;
 
 	g_object_class_install_property (object_class,
 					 PROP_ENTRY_TYPE,
@@ -636,6 +639,36 @@ impl_song_properties (RBSource *asource)
 		gtk_widget_show_all (dialog);
 	else
 		rb_debug ("no selection!");
+}
+
+static guint
+impl_want_uri (RBSource *source, const char *uri)
+{
+	if (g_str_has_prefix (uri, "http://")) {
+		/* other entry types might have 
+		 * more specific guesses for HTTP 
+		 */
+		return 50;
+	} else if (g_str_has_prefix (uri, "pnm://") ||
+		   g_str_has_prefix (uri, "rtsp://") ||
+		   g_str_has_prefix (uri, "mms://") ||
+		   g_str_has_prefix (uri, "mmsh://")) {
+		return 100;
+	}
+
+	return 0;
+}
+
+static gboolean
+impl_add_uri (RBSource *source, const char *uri, const char *title, const char *genre)
+{
+	if (rb_uri_is_local (uri)) {
+		rb_iradio_source_add_from_playlist (RB_IRADIO_SOURCE (source), uri);
+	} else {
+		rb_iradio_source_add_station (RB_IRADIO_SOURCE (source),
+					      uri, title, genre);
+	}
+	return TRUE;
 }
 
 static void
Index: sources/rb-library-source.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/sources/rb-library-source.c,v
retrieving revision 1.180
diff -u -p -r1.180 rb-library-source.c
--- sources/rb-library-source.c	23 Jul 2006 16:04:45 -0000	1.180
+++ sources/rb-library-source.c	31 Jul 2006 05:48:44 -0000
@@ -63,6 +63,8 @@ static gboolean impl_can_paste (RBSource
 #ifdef ENABLE_TRACK_TRANSFER
 static void impl_paste (RBSource *source, GList *entries);
 #endif
+static guint impl_want_uri (RBSource *source, const char *uri);
+static gboolean impl_add_uri (RBSource *source, const char *uri, const char *title, const char *genre);
 
 static void rb_library_source_ui_prefs_sync (RBLibrarySource *source);
 static void rb_library_source_preferences_sync (RBLibrarySource *source);
@@ -185,6 +187,8 @@ rb_library_source_class_init (RBLibraryS
 #ifdef ENABLE_TRACK_TRANSFER
 	source_class->impl_paste = impl_paste;
 #endif
+	source_class->impl_want_uri = impl_want_uri;
+	source_class->impl_add_uri = impl_add_uri;
 
 	browser_source_class->impl_get_paned_key = impl_get_paned_key;
 	browser_source_class->impl_has_drop_support = (RBBrowserSourceFeatureFunc) rb_true_function;
@@ -1203,6 +1207,27 @@ impl_paste (RBSource *asource, GList *en
 	g_object_unref (rm_mgr);
 }
 #endif
+
+static guint
+impl_want_uri (RBSource *source, const char *uri)
+{
+	/* assume anything local or on smb is a song */
+	if (rb_uri_is_local (uri) || 
+	    g_str_has_prefix (uri, "smb://"))
+		return 50;
+
+	return 0;
+}
+
+static gboolean
+impl_add_uri (RBSource *asource, const char *uri, const char *title, const char *genre)
+{
+	RBLibrarySource *source = RB_LIBRARY_SOURCE (asource);
+	/* FIXME should be synchronous */
+	rb_debug ("adding uri %s to library", uri);
+	rhythmdb_add_uri (source->priv->db, uri);
+	return TRUE;
+}
 
 static void
 rb_library_source_add_child_source (const char *path, RBLibrarySource *library_source)
Index: sources/rb-missing-files-source.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/sources/rb-missing-files-source.c,v
retrieving revision 1.10
diff -u -p -r1.10 rb-missing-files-source.c
--- sources/rb-missing-files-source.c	25 Jul 2006 12:06:10 -0000	1.10
+++ sources/rb-missing-files-source.c	31 Jul 2006 05:48:44 -0000
@@ -105,7 +105,6 @@ rb_missing_files_source_class_init (RBMi
 	source_class->impl_try_playlist = (RBSourceFeatureFunc) rb_false_function;
 	source_class->impl_can_pause = (RBSourceFeatureFunc) rb_false_function;
 
-	source_class->impl_have_url = (RBSourceFeatureFunc) rb_false_function;
 	source_class->impl_get_status = impl_get_status;
 
 	g_object_class_install_property (object_class,
Index: sources/rb-playlist-source.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/sources/rb-playlist-source.c,v
retrieving revision 1.129
diff -u -p -r1.129 rb-playlist-source.c
--- sources/rb-playlist-source.c	27 Jul 2006 02:12:01 -0000	1.129
+++ sources/rb-playlist-source.c	31 Jul 2006 05:48:44 -0000
@@ -153,7 +153,6 @@ rb_playlist_source_class_init (RBPlaylis
 	source_class->impl_can_move_to_trash = (RBSourceFeatureFunc) rb_true_function;
 	source_class->impl_song_properties = impl_song_properties;
 	source_class->impl_can_pause = (RBSourceFeatureFunc) rb_true_function;
-	source_class->impl_have_url = (RBSourceFeatureFunc) rb_false_function;
 	source_class->impl_show_popup = impl_show_popup;
 
 	klass->impl_show_entry_view_popup = default_show_entry_view_popup;
Index: sources/rb-podcast-source.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/sources/rb-podcast-source.c,v
retrieving revision 1.75
diff -u -p -r1.75 rb-podcast-source.c
--- sources/rb-podcast-source.c	25 Jul 2006 12:06:10 -0000	1.75
+++ sources/rb-podcast-source.c	31 Jul 2006 05:48:44 -0000
@@ -232,6 +232,8 @@ static void impl_get_status				(RBSource
 							 char **text,
 							 char **progress_text,
 							 float *progress);
+static guint impl_want_uri				(RBSource *source, const char *uri);
+static gboolean impl_add_uri				(RBSource *source, const char *uri, const char *title, const char *genre);
 
 #define CMD_PATH_SHOW_BROWSER "/commands/ShowBrowser"
 #define CMD_PATH_CURRENT_STATION "/commands/CurrentStation"
@@ -355,12 +357,13 @@ rb_podcast_source_class_init (RBPodcastS
 	source_class->impl_get_search_actions = impl_get_search_actions;
 	source_class->impl_get_ui_actions = impl_get_ui_actions;
 	source_class->impl_handle_eos = impl_handle_eos;
-	source_class->impl_have_url = (RBSourceFeatureFunc) rb_true_function;
 	source_class->impl_receive_drag = impl_receive_drag;
 	source_class->impl_search = impl_search;
 	source_class->impl_show_popup = impl_show_popup;
 	source_class->impl_song_properties = impl_song_properties;
 	source_class->impl_get_status = impl_get_status;
+	source_class->impl_want_uri = impl_want_uri;
+	source_class->impl_add_uri = impl_add_uri;
 
 	g_object_class_install_property (object_class,
 					 PROP_ENTRY_TYPE,
@@ -2004,3 +2007,25 @@ impl_get_status (RBSource *source, char 
 		*text = g_strdup ("");
 	}
 }
+
+static guint
+impl_want_uri (RBSource *source, const char *uri)
+{
+	if (g_str_has_prefix (uri, "http://") == FALSE)
+		return 0;
+
+	if (g_str_has_suffix (uri, ".xml") ||
+	    g_str_has_suffix (uri, ".rss"))
+		return 100;
+
+	return 0;
+}
+
+static gboolean
+impl_add_uri (RBSource *asource, const char *uri, const char *title, const char *genre)
+{
+	RBPodcastSource *source = RB_PODCAST_SOURCE (asource);
+	rb_podcast_manager_subscribe_feed (source->priv->podcast_mgr, uri);
+	return TRUE;
+}
+
Index: sources/rb-source.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/sources/rb-source.c,v
retrieving revision 1.77
diff -u -p -r1.77 rb-source.c
--- sources/rb-source.c	25 Jul 2006 12:06:11 -0000	1.77
+++ sources/rb-source.c	31 Jul 2006 05:48:44 -0000
@@ -138,7 +138,6 @@ rb_source_class_init (RBSourceClass *kla
 	klass->impl_can_add_to_queue = (RBSourceFeatureFunc) rb_false_function;
 	klass->impl_can_move_to_trash = (RBSourceFeatureFunc) rb_false_function;
 	klass->impl_get_entry_view = default_get_entry_view;
-	klass->impl_have_url = (RBSourceFeatureFunc) rb_false_function;
 	klass->impl_copy = default_copy;
 	klass->impl_reset_filters = default_reset_filters;
 	klass->impl_song_properties = default_song_properties;
@@ -874,6 +873,24 @@ rb_source_try_playlist (RBSource *source
 	return klass->impl_try_playlist (source);
 }
 
+guint
+rb_source_want_uri (RBSource *source, const char *uri)
+{
+	RBSourceClass *klass = RB_SOURCE_GET_CLASS (source);
+	if (klass->impl_want_uri)
+		return klass->impl_want_uri (source, uri);
+	return 0;
+}
+
+gboolean
+rb_source_add_uri (RBSource *source, const char *uri, const char *title, const char *genre)
+{
+	RBSourceClass *klass = RB_SOURCE_GET_CLASS (source);
+	if (klass->impl_add_uri)
+		return klass->impl_add_uri (source, uri, title, genre);
+	return FALSE;
+}
+
 gboolean
 rb_source_can_pause (RBSource *source)
 {
@@ -900,14 +917,6 @@ rb_source_handle_eos (RBSource *source)
 	RBSourceClass *klass = RB_SOURCE_GET_CLASS (source);
 
 	return klass->impl_handle_eos (source);
-}
-
-gboolean
-rb_source_have_url (RBSource *source)
-{
-	RBSourceClass *klass = RB_SOURCE_GET_CLASS (source);
-
-	return klass->impl_have_url (source);
 }
 
 gboolean
Index: sources/rb-source.h
===================================================================
RCS file: /cvs/gnome/rhythmbox/sources/rb-source.h,v
retrieving revision 1.48
diff -u -p -r1.48 rb-source.h
--- sources/rb-source.h	14 Jul 2006 12:31:34 -0000	1.48
+++ sources/rb-source.h	31 Jul 2006 05:48:44 -0000
@@ -118,6 +118,8 @@ struct _RBSourceClass
 	void		(*impl_song_properties)	(RBSource *source);
 
 	gboolean	(*impl_try_playlist)	(RBSource *source);
+	guint		(*impl_want_uri)	(RBSource *source, const char *uri);
+	gboolean	(*impl_add_uri)		(RBSource *source, const char *uri, const char *title, const char *genre);
 
 	gboolean	(*impl_can_pause)	(RBSource *source);
 	RBSourceEOFType	(*impl_handle_eos)	(RBSource *source);
@@ -181,11 +183,11 @@ void		rb_source_move_to_trash		(RBSource
 void		rb_source_song_properties	(RBSource *source);
 
 gboolean	rb_source_try_playlist		(RBSource *source);
+guint		rb_source_want_uri		(RBSource *source, const char *uri);
+gboolean	rb_source_add_uri		(RBSource *source, const char *uri, const char *title, const char *genre);
 
 gboolean	rb_source_can_pause		(RBSource *source);
 RBSourceEOFType	rb_source_handle_eos		(RBSource *source);
-
-gboolean	rb_source_have_url		(RBSource *source);
 
 gboolean	rb_source_receive_drag		(RBSource *source, GtkSelectionData *data);
 
Index: sources/rb-static-playlist-source.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/sources/rb-static-playlist-source.c,v
retrieving revision 1.29
diff -u -p -r1.29 rb-static-playlist-source.c
--- sources/rb-static-playlist-source.c	25 Jul 2006 12:06:11 -0000	1.29
+++ sources/rb-static-playlist-source.c	31 Jul 2006 05:48:44 -0000
@@ -50,6 +50,8 @@ static void impl_browser_toggled (RBSour
 static void impl_reset_filters (RBSource *asource);
 static gboolean impl_receive_drag (RBSource *source, GtkSelectionData *data);
 static GList *impl_get_search_actions (RBSource *source);
+static guint impl_want_uri (RBSource *source, const char *uri);
+
 static GPtrArray *construct_query_from_selection (RBStaticPlaylistSource *source);
 
 /* playlist methods */
@@ -137,6 +139,7 @@ rb_static_playlist_source_class_init (RB
 	source_class->impl_browser_toggled = impl_browser_toggled;
 	source_class->impl_get_property_views = impl_get_property_views;
 	source_class->impl_get_search_actions = impl_get_search_actions;
+	source_class->impl_want_uri = impl_want_uri;
 
 	playlist_class->impl_save_contents_to_xml = impl_save_contents_to_xml;
 
@@ -799,4 +802,15 @@ search_action_changed (GtkRadioAction  *
 	if (source != NULL) {
 		g_object_unref (source);
 	}
+}
+
+static guint
+impl_want_uri (RBSource *source, const char *uri)
+{
+	/* take anything local or on smb */
+	if (rb_uri_is_local (uri) || 
+	    g_str_has_prefix (uri, "smb://"))
+		return 25;	/* less than what the library returns */
+
+	return 0;
 }
