From 9e4f470f98037860346d7902b84b0407099dba1d Mon Sep 17 00:00:00 2001
From: Slic3rPE <slic3r@Slic3rPEs-MacBook-Pro.local>
Date: Wed, 11 Dec 2019 10:16:32 +0100
Subject: [PATCH] macos better wrapper

---
 src/slic3r/GUI/RemovableDriveManager.hpp  | 29 +++++++++++++----------
 src/slic3r/GUI/RemovableDriveManagerMM.mm | 21 +++++++---------
 2 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/src/slic3r/GUI/RemovableDriveManager.hpp b/src/slic3r/GUI/RemovableDriveManager.hpp
index 202680328..cbf6f53aa 100644
--- a/src/slic3r/GUI/RemovableDriveManager.hpp
+++ b/src/slic3r/GUI/RemovableDriveManager.hpp
@@ -6,6 +6,10 @@
 
 namespace Slic3r {
 namespace GUI {
+class RDMMMWrapper;
+#if __APPLE__
+
+    
 struct DriveData
 {
 	std::string name;
@@ -57,25 +61,24 @@ private:
 	//INT_PTR WINAPI WinProcCallback(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
 #else
 #if __APPLE__
-	RemovableDriveManagerMM * m_rdmmm;
+	RDMMMWrapper * m_rdmmm;
  #endif
     void search_path(const std::string &path, const std::string &parent_path);
     void inspect_file(const std::string &path, const std::string &parent_path);
     bool compare_filesystem_id(const std::string &path_a, const std::string &path_b);
 #endif
 };
-#if __APPLE__
-class RemovableDriveManagerMM
-{
-public:
-	RemovableDriveManagerMM();
-	~RemovableDriveManagerMM();
-	register_window();
-	list_devices();
-private:
-	RemovableDriveManagerMMImpl *m_imp;
-	friend void RemovableDriveManager::inspect_file(const std::string &path, const std::string &parent_path);
-};
+    class RDMMMWrapper
+    {
+    public:
+        RDMMMWrapper();
+        ~RDMMMWrapper();
+        void register_window();
+        void list_devices();
+    private:
+        void *m_imp;
+        friend void RemovableDriveManager::inspect_file(const std::string &path, const std::string &parent_path);
+    };
 #endif
 }}
 #endif
diff --git a/src/slic3r/GUI/RemovableDriveManagerMM.mm b/src/slic3r/GUI/RemovableDriveManagerMM.mm
index 25fa6da09..269a2255b 100644
--- a/src/slic3r/GUI/RemovableDriveManagerMM.mm
+++ b/src/slic3r/GUI/RemovableDriveManagerMM.mm
@@ -36,31 +36,28 @@
 }
 namespace Slic3r {
 namespace GUI {
-struct RemovableDriveManagerMMImpl{
-	RemovableDriveManagerMM * wrap;
+RDMMMWrapper::RDMMMWrapper():m_imp(nullptr){
+	m_imp = [[RemovableDriveManagerMM alloc] init];
 }
-RemovableDriveManagerMM():impl(new RemovableDriveManagerMMImpl){
-	impl->wrap = [[RemovableDriveManagerMM alloc] init];
-}
-RemovableDriveManagerMM::~RemovableDriveManagerMM()
+RDMMMWrapper::~RDMMMWrapper()
 {
-	if(impl)
+	if(m_imp)
 	{
-		[impl->wrap release];
+		[m_imp release];
 	}
 }
 void  RDMMMWrapper::register_window()
 {
-	if(impl->wrap)
+	if(m_imp)
 	{
-		[impl->wrap add_unmount_observer];
+		[m_imp add_unmount_observer];
 	}
 }
 void  RDMMMWrapper::list_devices()
 {
-    if(impl->wrap)
+    if(m_imp)
     {
-    	NSArray* devices = [impl->wrap list_dev];
+    	NSArray* devices = [m_imp list_dev];
     	for (NSString* volumePath in devices)
     	{
         	NSLog(@"%@", volumePath);