0

I'm trying to update a Gnome-shell extension. In it, I override the _init method of an object, which I'm doing like this:

function newInitAppSwitcherPopup() {
     this.parent();        
     ...
}
AltTab.AppSwitcherPopup.prototype._init = newInitAppSwitcherPopup;

The new method fails with:

JS ERROR: TypeError: The method 'parent' cannot be called

What I find very surprising here is that the parent method actually exists (if I change the name I get a "not defined" error).

What I don't understand is that the original AppSwitcherPopup._init is still using this call to parent (https://git.gnome.org/browse/gnome-shell/tree/js/ui/altTab.js?h=gnome-3-16#n54).

This was working well under Gnome 3.12, but is broken for Gnome 3.16...I guess they changed something in their GObject or inheritance models?

KrahnacK
  • 313
  • 2
  • 7

1 Answers1

0

i have a similar code working for my config widget

const MenuConfigWidget = new GObject.Class({
  Name: 'SimpleMenu.Prefs.MenuConfigWidget',
  GTypeName: 'SimpleMenuMenuConfigWidget',
  Extends: Gtk.Grid,

  _init: function(params) {
    this.parent({... }); 
    ...
  }
});

Do you extend the class our just monkey patch the _init function?

Nesta
  • 21
  • 4
  • as you can see in the provided code I just monkey patch the _init function through the prototype...are you suggesting to extend the class instead? – KrahnacK Mar 08 '16 at 05:56
  • Not absolute sure if that's the problem. Another possibility is, that GObject javascript introspection add's some kind of checks, that prevent you from calling parent() without providing proper arguments. – Nesta Mar 09 '16 at 10:23