From bea52a21cefdd5ab6287f18ea9c0332b980fdcfb Mon Sep 17 00:00:00 2001 From: Christian Lauinger Date: Thu, 29 Feb 2024 20:11:56 +0100 Subject: [PATCH] Clutter.Container was removed --- src/helpers/shell/PanelButton.ts | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/src/helpers/shell/PanelButton.ts b/src/helpers/shell/PanelButton.ts index 172970f..d04b334 100644 --- a/src/helpers/shell/PanelButton.ts +++ b/src/helpers/shell/PanelButton.ts @@ -567,8 +567,13 @@ class PanelButton extends PanelMenu.Button { const tapAction = new Clutter.TapAction(); tapAction.connect("tap", onClick); icon.add_action(tapAction); - - const oldIcon = this.menuControls.find_child_by_name(options.name); + let oldIcon; + if (Clutter.Container === undefined) { + debugLog('No Clutter Container'); + oldIcon = this.menuControls.get_child_at_index(options.menuProps.index); + } else { + oldIcon = this.menuControls.find_child_by_name(options.name); + } if (oldIcon?.get_parent() === this.menuControls) { this.menuControls.replace_child(oldIcon, icon); @@ -715,9 +720,13 @@ class PanelButton extends PanelMenu.Button { tapAction.connect("tap", onClick); icon.add_action(tapAction); - - const oldIcon = this.buttonControls.find_child_by_name(options.name); - + let oldIcon; + if (Clutter.Container === undefined) { + debugLog('No Clutter Container'); + oldIcon = this.buttonControls.get_child_at_index(options.panelProps.index); + } else { + oldIcon = this.buttonControls.find_child_by_name(options.name); + } if (oldIcon != null) { this.buttonControls.replace_child(oldIcon, icon); } else { @@ -726,7 +735,13 @@ class PanelButton extends PanelMenu.Button { } private removeButtonControlIcon(options: ControlIconOptions) { - const icon = this.buttonControls.find_child_by_name(options.name); + let icon; + if (Clutter.Container === undefined) { + debugLog('No Clutter Container'); + icon = this.buttonControls.get_child_at_index(options.menuProps.index); + } else { + icon = this.buttonControls.find_child_by_name(options.name); + } if (icon != null) { this.buttonControls.remove_child(icon);