Gnome shell extension error

Hi, i’m developing gnome shell extension which should add element to top panel. What i’m trying to do is to give user ability to choose in which place of top panel(left|center|right) he would like to see this element. If i add element with Main.panel.addToStatusArea('stocksTicker', stocksTicker, 0, 'right') – everything works as expected.

But if i try to use Main.panel._rightBox.insert_child_at_index(stocksTicker, 0) – i get error message in logs:
clutter_actor_insert_child_at_index: assertion ‘child->priv->parent == NULL’ failed

Can anyone explain to me, why i see this message?

1 Like

Looks like a bug on GNOME’s side, what’s it asking for is the stocksTicker to be a toplevel widget

1 Like

@overlisted Thanks, created bug in gnome-shell repo.

It’s not a bug, it’s an oddity of PanelMenu.Button: The class also managed it’s own parent, this.container.

So the following will work:

 Main.panel._rightBox.insert_child_at_index(stocksTicker.container, 0);

But unless you have a very good reason, you should stick to the addToStatusArea() API. For example if we ever change PanelMenu.Button to remote that oddity, we’ll keep that API working if at all possible, while using insert_child_at_index() directly will necessarily break.

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.