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
|
@ -196,6 +196,26 @@ namespace Ryujinx.Ui
|
|||
}
|
||||
}
|
||||
|
||||
private void RemoveAllButton_Clicked(object sender, EventArgs args)
|
||||
{
|
||||
List<TreeIter> toRemove = new List<TreeIter>();
|
||||
|
||||
if (_dlcTreeView.Model.GetIterFirst(out TreeIter iter))
|
||||
{
|
||||
do
|
||||
{
|
||||
toRemove.Add(iter);
|
||||
}
|
||||
while (_dlcTreeView.Model.IterNext(ref iter));
|
||||
}
|
||||
|
||||
foreach (TreeIter i in toRemove)
|
||||
{
|
||||
TreeIter j = i;
|
||||
((TreeStore)_dlcTreeView.Model).Remove(ref j);
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveButton_Clicked(object sender, EventArgs args)
|
||||
{
|
||||
_dlcContainerList.Clear();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.22.1 -->
|
||||
<!-- Generated with glade 3.36.0 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.20"/>
|
||||
<object class="GtkWindow" id="_dlcWindow">
|
||||
|
@ -9,9 +9,6 @@
|
|||
<property name="window_position">center</property>
|
||||
<property name="default_width">550</property>
|
||||
<property name="default_height">350</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="MainBox">
|
||||
<property name="visible">True</property>
|
||||
|
@ -118,6 +115,22 @@
|
|||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="_removeAllButton">
|
||||
<property name="label" translatable="yes">Remove All</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Removes the selected update</property>
|
||||
<property name="margin_left">10</property>
|
||||
<signal name="clicked" handler="RemoveAllButton_Clicked" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
|
@ -182,5 +195,8 @@
|
|||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="titlebar">
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.22.1 -->
|
||||
<!-- Generated with glade 3.36.0 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.20"/>
|
||||
<object class="GtkWindow" id="_titleUpdateWindow">
|
||||
|
@ -7,11 +7,8 @@
|
|||
<property name="title" translatable="yes">Ryujinx - Title Update Manager</property>
|
||||
<property name="modal">True</property>
|
||||
<property name="window_position">center</property>
|
||||
<property name="default_width">440</property>
|
||||
<property name="default_width">550</property>
|
||||
<property name="default_height">250</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="MainBox">
|
||||
<property name="visible">True</property>
|
||||
|
@ -130,6 +127,22 @@
|
|||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="_removeAllButton">
|
||||
<property name="label" translatable="yes">Remove All</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Removes the selected update</property>
|
||||
<property name="margin_left">10</property>
|
||||
<signal name="clicked" handler="RemoveAllButton_Clicked" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
|
@ -194,5 +207,8 @@
|
|||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="titlebar">
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
|
|
Reference in a new issue