Permalink
Browse files

[WIN32] changed: move the disc detection job into Application.cpp and…

… WinEventsWin32.cpp
  • Loading branch information...
1 parent b14d2d4 commit 84b0426d37d6b38715a4eb695c5604c52d8518a3 @wsoltys wsoltys committed Jan 23, 2012
@@ -266,9 +266,10 @@
#ifdef HAS_SDL_AUDIO
#include <SDL/SDL_mixer.h>
#endif
-#ifdef _WIN32
+#ifdef TARGET_WINDOWS
#include <shlobj.h>
#include "win32util.h"
+#include "storage/DetectDVDType.h"
#endif
#ifdef HAS_XRANDR
#include "windowing/X11/XRandR.h"
@@ -1032,7 +1033,10 @@ bool CApplication::InitDirectoriesWin32()
VECSOURCES::const_iterator it;
for(it=vShare.begin();it!=vShare.end();++it)
if(g_mediaManager.GetDriveStatus(it->strPath) == DRIVE_CLOSED_MEDIA_PRESENT)
- g_application.getApplicationMessenger().OpticalMount(it->strPath);
+ {
+ CDetectDisc* discdetection = new CDetectDisc(it->strPath, false);
+ CJobManager::GetInstance().AddJob(discdetection, NULL);
+ }
// remove end
return true;
@@ -530,7 +530,7 @@ const CStdString &CDetectDVDMedia::GetDVDPath()
return m_diskPath;
}
-CDetectDisc::CDetectDisc(CStdString &strPath, bool bautorun)
+CDetectDisc::CDetectDisc(const CStdString &strPath, bool bautorun)
{
m_strPath = strPath;
m_bautorun = bautorun;
@@ -97,7 +97,7 @@ class CDetectDVDMedia : public CThread
class CDetectDisc : public CJob
{
public:
- CDetectDisc(CStdString &strPath, bool bautorun);
+ CDetectDisc(const CStdString &strPath, bool bautorun);
bool DoWork();
private:
@@ -522,7 +522,10 @@ HRESULT CWIN32Util::ToggleTray(const char cDriveLetter)
if(dwReq == IOCTL_STORAGE_EJECT_MEDIA && bRet == 1)
{
strRootFormat.Format( _T("%c:"), cDL);
- g_application.getApplicationMessenger().OpticalUnMount(strRootFormat);
+ CMediaSource share;
+ share.strPath = strRootFormat;
+ share.strName = share.strPath;
+ g_mediaManager.RemoveAutoSource(share);
}
return bRet? S_OK : S_FALSE;
}
@@ -39,6 +39,8 @@
#include "settings/Settings.h"
#include "settings/AdvancedSettings.h"
#include "peripherals/Peripherals.h"
+#include "storage/DetectDVDType.h"
+#include "utils/JobManager.h"
#ifdef _WIN32
@@ -640,7 +642,10 @@ LRESULT CALLBACK CWinEventsWin32::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, L
case SHCNE_MEDIAINSERTED:
CLog::Log(LOGDEBUG, __FUNCTION__": Drive %s Media has arrived.", drivePath);
if (GetDriveType(drivePath) == DRIVE_CDROM)
- g_application.getApplicationMessenger().OpticalMount(drivePath, true);
+ {
+ CDetectDisc* discdetection = new CDetectDisc(drivePath, true);
+ CJobManager::GetInstance().AddJob(discdetection, NULL);
+ }
else
CWin32StorageProvider::SetEvent();
break;
@@ -649,7 +654,12 @@ LRESULT CALLBACK CWinEventsWin32::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, L
case SHCNE_MEDIAREMOVED:
CLog::Log(LOGDEBUG, __FUNCTION__": Drive %s Media was removed.", drivePath);
if (GetDriveType(drivePath) == DRIVE_CDROM)
- g_application.getApplicationMessenger().OpticalUnMount(drivePath);
+ {
+ CMediaSource share;
+ share.strPath = drivePath;
+ share.strName = share.strPath;
+ g_mediaManager.RemoveAutoSource(share);
+ }
else
CWin32StorageProvider::SetEvent();
break;

0 comments on commit 84b0426

Please sign in to comment.