aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSera <62521228+SeraUX@users.noreply.github.com>2020-07-04 00:57:03 +0200
committerGitHub <noreply@github.com>2020-07-04 00:57:03 +0200
commit8b8039e8b9a3d57c3238a3e3c7b56c769ff18d1d (patch)
tree5efe05cc109031298ddf1b22d22d2d739f03c360
parent5644780e6e103a8b1dd61098db3097d75eeb8069 (diff)
SettingsWindow: Add the ability to add multiple game directories at once (#1314)
* SettingsWindow: Add the ability to choose multiple game directories in one go * Adressed emmauss's suggestion * Simplified the check for duplicate game directories As per Xpl0itr's and emmauss's suggestion, I simplified the loop that checks if the selected game directories are already added. * Fixed a nit
-rw-r--r--Ryujinx/Ui/SettingsWindow.cs29
1 files changed, 26 insertions, 3 deletions
diff --git a/Ryujinx/Ui/SettingsWindow.cs b/Ryujinx/Ui/SettingsWindow.cs
index 42764a7d..6e681fff 100644
--- a/Ryujinx/Ui/SettingsWindow.cs
+++ b/Ryujinx/Ui/SettingsWindow.cs
@@ -289,11 +289,34 @@ namespace Ryujinx.Ui
}
else
{
- FileChooserDialog fileChooser = new FileChooserDialog("Choose the game directory to add to the list", this, FileChooserAction.SelectFolder, "Cancel", ResponseType.Cancel, "Add", ResponseType.Accept);
+ FileChooserDialog fileChooser = new FileChooserDialog("Choose the game directory to add to the list", this, FileChooserAction.SelectFolder, "Cancel", ResponseType.Cancel, "Add", ResponseType.Accept)
+ {
+ SelectMultiple = true
+ };
if (fileChooser.Run() == (int)ResponseType.Accept)
{
- _gameDirsBoxStore.AppendValues(fileChooser.Filename);
+ foreach (string directory in fileChooser.Filenames)
+ {
+ bool directoryAdded = false;
+
+ if (_gameDirsBoxStore.GetIterFirst(out TreeIter treeIter))
+ {
+ do
+ {
+ if (directory.Equals((string)_gameDirsBoxStore.GetValue(treeIter, 0)))
+ {
+ directoryAdded = true;
+ break;
+ }
+ } while(_gameDirsBoxStore.IterNext(ref treeIter));
+ }
+
+ if (!directoryAdded)
+ {
+ _gameDirsBoxStore.AppendValues(directory);
+ }
+ }
}
fileChooser.Dispose();
@@ -413,4 +436,4 @@ namespace Ryujinx.Ui
Dispose();
}
}
-} \ No newline at end of file
+}