From 1e7014ae01ba20e2fe76da66f1967862b9222c3c Mon Sep 17 00:00:00 2001 From: fgerlits Date: Mon, 25 Sep 2006 15:52:22 +0000 Subject: [PATCH] fixing #1809 --- .../gLiveSupport/src/GLiveSupport.cxx | 27 ++++++++++++++++++- .../products/gLiveSupport/src/GLiveSupport.h | 14 ++++++++++ .../gLiveSupport/src/SearchWindow.cxx | 1 + 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/livesupport/src/products/gLiveSupport/src/GLiveSupport.cxx b/livesupport/src/products/gLiveSupport/src/GLiveSupport.cxx index 60ec1dd88..4c9714763 100644 --- a/livesupport/src/products/gLiveSupport/src/GLiveSupport.cxx +++ b/livesupport/src/products/gLiveSupport/src/GLiveSupport.cxx @@ -804,7 +804,32 @@ GLiveSupport :: acquirePlaylist(Ptr::Ref id) /*------------------------------------------------------------------------------ - * Acquire an Playable object. + * Open a Playable object. + *----------------------------------------------------------------------------*/ +Ptr::Ref +LiveSupport :: GLiveSupport :: +GLiveSupport :: getPlayable(Ptr::Ref id) + throw (XmlRpcException) +{ + Ptr::Ref playable; + + if (existsPlaylist(id)) { + playable = getPlaylist(id); + + } else if (existsAudioClip(id)) { + playable = getAudioClip(id); + + } else { + throw XmlRpcInvalidArgumentException( + "invalid ID in GLiveSupport::acquirePlayable"); + } + + return playable; +} + + +/*------------------------------------------------------------------------------ + * Acquire a Playable object. *----------------------------------------------------------------------------*/ Ptr::Ref LiveSupport :: GLiveSupport :: diff --git a/livesupport/src/products/gLiveSupport/src/GLiveSupport.h b/livesupport/src/products/gLiveSupport/src/GLiveSupport.h index 054f59488..172d979f3 100644 --- a/livesupport/src/products/gLiveSupport/src/GLiveSupport.h +++ b/livesupport/src/products/gLiveSupport/src/GLiveSupport.h @@ -678,6 +678,20 @@ class GLiveSupport : public LocalizedConfigurable, acquirePlaylist(Ptr::Ref id) throw (XmlRpcException); + /** + * Open a playable object, for reading only. + * Calls either getAudioClip() or getPlaylist(). + * You do not need to release the returned Playable object. + * + * @param id the id of the playable object. + * @return the playable object opened. + * @exception XmlRpcException if no Playable with the specified + * id exists, or there was a communication problem. + */ + Ptr::Ref + getPlayable(Ptr::Ref id) + throw (XmlRpcException); + /** * Acquire a playable object. * Calls either acquireAudioClip() or acquirePlaylist(). diff --git a/livesupport/src/products/gLiveSupport/src/SearchWindow.cxx b/livesupport/src/products/gLiveSupport/src/SearchWindow.cxx index ac992439c..9b480c25e 100644 --- a/livesupport/src/products/gLiveSupport/src/SearchWindow.cxx +++ b/livesupport/src/products/gLiveSupport/src/SearchWindow.cxx @@ -754,6 +754,7 @@ SearchWindow :: onAddToLiveMode(void) throw () if (playable) { try { gLiveSupport->addToScratchpad(playable); + playable = gLiveSupport->getPlayable(playable->getId()); gLiveSupport->addToLiveMode(playable); } catch (XmlRpcException &e) { Ptr::Ref errorMessage(new Glib::ustring(