Add a "Remove All" button to the DLC and Update windows (#1579)
This commit is contained in:
parent
bd8d28c59d
commit
e383c41b6e
4 changed files with 86 additions and 24 deletions
|
@ -13,6 +13,7 @@ using Ryujinx.HLE.HOS;
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using GUI = Gtk.Builder.ObjectAttribute;
|
||||
|
@ -60,19 +61,16 @@ namespace Ryujinx.Ui
|
|||
}
|
||||
|
||||
_baseTitleInfoLabel.Text = $"Updates Available for {titleName} [{titleId.ToUpper()}]";
|
||||
_noUpdateRadioButton.Active = true;
|
||||
|
||||
foreach (string path in _titleUpdateWindowData.Paths)
|
||||
{
|
||||
AddUpdate(path, false);
|
||||
}
|
||||
|
||||
_noUpdateRadioButton.Active = true;
|
||||
foreach (KeyValuePair<RadioButton, string> keyValuePair in _radioButtonToPathDictionary)
|
||||
foreach ((RadioButton update, var _) in _radioButtonToPathDictionary.Where(keyValuePair => keyValuePair.Value == _titleUpdateWindowData.Selected))
|
||||
{
|
||||
if (keyValuePair.Value == _titleUpdateWindowData.Selected)
|
||||
{
|
||||
keyValuePair.Key.Active = true;
|
||||
}
|
||||
update.Active = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -131,6 +129,19 @@ namespace Ryujinx.Ui
|
|||
}
|
||||
}
|
||||
|
||||
private void RemoveUpdates(bool removeSelectedOnly = false)
|
||||
{
|
||||
foreach (RadioButton radioButton in _noUpdateRadioButton.Group)
|
||||
{
|
||||
if (radioButton.Label != "No Update" && (!removeSelectedOnly || radioButton.Active))
|
||||
{
|
||||
_availableUpdatesBox.Remove(radioButton);
|
||||
_radioButtonToPathDictionary.Remove(radioButton);
|
||||
radioButton.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void AddButton_Clicked(object sender, EventArgs args)
|
||||
{
|
||||
FileChooserDialog fileChooser = new FileChooserDialog("Select update files", this, FileChooserAction.Open, "Cancel", ResponseType.Cancel, "Add", ResponseType.Accept)
|
||||
|
@ -154,20 +165,19 @@ namespace Ryujinx.Ui
|
|||
|
||||
private void RemoveButton_Clicked(object sender, EventArgs args)
|
||||
{
|
||||
foreach (RadioButton radioButton in _noUpdateRadioButton.Group)
|
||||
{
|
||||
if (radioButton.Label != "No Update" && radioButton.Active)
|
||||
{
|
||||
_availableUpdatesBox.Remove(radioButton);
|
||||
_radioButtonToPathDictionary.Remove(radioButton);
|
||||
radioButton.Dispose();
|
||||
}
|
||||
}
|
||||
RemoveUpdates(true);
|
||||
}
|
||||
|
||||
private void RemoveAllButton_Clicked(object sender, EventArgs args)
|
||||
{
|
||||
RemoveUpdates();
|
||||
}
|
||||
|
||||
private void SaveButton_Clicked(object sender, EventArgs args)
|
||||
{
|
||||
_titleUpdateWindowData.Paths.Clear();
|
||||
_titleUpdateWindowData.Selected = "";
|
||||
|
||||
foreach (string paths in _radioButtonToPathDictionary.Values)
|
||||
{
|
||||
_titleUpdateWindowData.Paths.Add(paths);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue