32 #include <sbIDevice.h>
33 #include <sbIDeviceLibraryMediaSyncSettings.h>
34 #include <sbIDeviceLibrarySyncSettings.h>
35 #include <sbIOrderableMediaList.h>
36 #include <sbIPropertyArray.h>
50 bool aIgnorePlaylists,
52 : mTargetLibrary(aTargetLibrary),
53 mIgnorePlaylists(aIgnorePlaylists),
63 sbLibraryUpdateListener::OnItemAdded(
sbIMediaList *aMediaList,
74 sbLibraryUpdateListener::OnBeforeItemRemoved(
sbIMediaList *aMediaList,
79 NS_ENSURE_ARG_POINTER(aMediaList);
80 NS_ENSURE_ARG_POINTER(aMediaItem);
85 nsCOMPtr<sbIMediaList> list = do_QueryInterface(aMediaItem);
90 NS_ENSURE_SUCCESS(rv, rv);
100 sbLibraryUpdateListener::OnAfterItemRemoved(
sbIMediaList *aMediaList,
105 NS_NOTREACHED(
"Why are we here?");
114 sbLibraryUpdateListener::OnItemUpdated(
sbIMediaList *aMediaList,
127 sbLibraryUpdateListener::OnItemMoved(
sbIMediaList *aMediaList,
132 NS_NOTREACHED(
"Why are we here?");
148 class EnumerateForOriginIsInMainLibrary :
159 bool aIgnorePlaylists)
161 mTargetLibrary = aLibrary;
162 mIgnorePlaylists = aIgnorePlaylists;
176 NS_SCRIPTABLE NS_IMETHOD OnEnumerationBegin(
sbIMediaList *,
179 NS_ENSURE_STATE(mTargetLibrary);
197 NS_SCRIPTABLE NS_IMETHOD OnEnumeratedItem(
sbIMediaList *aMediaList,
201 nsCOMPtr<sbIMediaList> list = do_QueryInterface(aMediaItem);
202 if (!list || !mIgnorePlaylists)
204 NS_NAMED_LITERAL_STRING(SB_PROPERTY_FALSE,
"0");
208 rv = aMediaItem->SetProperty(
211 NS_ENSURE_SUCCESS(rv, rv);
223 NS_SCRIPTABLE NS_IMETHOD OnEnumerationEnd(
sbIMediaList *,
224 nsresult aStatusCode)
239 NS_ENSURE_STATE(mTargetLibrary);
241 rv = mTargetLibrary->EnumerateAllItems(
244 NS_ENSURE_SUCCESS(rv, rv);
249 nsCOMPtr<sbILibrary> mTargetLibrary;
250 bool mIgnorePlaylists;
259 sbLibraryUpdateListener::OnListCleared(
sbIMediaList *aMediaList,
260 PRBool aExcludeLists,
263 NS_NOTREACHED(
"Why are we here?");
272 sbLibraryUpdateListener::OnBeforeListCleared(
sbIMediaList *aMediaList,
273 PRBool aExcludeLists,
281 nsCOMPtr<sbILibrary> library = do_QueryInterface(aMediaList);
283 EnumerateForOriginIsInMainLibrary * enumerator;
284 NS_NEWXPCOM(enumerator, EnumerateForOriginIsInMainLibrary);
285 NS_ENSURE_TRUE(enumerator, NS_ERROR_OUT_OF_MEMORY);
289 NS_RELEASE(enumerator);
290 NS_ENSURE_SUCCESS(rv, rv);
299 sbLibraryUpdateListener::OnBatchBegin(
sbIMediaList *aMediaList)
305 sbLibraryUpdateListener::OnBatchEnd(
sbIMediaList *aMediaList)
NS_IMPL_ISUPPORTS1(sbDeviceCapabilitiesUtils, sbIDeviceCapabilitiesUtils) sbDeviceCapabilitiesUtils
static nsresult SetOriginIsInMainLibrary(sbIMediaItem *aMediaItem, sbILibrary *aDevLibrary, PRBool aMark)
NS_IMPL_THREADSAFE_ISUPPORTS1(sbDeviceCapsCompatibility, sbIDeviceCapsCompatibility) sbDeviceCapsCompatibility
virtual ~sbLibraryUpdateListener()
sbILibrary * mTargetLibrary
#define SB_PROPERTY_ORIGIN_IS_IN_MAIN_LIBRARY
Media library abstraction.
An interface to carry around arrays of nsIProperty instances. Users of this interface should only QI ...