[rhythmbox] shell: when adding a URI to the queue, import it first if necessary (bug #482813)



commit 88c03d822304e55e20c83f05c9dc8f067efdb2b1
Author: Jonathan Matthew <jonathan d14n org>
Date:   Sat Aug 14 23:25:53 2010 +1000

    shell: when adding a URI to the queue, import it first if necessary (bug #482813)

 shell/rb-shell.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/shell/rb-shell.c b/shell/rb-shell.c
index 830f393..2d7f3a9 100644
--- a/shell/rb-shell.c
+++ b/shell/rb-shell.c
@@ -3468,6 +3468,25 @@ rb_shell_add_to_queue (RBShell *shell,
 		       const gchar *uri,
 		       GError **error)
 {
+	RhythmDBEntry *entry;
+
+	entry = rhythmdb_entry_lookup_by_location (shell->priv->db, uri);
+	if (entry == NULL) {
+		RBSource *source;
+		source = rb_shell_guess_source_for_uri (shell, uri);
+		if (source != NULL) {
+			rb_source_add_uri (source, uri, NULL, NULL, NULL, NULL, NULL);
+		} else {
+			g_set_error (error,
+				     RB_SHELL_ERROR,
+				     RB_SHELL_ERROR_NO_SOURCE_FOR_URI,
+				     _("No registered source can handle URI %s"),
+				     uri);
+			return FALSE;
+		}
+	} else {
+		rhythmdb_entry_unref (entry);
+	}
 	rb_static_playlist_source_add_location (RB_STATIC_PLAYLIST_SOURCE (shell->priv->queue_source),
 						uri, -1);
 	return TRUE;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]