Cleanup - Use RemoveAllChildren() over DisposeAllChildren() (#39848)
* Content - change the (should-be-obsolete) DisposeAllChildren into the more robust RemoveAllChildren. * Remove duplicate calls. --------- Co-authored-by: ElectroJr <leonsfriedrich@gmail.com>
This commit is contained in:
@@ -25,7 +25,7 @@ namespace Content.Client.Access.UI
|
||||
public void SetAccessLevels(IPrototypeManager protoManager, List<ProtoId<AccessLevelPrototype>> accessLevels)
|
||||
{
|
||||
_accessButtons.Clear();
|
||||
AccessLevelGrid.DisposeAllChildren();
|
||||
AccessLevelGrid.RemoveAllChildren();
|
||||
|
||||
foreach (var access in accessLevels)
|
||||
{
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Content.Client.Access.UI
|
||||
|
||||
public void SetAllowedIcons(string currentJobIconId)
|
||||
{
|
||||
IconGrid.DisposeAllChildren();
|
||||
IconGrid.RemoveAllChildren();
|
||||
|
||||
var jobIconButtonGroup = new ButtonGroup();
|
||||
var i = 0;
|
||||
|
||||
@@ -99,8 +99,8 @@ public sealed partial class GroupedAccessLevelChecklist : BoxContainer
|
||||
|
||||
private bool TryRebuildAccessGroupControls()
|
||||
{
|
||||
AccessGroupList.DisposeAllChildren();
|
||||
AccessLevelChecklist.DisposeAllChildren();
|
||||
AccessGroupList.RemoveAllChildren();
|
||||
AccessLevelChecklist.RemoveAllChildren();
|
||||
|
||||
// No access level prototypes were assigned to any of the access level groups.
|
||||
// Either the turret controller has no assigned access levels or their names were invalid.
|
||||
@@ -165,7 +165,7 @@ public sealed partial class GroupedAccessLevelChecklist : BoxContainer
|
||||
/// </summary>
|
||||
public void RebuildAccessLevelsControls()
|
||||
{
|
||||
AccessLevelChecklist.DisposeAllChildren();
|
||||
AccessLevelChecklist.RemoveAllChildren();
|
||||
_accessLevelEntries.Clear();
|
||||
|
||||
// No access level prototypes were assigned to any of the access level groups
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace Content.Client.Administration.UI.ManageSolutions
|
||||
/// </summary>
|
||||
public void UpdateReagents()
|
||||
{
|
||||
ReagentList.DisposeAllChildren();
|
||||
ReagentList.RemoveAllChildren();
|
||||
|
||||
if (_selectedSolution == null || _solutions == null)
|
||||
return;
|
||||
@@ -92,7 +92,7 @@ namespace Content.Client.Administration.UI.ManageSolutions
|
||||
/// <param name="solution">The selected solution.</param>
|
||||
private void UpdateVolumeBox(Solution solution)
|
||||
{
|
||||
VolumeBox.DisposeAllChildren();
|
||||
VolumeBox.RemoveAllChildren();
|
||||
|
||||
var volumeLabel = new Label();
|
||||
volumeLabel.HorizontalExpand = true;
|
||||
@@ -131,7 +131,7 @@ namespace Content.Client.Administration.UI.ManageSolutions
|
||||
/// <param name="solution">The selected solution.</param>
|
||||
private void UpdateThermalBox(Solution solution)
|
||||
{
|
||||
ThermalBox.DisposeAllChildren();
|
||||
ThermalBox.RemoveAllChildren();
|
||||
var heatCap = solution.GetHeatCapacity(null);
|
||||
var specificHeatLabel = new Label();
|
||||
specificHeatLabel.HorizontalExpand = true;
|
||||
|
||||
@@ -206,7 +206,7 @@ namespace Content.Client.Cargo.UI
|
||||
if (!_orderConsoleQuery.TryComp(_owner, out var orderConsole))
|
||||
return;
|
||||
|
||||
Requests.DisposeAllChildren();
|
||||
Requests.RemoveAllChildren();
|
||||
|
||||
foreach (var order in orders)
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Content.Client.Cargo.UI
|
||||
|
||||
public void SetOrders(SpriteSystem sprites, IPrototypeManager protoManager, List<CargoOrderData> orders)
|
||||
{
|
||||
Orders.DisposeAllChildren();
|
||||
Orders.RemoveAllChildren();
|
||||
|
||||
foreach (var order in orders)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Content.Client.CrewManifest.UI;
|
||||
using Content.Client.CrewManifest.UI;
|
||||
using Content.Shared.CrewManifest;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
@@ -21,7 +21,6 @@ public sealed partial class CrewManifestUiFragment : BoxContainer
|
||||
|
||||
public void UpdateState(string stationName, CrewManifestEntries? entries)
|
||||
{
|
||||
CrewManifestListing.DisposeAllChildren();
|
||||
CrewManifestListing.RemoveAllChildren();
|
||||
|
||||
StationNameContainer.Visible = entries != null;
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace Content.Client.Changelog
|
||||
// Changelog is not kept in memory so load it again.
|
||||
var changelogs = await _changelog.LoadChangelog();
|
||||
|
||||
Tabs.DisposeAllChildren();
|
||||
Tabs.RemoveAllChildren();
|
||||
|
||||
var i = 0;
|
||||
foreach (var changelog in changelogs)
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace Content.Client.ContextMenu.UI
|
||||
/// </summary>
|
||||
public void Close()
|
||||
{
|
||||
RootMenu.MenuBody.DisposeAllChildren();
|
||||
RootMenu.MenuBody.RemoveAllChildren();
|
||||
CancelOpen?.Cancel();
|
||||
CancelClose?.Cancel();
|
||||
OnContextClosed?.Invoke();
|
||||
|
||||
@@ -293,7 +293,7 @@ namespace Content.Client.ContextMenu.UI
|
||||
var element = new EntityMenuElement(entity);
|
||||
element.SubMenu = new ContextMenuPopup(_context, element);
|
||||
element.SubMenu.OnPopupOpen += () => _verb.OpenVerbMenu(entity, popup: element.SubMenu);
|
||||
element.SubMenu.OnPopupHide += element.SubMenu.MenuBody.DisposeAllChildren;
|
||||
element.SubMenu.OnPopupHide += element.SubMenu.MenuBody.RemoveAllChildren;
|
||||
_context.AddElement(menu, element);
|
||||
Elements.TryAdd(entity, element);
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace Content.Client.Crayon.UI
|
||||
private void RefreshList()
|
||||
{
|
||||
// Clear
|
||||
Grids.DisposeAllChildren();
|
||||
Grids.RemoveAllChildren();
|
||||
|
||||
if (_decals == null || _allDecals == null)
|
||||
return;
|
||||
|
||||
@@ -18,7 +18,6 @@ public sealed partial class CrewManifestUi : DefaultWindow
|
||||
|
||||
public void Populate(string name, CrewManifestEntries? entries)
|
||||
{
|
||||
CrewManifestListing.DisposeAllChildren();
|
||||
CrewManifestListing.RemoveAllChildren();
|
||||
|
||||
StationNameContainer.Visible = entries != null;
|
||||
|
||||
@@ -72,7 +72,7 @@ public sealed partial class GatewayWindow : FancyWindow,
|
||||
_isUnlockPending = _nextUnlock >= _timing.CurTime;
|
||||
_isCooldownPending = _nextReady >= _timing.CurTime;
|
||||
|
||||
Container.DisposeAllChildren();
|
||||
Container.RemoveAllChildren();
|
||||
|
||||
if (_destinations.Count == 0)
|
||||
{
|
||||
|
||||
@@ -116,7 +116,7 @@ namespace Content.Client.HealthAnalyzer.UI
|
||||
AlertsContainer.Visible = showAlerts;
|
||||
|
||||
if (showAlerts)
|
||||
AlertsContainer.DisposeAllChildren();
|
||||
AlertsContainer.RemoveAllChildren();
|
||||
|
||||
if (msg.Unrevivable == true)
|
||||
AlertsContainer.AddChild(new RichTextLabel
|
||||
|
||||
@@ -404,7 +404,7 @@ public sealed partial class MarkingPicker : Control
|
||||
|
||||
var stateNames = GetMarkingStateNames(prototype);
|
||||
_currentMarkingColors.Clear();
|
||||
CMarkingColors.DisposeAllChildren();
|
||||
CMarkingColors.RemoveAllChildren();
|
||||
List<ColorSelectorSliders> colorSliders = new();
|
||||
for (int i = 0; i < prototype.Sprites.Count; i++)
|
||||
{
|
||||
|
||||
@@ -216,7 +216,6 @@ public sealed partial class SingleMarkingPicker : BoxContainer
|
||||
|
||||
var marking = _markings[Slot];
|
||||
|
||||
ColorSelectorContainer.DisposeAllChildren();
|
||||
ColorSelectorContainer.RemoveAllChildren();
|
||||
|
||||
if (marking.MarkingColors.Count != proto.Sprites.Count)
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace Content.Client.Lobby.UI
|
||||
public void ReloadCharacterPickers()
|
||||
{
|
||||
_createNewCharacterButton.Orphan();
|
||||
Characters.DisposeAllChildren();
|
||||
Characters.RemoveAllChildren();
|
||||
|
||||
var numberOfFullSlots = 0;
|
||||
var characterButtonsGroup = new ButtonGroup();
|
||||
|
||||
@@ -491,7 +491,7 @@ namespace Content.Client.Lobby.UI
|
||||
/// </summary>
|
||||
public void RefreshTraits()
|
||||
{
|
||||
TraitsList.DisposeAllChildren();
|
||||
TraitsList.RemoveAllChildren();
|
||||
|
||||
var traits = _prototypeManager.EnumeratePrototypes<TraitPrototype>().OrderBy(t => Loc.GetString(t.Name)).ToList();
|
||||
TabContainer.SetTabTitle(3, Loc.GetString("humanoid-profile-editor-traits-tab"));
|
||||
@@ -632,7 +632,7 @@ namespace Content.Client.Lobby.UI
|
||||
|
||||
public void RefreshAntags()
|
||||
{
|
||||
AntagList.DisposeAllChildren();
|
||||
AntagList.RemoveAllChildren();
|
||||
var items = new[]
|
||||
{
|
||||
("humanoid-profile-editor-antag-preference-yes-button", 0),
|
||||
@@ -826,7 +826,7 @@ namespace Content.Client.Lobby.UI
|
||||
/// </summary>
|
||||
public void RefreshJobs()
|
||||
{
|
||||
JobList.DisposeAllChildren();
|
||||
JobList.RemoveAllChildren();
|
||||
_jobCategories.Clear();
|
||||
_jobPriorities.Clear();
|
||||
var firstCategory = true;
|
||||
|
||||
@@ -42,7 +42,7 @@ public sealed partial class LoadoutGroupContainer : BoxContainer
|
||||
{
|
||||
var protoMan = collection.Resolve<IPrototypeManager>();
|
||||
var loadoutSystem = collection.Resolve<IEntityManager>().System<LoadoutSystem>();
|
||||
RestrictionsContainer.DisposeAllChildren();
|
||||
RestrictionsContainer.RemoveAllChildren();
|
||||
|
||||
if (_groupProto.MinLimit > 0)
|
||||
{
|
||||
@@ -71,7 +71,7 @@ public sealed partial class LoadoutGroupContainer : BoxContainer
|
||||
});
|
||||
}
|
||||
|
||||
LoadoutsContainer.DisposeAllChildren();
|
||||
LoadoutsContainer.RemoveAllChildren();
|
||||
|
||||
// Get all loadout prototypes for this group.
|
||||
var validProtos = _groupProto.Loadouts.Select(id => protoMan.Index(id));
|
||||
|
||||
@@ -43,7 +43,7 @@ public sealed partial class LobbyCharacterPreviewPanel : Control
|
||||
|
||||
_previewDummy = uid;
|
||||
|
||||
ViewBox.DisposeAllChildren();
|
||||
ViewBox.RemoveAllChildren();
|
||||
var spriteView = new SpriteView
|
||||
{
|
||||
OverrideDirection = Direction.South,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Numerics;
|
||||
using System.Numerics;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.UserInterface;
|
||||
@@ -37,7 +37,7 @@ public sealed partial class MappingPrototypeList : Control
|
||||
{
|
||||
_prototypes.Clear();
|
||||
|
||||
PrototypeList.DisposeAllChildren();
|
||||
PrototypeList.RemoveAllChildren();
|
||||
|
||||
_prototypes.AddRange(prototypes);
|
||||
|
||||
@@ -99,7 +99,7 @@ public sealed partial class MappingPrototypeList : Control
|
||||
public void Search(List<MappingPrototype> prototypes)
|
||||
{
|
||||
_search.Clear();
|
||||
SearchList.DisposeAllChildren();
|
||||
SearchList.RemoveAllChildren();
|
||||
_lastIndices = (0, -1);
|
||||
|
||||
_search.AddRange(prototypes);
|
||||
|
||||
@@ -861,7 +861,7 @@ public sealed class MappingState : GameplayStateBase
|
||||
}
|
||||
else
|
||||
{
|
||||
button.ChildrenPrototypes.DisposeAllChildren();
|
||||
button.ChildrenPrototypes.RemoveAllChildren();
|
||||
button.CollapseButton.Label.Text = "▶";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,8 +53,8 @@ public sealed partial class PowerMonitoringWindow
|
||||
// Selection action
|
||||
windowEntry.Button.OnButtonUp += args =>
|
||||
{
|
||||
windowEntry.SourcesContainer.DisposeAllChildren();
|
||||
windowEntry.LoadsContainer.DisposeAllChildren();
|
||||
windowEntry.SourcesContainer.RemoveAllChildren();
|
||||
windowEntry.LoadsContainer.RemoveAllChildren();
|
||||
ButtonAction(windowEntry, masterContainer);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ public sealed partial class OfferingWindow : FancyWindow,
|
||||
|
||||
public void ClearOptions()
|
||||
{
|
||||
Container.DisposeAllChildren();
|
||||
Container.RemoveAllChildren();
|
||||
}
|
||||
|
||||
protected override void FrameUpdate(FrameEventArgs args)
|
||||
|
||||
@@ -67,8 +67,8 @@ public sealed partial class DockingScreen : BoxContainer
|
||||
{
|
||||
DockingControl.BuildDocks(shuttle);
|
||||
var currentDock = DockingControl.ViewedDock;
|
||||
// DockedWith.DisposeAllChildren();
|
||||
DockPorts.DisposeAllChildren();
|
||||
// DockedWith.RemoveAllChildren();
|
||||
DockPorts.RemoveAllChildren();
|
||||
_ourDockButtons.Clear();
|
||||
|
||||
if (shuttle == null)
|
||||
|
||||
@@ -59,7 +59,7 @@ public sealed partial class EmergencyConsoleWindow : FancyWindow,
|
||||
// TODO: Loc and cvar for this.
|
||||
_earlyLaunchTime = scc.EarlyLaunchTime;
|
||||
|
||||
AuthorizationsContainer.DisposeAllChildren();
|
||||
AuthorizationsContainer.RemoveAllChildren();
|
||||
var remainingAuths = scc.AuthorizationsRequired - scc.Authorizations.Count;
|
||||
AuthorizationCount.Text = Loc.GetString("emergency-shuttle-ui-remaining", ("remaining", remainingAuths));
|
||||
|
||||
|
||||
@@ -237,7 +237,7 @@ public sealed partial class MapScreen : BoxContainer
|
||||
private void ClearMapObjects()
|
||||
{
|
||||
_mapObjectControls.Clear();
|
||||
HyperspaceDestinations.DisposeAllChildren();
|
||||
HyperspaceDestinations.RemoveAllChildren();
|
||||
_pendingMapObjects.Clear();
|
||||
_mapObjects.Clear();
|
||||
_mapHeadings.Clear();
|
||||
|
||||
@@ -25,9 +25,9 @@ namespace Content.Client.Strip
|
||||
|
||||
public void ClearButtons()
|
||||
{
|
||||
InventoryContainer.DisposeAllChildren();
|
||||
HandsContainer.DisposeAllChildren();
|
||||
SnareContainer.DisposeAllChildren();
|
||||
InventoryContainer.RemoveAllChildren();
|
||||
HandsContainer.RemoveAllChildren();
|
||||
SnareContainer.RemoveAllChildren();
|
||||
}
|
||||
|
||||
protected override void FrameUpdate(FrameEventArgs args)
|
||||
|
||||
@@ -29,7 +29,7 @@ public sealed partial class ThiefBackpackMenu : FancyWindow
|
||||
|
||||
public void UpdateState(ThiefBackpackBoundUserInterfaceState state)
|
||||
{
|
||||
SetsGrid.DisposeAllChildren();
|
||||
SetsGrid.RemoveAllChildren();
|
||||
var selectedNumber = 0;
|
||||
foreach (var (set, info) in state.Sets)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Numerics;
|
||||
using System.Numerics;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
@@ -19,7 +19,7 @@ namespace Content.Client.UserInterface.Controls
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
DisposeAllChildren();
|
||||
RemoveAllChildren();
|
||||
}
|
||||
|
||||
public void AddEntry(float amount, Color color, string? tooltip = null)
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Content.Client.UserInterface
|
||||
|
||||
public void UpdateValues(List<string> headers, List<string[]> values)
|
||||
{
|
||||
Values.DisposeAllChildren();
|
||||
Values.RemoveAllChildren();
|
||||
Values.Columns = headers.Count;
|
||||
|
||||
for (var i = 0; i < headers.Count; i++)
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace Content.Client.UserInterface.Systems.Ghost.Controls
|
||||
|
||||
public void Populate()
|
||||
{
|
||||
ButtonContainer.DisposeAllChildren();
|
||||
ButtonContainer.RemoveAllChildren();
|
||||
AddButtons();
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Content.Client.UserInterface.Systems.Ghost.Controls.Roles
|
||||
public void ClearEntries()
|
||||
{
|
||||
NoRolesMessage.Visible = true;
|
||||
EntryContainer.DisposeAllChildren();
|
||||
EntryContainer.RemoveAllChildren();
|
||||
_collapsibleBoxes.Clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using Content.Client.UserInterface.Systems.Inventory.Controls;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
|
||||
@@ -74,7 +74,7 @@ public sealed class HandsContainer : ItemSlotUIContainer<HandButton>
|
||||
public void Clear()
|
||||
{
|
||||
ClearButtons();
|
||||
_grid.DisposeAllChildren();
|
||||
_grid.RemoveAllChildren();
|
||||
}
|
||||
|
||||
public IEnumerable<HandButton> GetButtons()
|
||||
|
||||
@@ -109,7 +109,7 @@ namespace Content.Client.Verbs.UI
|
||||
Close();
|
||||
|
||||
var menu = popup ?? _context.RootMenu;
|
||||
menu.MenuBody.DisposeAllChildren();
|
||||
menu.MenuBody.RemoveAllChildren();
|
||||
|
||||
CurrentTarget = target;
|
||||
CurrentVerbs = _verbSystem.GetVerbs(target, user, Verb.VerbTypes, out ExtraCategories, force);
|
||||
@@ -207,7 +207,7 @@ namespace Content.Client.Verbs.UI
|
||||
/// </summary>
|
||||
public void AddServerVerbs(List<Verb>? verbs, ContextMenuPopup popup)
|
||||
{
|
||||
popup.MenuBody.DisposeAllChildren();
|
||||
popup.MenuBody.RemoveAllChildren();
|
||||
|
||||
// Verbs may be null if the server does not think we can see the target entity. This **should** not happen.
|
||||
if (verbs == null)
|
||||
|
||||
Reference in New Issue
Block a user