Open bdaase opened 5 years ago
Sorry for being late. Are there any other related errors or warnings in the log related to the extension? I am not sure why this breakage happened between versions. As I currently do not have gnome-shell 3.34, I am not able to test it.
Ubuntu 19.10 is out that includes GNOME 3.34.1 so you should be able to test your extension. It actually runs so much better than 3.32 and almost everything I use is compatible with it except for this and another extension.
OK. So this is actually apparently a really big problem that I have no clue how to fix besides rewriting a bunch of the classes to not use inheritance.
In src/widget.js
, the class PlayerMenu
is declared as:
export class PlayerMenu extends PopupMenu.PopupSubMenuMenuItem { ... }
where PopupMenu
comes from imports.ui.popupMenu
.
Now let's construct the class in question:
(new (imports['mediaplayer@hellomouse.net'].extension.extension.require('./src/widget.js').PlayerMenu)('', true))
The method hidePlayStatusIcon
can be found in PlayerMenu.prototype
. However, after constructing the class, we find that it is gone. It's not in .constructor.prototype
either. Upon further inspection, it can be seen that said object is actually an instance of PopupSubMenuMenuItem
, instead of a PlayerMenu
, as would be expected, which would explain why hidePlayStatusIcon
and other PlayerMenu
methods are gone.
Assuming gjs or gnome-shell or something in the middle just really doesn't like es6 classes, I attempted to get webpack to dumb down the code to es5 using babel. Except PopupSubMenuMenuItem
cannot be constructed without new
, and babel transpiles construction to:
_possibleConstructorReturn(this, _getPrototypeOf(PlayerUI).call(this, '', true));
I do not understand why this happens, and I cannot fix it, at least without a significant amount of work. Considering that it worked before, it might be a bug in gjs.
I apologize.
Simplest test case:
class Test extends imports.ui.popupMenu.PopupSubMenuMenuItem {
method1() {
return true;
}
}
let a = new Test('', true);
a.method1();
Output:
TypeError: a.method1 is not a function
Never mind, It's something to do with GObject which I know next to nothing about.
Edit: and there appears to be almost no documentation about GObjects in gjs either ... or the rest of gnome-shell
Edit: and there appears to be almost no documentation about GObjects in gjs either ... or the rest of gnome-shell
Otherwise, maybe https://discourse.gnome.org/ could help
@glitsj16 That's for GObjects in C. Nothing there pertains to gjs or javascript at all.
Maybe this will could help you: API PopupMenu, popupMenu.js
I think this issue relates to the problem you are dealing with : https://gitlab.gnome.org/GNOME/gnome-shell/issues/1069
You need to modify the inheritance of your classes.
It seems that the author abandoned the fork.
I have some experience with converting extensions lately. I'll try to look at this when I have some time.
When you try to enable this extension running gnome-shell 3.34 the extension does not work and you always get