Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace add_actor and remove_actor #503

Merged
merged 2 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions indicatorStatusIcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,15 +276,15 @@ class IndicatorStatusIcon extends BaseStatusIcon {
yAlign: Clutter.ActorAlign.CENTER,
});
this._label = new St.Label();
this._labelBin.add_actor(this._label);
this._box.add_actor(this._labelBin);
Util.addActor(this._labelBin, this._label);
Util.addActor(this._box, this._labelBin);
}
this._label.set_text(label);
if (!this._box.contains(this._labelBin))
this._box.add_actor(this._labelBin); // FIXME: why is it suddenly necessary?
Util.addActor(this._box, this._labelBin); // FIXME: why is it suddenly necessary?
} else if (this._label) {
this._labelBin.destroy_all_children();
this._box.remove_actor(this._labelBin);
Util.removeActor(this._box, this._labelBin);
this._labelBin.destroy();
delete this._labelBin;
delete this._label;
Expand Down
14 changes: 14 additions & 0 deletions util.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,20 @@ export function tryCleanupOldIndicators() {
new Set(indicators).forEach(i => i.destroy());
}

export function addActor(obj, actor) {
if (obj.add_actor)
obj.add_actor(actor);
else
obj.add_child(actor);
}

export function removeActor(obj, actor) {
if (obj.remove_actor)
obj.remove_actor(actor);
else
obj.remove_child(actor);
}

export const CancellableChild = GObject.registerClass({
Properties: {
'parent': GObject.ParamSpec.object(
Expand Down
Loading