Commit 382bf3b6 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

IDeviceLister: Specify if a plugged device was inserted for the first time

parent f4882321
......@@ -36,8 +36,9 @@ public:
* @brief onDevicePlugged Shall be invoked when a known device gets plugged
* @param uuid The device UUID
* @param mountpoint The device new mountpoint
* @returns true is the device was unknown. false otherwise
*/
virtual void onDevicePlugged( const std::string& uuid, const std::string& mountpoint ) = 0;
virtual bool onDevicePlugged( const std::string& uuid, const std::string& mountpoint ) = 0;
/**
* @brief onDeviceUnplugged Shall be invoked when a known device gets unplugged
* @param uuid The device UUID
......
......@@ -780,9 +780,11 @@ void MediaLibrary::setLogger( ILogger* logger )
Log::SetLogger( logger );
}
void MediaLibrary::onDevicePlugged( const std::string& uuid, const std::string& mountpoint )
bool MediaLibrary::onDevicePlugged( const std::string& uuid, const std::string& mountpoint )
{
auto currentDevice = Device::fromUuid( this, uuid );
LOG_INFO( "Device ", uuid, " was plugged and mounted on ", mountpoint );
assert( currentDevice == nullptr || currentDevice->isPresent() == false );
for ( const auto& fsFactory : m_fsFactories )
{
if ( fsFactory->isMrlSupported( "file://" ) )
......@@ -791,6 +793,7 @@ void MediaLibrary::onDevicePlugged( const std::string& uuid, const std::string&
break;
}
}
return currentDevice == nullptr;
}
void MediaLibrary::onDeviceUnplugged( const std::string& uuid )
......
......@@ -157,7 +157,7 @@ class MediaLibrary : public IMediaLibrary, public IDeviceListerCb
// Mark IDeviceListerCb callbacks as private. They must be invoked through the interface.
private:
virtual void onDevicePlugged(const std::string& uuid, const std::string& mountpoint) override;
virtual bool onDevicePlugged( const std::string& uuid, const std::string& mountpoint ) override;
virtual void onDeviceUnplugged(const std::string& uuid) override;
protected:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment