diff options
author | David Kocik <kocikdav@gmail.com> | 2019-12-10 12:08:57 +0300 |
---|---|---|
committer | David Kocik <kocikdav@gmail.com> | 2019-12-13 15:51:45 +0300 |
commit | e0a12342da33ea2e79b06777c5579294094353ed (patch) | |
tree | 8aaac044705353089a462e112330b7d196da02ef /src/slic3r/GUI/RemovableDriveManagerMM.mm | |
parent | 0861b2ec591161355890779058b91a23cb7580c1 (diff) |
macos mm files
Diffstat (limited to 'src/slic3r/GUI/RemovableDriveManagerMM.mm')
-rw-r--r-- | src/slic3r/GUI/RemovableDriveManagerMM.mm | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/src/slic3r/GUI/RemovableDriveManagerMM.mm b/src/slic3r/GUI/RemovableDriveManagerMM.mm new file mode 100644 index 000000000..e4e324654 --- /dev/null +++ b/src/slic3r/GUI/RemovableDriveManagerMM.mm @@ -0,0 +1,68 @@ +#import "RemovableDriveManager.hpp" + +#import <AppKit/AppKit.h> + +@implementation RemovableDriveManagerMM + +namespace Slic3r { +namespace GUI { + +-(instancetype) init +{ + self = [super init]; + if(self) + { + [self add_unmount_observer] + } + return self; +} +-(void) on_device_unmount: (NSNotification*) notification +{ + NSLog(@"on device change"); + RemovableDriveManager::get_instance().update(); +} +-(void) add_unmount_observer +{ + [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector: @selector(on_device_unmount:) name:NSWorkspaceDidUnmountNotification object:nil]; +} + +void RemovableDriveManager::register_window() +{ + m_rdmmm = nullptr; + m_rdmmm = [[RemovableDriveManagerMM alloc] init]; +} + + +/* +-(void) RemovableDriveManager::list_devices() +{ + NSLog(@"---"); + NSArray* devices = [[NSWorkspace sharedWorkspace] mountedRemovableMedia]; + for (NSString* volumePath in listOfMedia) + { + NSLog(@"@", volumePath); + } + NSLog(@"--"); + //removable here means CD not USB :/ + NSArray* listOfMedia = [[NSWorkspace sharedWorkspace] mountedLocalVolumePaths]; + NSLog(@"%@", listOfMedia); + + for (NSString* volumePath in listOfMedia) + { + BOOL isRemovable = NO; + BOOL isWritable = NO; + BOOL isUnmountable = NO; + NSString* description = [NSString string]; + NSString* type = [NSString string]; + + BOOL result = [[NSWorkspace sharedWorkspace] getFileSystemInfoForPath:volumePath + isRemovable:&isRemovable + isWritable:&isWritable + isUnmountable:&isUnmountable + description:&description + type:&type]; + NSLog(@"Result:%i Volume: %@, Removable:%i, W:%i, Unmountable:%i, Desc:%@, type:%@", result, volumePath, isRemovable, isWritable, isUnmountable, description, type); + } +} +*/ +}}//namespace Slicer::GUI
\ No newline at end of file |