Skip to content

Commit 31386f5

Browse files
sergio-costas3v1n0
authored andcommitted
Replace add_actor and remove_actor
Both methods must be replaced in Gnome 46.
1 parent 2fe5a2e commit 31386f5

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

indicatorStatusIcon.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,15 +276,15 @@ class IndicatorStatusIcon extends BaseStatusIcon {
276276
yAlign: Clutter.ActorAlign.CENTER,
277277
});
278278
this._label = new St.Label();
279-
this._labelBin.add_actor(this._label);
280-
this._box.add_actor(this._labelBin);
279+
Util.addActor(this._labelBin, this._label);
280+
Util.addActor(this._box, this._labelBin);
281281
}
282282
this._label.set_text(label);
283283
if (!this._box.contains(this._labelBin))
284-
this._box.add_actor(this._labelBin); // FIXME: why is it suddenly necessary?
284+
Util.addActor(this._box, this._labelBin); // FIXME: why is it suddenly necessary?
285285
} else if (this._label) {
286286
this._labelBin.destroy_all_children();
287-
this._box.remove_actor(this._labelBin);
287+
Util.removeActor(this._box, this._labelBin);
288288
this._labelBin.destroy();
289289
delete this._labelBin;
290290
delete this._label;

util.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,20 @@ export function tryCleanupOldIndicators() {
375375
new Set(indicators).forEach(i => i.destroy());
376376
}
377377

378+
export function addActor(obj, actor) {
379+
if (obj.add_actor)
380+
obj.add_actor(actor)
381+
else
382+
obj.add_child(actor)
383+
}
384+
385+
export function removeActor(obj, actor) {
386+
if (obj.remove_actor)
387+
obj.remove_actor(actor)
388+
else
389+
obj.remove_child(actor)
390+
}
391+
378392
export const CancellableChild = GObject.registerClass({
379393
Properties: {
380394
'parent': GObject.ParamSpec.object(

0 commit comments

Comments
 (0)