From b87465f387b02e8e16d2cbb356fb7dab74d12070 Mon Sep 17 00:00:00 2001 From: fgerlits Date: Tue, 31 Oct 2006 17:03:31 +0000 Subject: [PATCH] fixed #1868 --- .../products/gLiveSupport/src/GLiveSupport.h | 15 ++++++++++++ .../gLiveSupport/src/SearchWindow.cxx | 24 ++++++++++++------- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/campcaster/src/products/gLiveSupport/src/GLiveSupport.h b/campcaster/src/products/gLiveSupport/src/GLiveSupport.h index 4ecf8a1de..546bcf7cd 100644 --- a/campcaster/src/products/gLiveSupport/src/GLiveSupport.h +++ b/campcaster/src/products/gLiveSupport/src/GLiveSupport.h @@ -672,6 +672,21 @@ class GLiveSupport : public LocalizedConfigurable, acquirePlaylist(Ptr::Ref id) throw (XmlRpcException); + /** + * Tell if a playable object specified by an id exists. + * + * @param id the id of the playable to check for. + * @return true if the playable by the specified id exists, + * false otherwise. + * @exception XmlRpcException on communication problems. + */ + bool + existsPlayable(Ptr::Ref id) throw (XmlRpcException) + { + return storage->existsAudioClip(sessionId, id) + || storage->existsPlaylist(sessionId, id); + } + /** * Open a playable object, for reading only. * Calls either getAudioClip() or getPlaylist(). diff --git a/campcaster/src/products/gLiveSupport/src/SearchWindow.cxx b/campcaster/src/products/gLiveSupport/src/SearchWindow.cxx index 861dd2b1a..7289e9349 100644 --- a/campcaster/src/products/gLiveSupport/src/SearchWindow.cxx +++ b/campcaster/src/products/gLiveSupport/src/SearchWindow.cxx @@ -931,14 +931,18 @@ SearchWindow :: onDownloadFromHub(void) throw () if (iter) { Ptr::Ref playable = (*iter)[modelColumns.playableColumn]; if (playable) { - try { - searchInput->activatePage(3); - transportList->addDownload(playable); - - } catch (XmlRpcException &e) { - gLiveSupport->displayMessageWindow(formatMessage( + if (!gLiveSupport->existsPlayable(playable->getId())) { + try { + searchInput->activatePage(3); + transportList->addDownload(playable); + + } catch (XmlRpcException &e) { + gLiveSupport->displayMessageWindow(formatMessage( "downloadFromHubErrorMsg", e.what() )); - return; + return; + } + } else { + onAddToScratchpad(); } } } @@ -953,7 +957,11 @@ SearchWindow :: onDoubleClick(const Gtk::TreeModel::Path & path, const Gtk::TreeViewColumn * column) throw () { - onAddToScratchpad(); + if (searchIsLocal()) { + onAddToScratchpad(); + } else { + onDownloadFromHub(); + } }