Monkey patching the network applet
- From: Herczeg Zsolt <zsolt94 gmail com>
- To: gnome-shell-list gnome org
- Subject: Monkey patching the network applet
- Date: Sun, 21 Oct 2012 18:59:09 +0200
HI!
Can you help me please making an extension?
I would like to make an extension with the same result as adding this after 1602 line to the
/usr/share/gnome-shell/js/ui/status/network.js
this.menu.addSettingsAction("Old network managger", 'nm-connection-editor.desktop');
If I put this directly to the file, it's perfectly works. (Adds a new settings entry, which launches the old-style network managger window)
I wanted to make an extensions, to do this without touching the network.js, but I can't get it work:
const network = imports.ui.status.network;
let network_init = null;
function init() {
network_init = network.NMApplet.prototype['_init'];
global.log('OLDNETWORK: Original func:');
global.log(network_init);
//global.log('OLDNETWORK: Menu add function:');
//global.log(network.NMApplet.menu); //This is undefined
}
function enable() {
global.log('Bekapcsolva');
network.NMApplet.prototype['_init'] = function() {
global.log('OLDNETWORK: Successful change!!');
let ret = network_init();
this.menu.addSettingsAction("Old network managger", 'nm-connection-editor.desktop');
return ret;
}
}
function disable() {
network.NMApplet.prototype['_init'] = network_init;
}Actually as the output of
global.log(network_init); i don't receive the source code found in network.js, it's just some wrapper, and the
global.log('OLDNETWORK: Successful change!!'); never runs. (So it never adds the menu item.)
I also tried to add the menu item from the extension, but the
network.NMApplet.menu is undefined, so I can't run it.
I'm new to developing gnome-shell extensions, but I would like to learn making and publishing them. Can you help me where to look for the solution?
Thanks:
Herczeg Zsolt
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]