3 * Copyright (C) 2005-2013 Team XBMC
6 * This Program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
11 * This Program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with XBMC; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
21 #include "storage/IStorageProvider.h"
22 #include "HALProvider.h"
23 #include "DeviceKitDisksProvider.h"
24 #include "UDisksProvider.h"
25 #include "PosixMountProvider.h"
27 class CLinuxStorageProvider : public IStorageProvider
30 CLinuxStorageProvider()
35 if (CUDisksProvider::HasUDisks())
36 m_instance = new CUDisksProvider();
37 else if (CDeviceKitDisksProvider::HasDeviceKitDisks())
38 m_instance = new CDeviceKitDisksProvider();
41 if (m_instance == NULL)
42 m_instance = new CHALProvider();
45 if (m_instance == NULL)
46 m_instance = new CPosixMountProvider();
49 virtual ~CLinuxStorageProvider()
54 virtual void Initialize()
56 m_instance->Initialize();
64 virtual void GetLocalDrives(VECSOURCES &localDrives)
68 share.strPath = getenv("HOME");
69 share.strName = g_localizeStrings.Get(21440);
70 share.m_ignore = true;
71 share.m_iDriveType = CMediaSource::SOURCE_TYPE_LOCAL;
72 localDrives.push_back(share);
74 share.strName = g_localizeStrings.Get(21453);
75 localDrives.push_back(share);
77 m_instance->GetLocalDrives(localDrives);
80 virtual void GetRemovableDrives(VECSOURCES &removableDrives)
82 m_instance->GetRemovableDrives(removableDrives);
85 virtual bool Eject(CStdString mountpath)
87 return m_instance->Eject(mountpath);
90 virtual std::vector<CStdString> GetDiskUsage()
92 return m_instance->GetDiskUsage();
95 virtual bool PumpDriveChangeEvents(IStorageEventsCallback *callback)
97 return m_instance->PumpDriveChangeEvents(callback);
101 IStorageProvider *m_instance;