forked from Mirror/Ryujinx
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)
|
private void SaveButton_Clicked(object sender, EventArgs args)
|
||||||
{
|
{
|
||||||
_dlcContainerList.Clear();
|
_dlcContainerList.Clear();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!-- Generated with glade 3.22.1 -->
|
<!-- Generated with glade 3.36.0 -->
|
||||||
<interface>
|
<interface>
|
||||||
<requires lib="gtk+" version="3.20"/>
|
<requires lib="gtk+" version="3.20"/>
|
||||||
<object class="GtkWindow" id="_dlcWindow">
|
<object class="GtkWindow" id="_dlcWindow">
|
||||||
|
@ -9,9 +9,6 @@
|
||||||
<property name="window_position">center</property>
|
<property name="window_position">center</property>
|
||||||
<property name="default_width">550</property>
|
<property name="default_width">550</property>
|
||||||
<property name="default_height">350</property>
|
<property name="default_height">350</property>
|
||||||
<child>
|
|
||||||
<placeholder/>
|
|
||||||
</child>
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox" id="MainBox">
|
<object class="GtkBox" id="MainBox">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
@ -118,6 +115,22 @@
|
||||||
<property name="position">1</property>
|
<property name="position">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</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>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">True</property>
|
<property name="expand">True</property>
|
||||||
|
@ -182,5 +195,8 @@
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
<child type="titlebar">
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</interface>
|
</interface>
|
||||||
|
|
|
@ -13,6 +13,7 @@ using Ryujinx.HLE.HOS;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
using GUI = Gtk.Builder.ObjectAttribute;
|
using GUI = Gtk.Builder.ObjectAttribute;
|
||||||
|
@ -60,19 +61,16 @@ namespace Ryujinx.Ui
|
||||||
}
|
}
|
||||||
|
|
||||||
_baseTitleInfoLabel.Text = $"Updates Available for {titleName} [{titleId.ToUpper()}]";
|
_baseTitleInfoLabel.Text = $"Updates Available for {titleName} [{titleId.ToUpper()}]";
|
||||||
|
_noUpdateRadioButton.Active = true;
|
||||||
|
|
||||||
foreach (string path in _titleUpdateWindowData.Paths)
|
foreach (string path in _titleUpdateWindowData.Paths)
|
||||||
{
|
{
|
||||||
AddUpdate(path, false);
|
AddUpdate(path, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
_noUpdateRadioButton.Active = true;
|
foreach ((RadioButton update, var _) in _radioButtonToPathDictionary.Where(keyValuePair => keyValuePair.Value == _titleUpdateWindowData.Selected))
|
||||||
foreach (KeyValuePair<RadioButton, string> keyValuePair in _radioButtonToPathDictionary)
|
|
||||||
{
|
{
|
||||||
if (keyValuePair.Value == _titleUpdateWindowData.Selected)
|
update.Active = true;
|
||||||
{
|
|
||||||
keyValuePair.Key.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)
|
private void AddButton_Clicked(object sender, EventArgs args)
|
||||||
{
|
{
|
||||||
FileChooserDialog fileChooser = new FileChooserDialog("Select update files", this, FileChooserAction.Open, "Cancel", ResponseType.Cancel, "Add", ResponseType.Accept)
|
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)
|
private void RemoveButton_Clicked(object sender, EventArgs args)
|
||||||
{
|
{
|
||||||
foreach (RadioButton radioButton in _noUpdateRadioButton.Group)
|
RemoveUpdates(true);
|
||||||
{
|
}
|
||||||
if (radioButton.Label != "No Update" && radioButton.Active)
|
|
||||||
{
|
private void RemoveAllButton_Clicked(object sender, EventArgs args)
|
||||||
_availableUpdatesBox.Remove(radioButton);
|
{
|
||||||
_radioButtonToPathDictionary.Remove(radioButton);
|
RemoveUpdates();
|
||||||
radioButton.Dispose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveButton_Clicked(object sender, EventArgs args)
|
private void SaveButton_Clicked(object sender, EventArgs args)
|
||||||
{
|
{
|
||||||
_titleUpdateWindowData.Paths.Clear();
|
_titleUpdateWindowData.Paths.Clear();
|
||||||
|
_titleUpdateWindowData.Selected = "";
|
||||||
|
|
||||||
foreach (string paths in _radioButtonToPathDictionary.Values)
|
foreach (string paths in _radioButtonToPathDictionary.Values)
|
||||||
{
|
{
|
||||||
_titleUpdateWindowData.Paths.Add(paths);
|
_titleUpdateWindowData.Paths.Add(paths);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!-- Generated with glade 3.22.1 -->
|
<!-- Generated with glade 3.36.0 -->
|
||||||
<interface>
|
<interface>
|
||||||
<requires lib="gtk+" version="3.20"/>
|
<requires lib="gtk+" version="3.20"/>
|
||||||
<object class="GtkWindow" id="_titleUpdateWindow">
|
<object class="GtkWindow" id="_titleUpdateWindow">
|
||||||
|
@ -7,11 +7,8 @@
|
||||||
<property name="title" translatable="yes">Ryujinx - Title Update Manager</property>
|
<property name="title" translatable="yes">Ryujinx - Title Update Manager</property>
|
||||||
<property name="modal">True</property>
|
<property name="modal">True</property>
|
||||||
<property name="window_position">center</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>
|
<property name="default_height">250</property>
|
||||||
<child>
|
|
||||||
<placeholder/>
|
|
||||||
</child>
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox" id="MainBox">
|
<object class="GtkBox" id="MainBox">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
@ -130,6 +127,22 @@
|
||||||
<property name="position">1</property>
|
<property name="position">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</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>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">True</property>
|
<property name="expand">True</property>
|
||||||
|
@ -194,5 +207,8 @@
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
<child type="titlebar">
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</interface>
|
</interface>
|
||||||
|
|
Loading…
Reference in a new issue