mirror of
https://github.com/GreemDev/Ryujinx
synced 2024-12-28 22:59:46 +01:00
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
This commit is contained in:
parent
5644780e6e
commit
8b8039e8b9
1 changed files with 26 additions and 3 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue