Author: rmottola
Date: Wed Feb 17 18:44:49 2016
New Revision: 39391
URL: http://svn.gna.org/viewcvs/gnustep?rev=39391&view=rev
Log:
Listen to NSWorkspaceDidMountNotification and NSWorkspaceDidUnmountNotification
and update FSNodeRep accordingly
Modified:
apps/gworkspace/trunk/ChangeLog
apps/gworkspace/trunk/GWorkspace/FileViewer/GWViewersManager.m
Modified: apps/gworkspace/trunk/ChangeLog
URL:
http://svn.gna.org/viewcvs/gnustep/apps/gworkspace/trunk/ChangeLog?rev=39391&r1=39390&r2=39391&view=diff
==============================================================================
--- apps/gworkspace/trunk/ChangeLog (original)
+++ apps/gworkspace/trunk/ChangeLog Wed Feb 17 18:44:49 2016
@@ -1,3 +1,8 @@
+2016-02-17 Riccardo Mottola <[email protected]>
+
+ * GWorkspace/FileViewer/GWViewersManager.m
+ Listen to NSWorkspaceDidMountNotification and
NSWorkspaceDidUnmountNotification and update FSNodeRep accordingly.
+
2016-02-17 Riccardo Mottola <[email protected]>
* FSNode/FSNodeRep.m
Modified: apps/gworkspace/trunk/GWorkspace/FileViewer/GWViewersManager.m
URL:
http://svn.gna.org/viewcvs/gnustep/apps/gworkspace/trunk/GWorkspace/FileViewer/GWViewersManager.m?rev=39391&r1=39390&r2=39391&view=diff
==============================================================================
--- apps/gworkspace/trunk/GWorkspace/FileViewer/GWViewersManager.m
(original)
+++ apps/gworkspace/trunk/GWorkspace/FileViewer/GWViewersManager.m Wed Feb
17 18:44:49 2016
@@ -61,8 +61,11 @@
if (self)
{
+ NSNotificationCenter *wsnc;
+
gworkspace = [GWorkspace gworkspace];
- helpManager = [NSHelpManager sharedHelpManager];
+ helpManager = [NSHelpManager sharedHelpManager];
+ wsnc = [[NSWorkspace sharedWorkspace] notificationCenter];
ASSIGN (bviewerHelp, [gworkspace contextHelpFromName: @"BViewer.rtfd"]);
viewers = [NSMutableArray new];
@@ -90,8 +93,20 @@
selector:
@selector(sortTypeDidChange:)
name:
@"GWSortTypeDidChangeNotification"
object: nil];
-
- [[FSNodeRep sharedInstance] setLabelWFactor: 9.0];
+
+ // should perhaps volume notification be distributed?
+ [wsnc addObserver: self
+ selector: @selector(newVolumeMounted:)
+ name: NSWorkspaceDidMountNotification
+ object: nil];
+
+
+ [wsnc addObserver: self
+ selector: @selector(mountedVolumeDidUnmount:)
+ name: NSWorkspaceDidUnmountNotification
+ object: nil];
+
+ [[FSNodeRep sharedInstance] setLabelWFactor: 9.0];
}
return self;
@@ -782,6 +797,30 @@
[defaults setObject: viewersInfo forKey: @"viewersinfo"];
}
+- (void)newVolumeMounted:(NSNotification *)notif
+{
+ NSDictionary *dict = [notif userInfo];
+ NSString *volpath = [dict objectForKey: @"NSDevicePath"];
+ FSNodeRep *fnr = [FSNodeRep sharedInstance];
+
+ if (volpath)
+ [fnr addVolumeAt:volpath];
+ else
+ NSLog(@"newVolumeMounted notification received with empty NSDevicePath");
+}
+
+- (void)mountedVolumeDidUnmount:(NSNotification *)notif
+{
+ NSDictionary *dict = [notif userInfo];
+ NSString *volpath = [dict objectForKey: @"NSDevicePath"];
+ FSNodeRep *fnr = [FSNodeRep sharedInstance];
+
+ if (volpath)
+ [fnr removeVolumeAt:volpath];
+ else
+ NSLog(@"mountedVolumeDidUnmount notification received with empty
NSDevicePath");
+}
+
@end
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs