mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
ADD: Update disk count on any mount/umount event
This commit is contained in:
parent
d87196cbb4
commit
aa927fe682
1 changed files with 30 additions and 1 deletions
|
|
@ -88,7 +88,11 @@ function ShowOpenIconDialog(Owner: TCustomControl; var sFileName : String) : Boo
|
|||
implementation
|
||||
|
||||
uses
|
||||
LCLProc, fMain, uVFSutil, uOSUtils, uExts, uGlobs, uLng, uDCUtils, uShellExecute;
|
||||
LCLProc, fMain, uVFSutil, uOSUtils, uExts, uGlobs, uLng, uDCUtils, uShellExecute
|
||||
{$IF DEFINED(LINUX)}
|
||||
, uFileSystemWatcher, inotify
|
||||
{$ENDIF}
|
||||
;
|
||||
|
||||
var
|
||||
{$IFDEF MSWINDOWS}
|
||||
|
|
@ -735,5 +739,30 @@ begin
|
|||
FreeAndNil(opdDialog);
|
||||
end;
|
||||
|
||||
{$IFDEF LINUX}
|
||||
var
|
||||
FileSystemWatcher: TFileSystemWatcher = nil;
|
||||
type
|
||||
TFakeClass = class
|
||||
procedure OnWatcherNotifyEvent(Sender: TObject; NotifyData: PtrInt);
|
||||
end;
|
||||
|
||||
procedure TFakeClass.OnWatcherNotifyEvent(Sender: TObject; NotifyData: PtrInt);
|
||||
var
|
||||
ev: pinotify_event absolute NotifyData;
|
||||
begin
|
||||
if (ev^.mask = IN_DELETE) and (Pos('mtab', PChar(@ev^.name)) = 1) then
|
||||
frmMain.UpdateDiskCount;
|
||||
end;
|
||||
|
||||
initialization
|
||||
FileSystemWatcher:= TFileSystemWatcher.Create(nil, '/etc', [wfFileNameChange]);
|
||||
FileSystemWatcher.OnWatcherNotifyEvent:= TFakeClass.OnWatcherNotifyEvent;
|
||||
FileSystemWatcher.Active:= True;
|
||||
finalization
|
||||
if Assigned(FileSystemWatcher) then
|
||||
FreeAndNil(FileSystemWatcher);
|
||||
{$ENDIF}
|
||||
|
||||
end.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue