callback only for used device

This commit is contained in:
David Kocik 2019-12-06 13:17:36 +01:00
parent 822ffa6c86
commit 0f18e7e7ec
2 changed files with 2 additions and 2 deletions

View file

@ -479,7 +479,7 @@ void RemovableDriveManager::check_and_notify()
if(m_drives_count != m_current_drives.size())
{
//std::cout<<" vs "<< m_current_drives.size();
if(m_drives_count > m_current_drives.size())
if(m_drives_count > m_current_drives.size() && m_last_save_path != "" && !is_drive_mounted(m_last_save_path))
{
for (auto it = m_callbacks.begin(); it != m_callbacks.end(); ++it)
{

View file

@ -30,7 +30,7 @@ public:
std::string get_last_drive_path();
std::vector<DriveData> get_all_drives();
bool is_path_on_removable_drive(const std::string &path);
void add_callback(std::function<void()> callback); // callback will notify every drive removal. to see if it was last used drive call is_last_drive_removed()
void add_callback(std::function<void()> callback); // callback will notify only if device with last save path was removed
void set_last_save_path(const std::string &path);
bool is_last_drive_removed(); //if we dont need info about this drive, call reset_last_save_path();
bool is_last_drive_removed_with_update(const long time = 0); // param as update()