From 3a798f74418a7b5992b5602c2d1738ec0b8b51c4 Mon Sep 17 00:00:00 2001 From: Jumar Macato Date: Sat, 3 Aug 2019 08:33:42 +0800 Subject: [PATCH] Rename to MountedDrives --- .../Platform/IMountedDriveInfoProvider.cs | 2 +- .../ManagedFileChooserSources.cs | 2 +- .../Dbus/LinuxMountedDriveInfoProvider.cs | 22 +++++++++---------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Avalonia.Controls/Platform/IMountedDriveInfoProvider.cs b/src/Avalonia.Controls/Platform/IMountedDriveInfoProvider.cs index 3ca074f695..18413ff591 100644 --- a/src/Avalonia.Controls/Platform/IMountedDriveInfoProvider.cs +++ b/src/Avalonia.Controls/Platform/IMountedDriveInfoProvider.cs @@ -16,6 +16,6 @@ namespace Avalonia.Controls.Platform /// /// Observable list of currently-mounted drives. /// - ObservableCollection CurrentDrives { get; } + ObservableCollection MountedDrives { get; } } } diff --git a/src/Avalonia.Dialogs/ManagedFileChooserSources.cs b/src/Avalonia.Dialogs/ManagedFileChooserSources.cs index 7bce866fde..0e1c2b775a 100644 --- a/src/Avalonia.Dialogs/ManagedFileChooserSources.cs +++ b/src/Avalonia.Dialogs/ManagedFileChooserSources.cs @@ -72,7 +72,7 @@ namespace Avalonia.Dialogs { var drivesInfos = AvaloniaLocator.CurrentMutable .GetService() - .CurrentDrives; + .MountedDrives; return drivesInfos .Where(x => !x.MountPath.StartsWith("/boot")) diff --git a/src/Avalonia.X11/Dbus/LinuxMountedDriveInfoProvider.cs b/src/Avalonia.X11/Dbus/LinuxMountedDriveInfoProvider.cs index 6e83b21e40..76035cb472 100644 --- a/src/Avalonia.X11/Dbus/LinuxMountedDriveInfoProvider.cs +++ b/src/Avalonia.X11/Dbus/LinuxMountedDriveInfoProvider.cs @@ -18,6 +18,7 @@ namespace Avalonia.X11.Dbus public LinuxMountedDriveInfoProvider() { this._sysDbus = Connection.System; + this.udisk2Manager = _sysDbus.CreateProxy("org.freedesktop.UDisks2", "/org/freedesktop/UDisks2"); Start(); @@ -32,7 +33,8 @@ namespace Avalonia.X11.Dbus Poll(); } - public ObservableCollection CurrentDrives { get; } = new ObservableCollection(); + + public ObservableCollection MountedDrives { get; } = new ObservableCollection(); private async void Poll() { var newDriveList = new List(); @@ -55,8 +57,6 @@ namespace Avalonia.X11.Dbus { try { - - var iblock = _sysDbus.CreateProxy("org.freedesktop.UDisks2", block.Key); var iblockProps = await iblock.GetAllAsync(); @@ -107,7 +107,7 @@ namespace Avalonia.X11.Dbus private void UpdateCollection(IEnumerable newCollection) { var newCollectionEnumerator = newCollection.GetEnumerator(); - var collectionEnumerator = CurrentDrives.GetEnumerator(); + var collectionEnumerator = MountedDrives.GetEnumerator(); var itemsToDelete = new Collection(); while (collectionEnumerator.MoveNext()) @@ -124,7 +124,7 @@ namespace Avalonia.X11.Dbus // Handle item to delete. foreach (var itemToDelete in itemsToDelete) { - CurrentDrives.Remove(itemToDelete); + MountedDrives.Remove(itemToDelete); } var i = 0; @@ -133,16 +133,16 @@ namespace Avalonia.X11.Dbus var item = newCollectionEnumerator.Current; // Handle new item. - if (!CurrentDrives.Contains(item)) + if (!MountedDrives.Contains(item)) { - CurrentDrives.Insert(i, item); + MountedDrives.Insert(i, item); } // Handle existing item, move at the good index. - if (CurrentDrives.Contains(item)) + if (MountedDrives.Contains(item)) { - int oldIndex = CurrentDrives.IndexOf(item); - CurrentDrives.Move(oldIndex, i); + int oldIndex = MountedDrives.IndexOf(item); + MountedDrives.Move(oldIndex, i); } i++; } @@ -159,7 +159,7 @@ namespace Avalonia.X11.Dbus foreach (var Disposable in Disposables) Disposable.Dispose(); - CurrentDrives?.Clear(); + MountedDrives?.Clear(); } disposedValue = true;