Re: How to set a button setting via extension?



hi,

Which version of gnome-shell do you use? In 3.8 the default button is shutdown (don't now if it was changed again in 3.10).

If you are using 3.6 there should already be an extension to show the shutdown button again.

cheers

Am 16.11.2013 06:57, schrieb Bazon Bloch:
Hello,

in /usr/share/gnome-shell/js/ui/status/system.js I prefer to have
        this._altSwitcher = new AltSwitcher(this._suspendAction, this._powerOffAction);
in line 352 instead of the default
        this._altSwitcher = new AltSwitcher(this._powerOffAction, this._suspendAction);

as my switching of that setting breaks with every Gnome-Shell update, I'd like to have that set by an extension.
My problems starting this are:

1. IMHO, the cleanest way would be to address that button and change its settings. But:
    (a) what does "this" stands for here? I tried PanelMenu.SystemIndicator._altSwitcher (with PanelMenu = imports.ui.panelMenu), but didn't reach it that way.
    (b) Is there a way at all to change from (this._powerOffAction, this._suspendAction) to (this._suspendAction, this._powerOffAction) for an existing button?

2. If 1 doesn't work, what would be the best way?
    (a) Try to monkeypatch the _createSubMenu() function in the indicator class? or
    (b) Remove the old button and create a new one in its place instead? (how?)

thanks,
Bazon

reference:
I'm talking about /usr/share/gnome-shell/js/ui/status/system.js:
....
const PanelMenu = imports.ui.panelMenu;
...
const Indicator = new Lang.Class({
    Name: 'SystemIndicator',
    Extends: PanelMenu.SystemIndicator,

    _createSubMenu: function() {
        let item;
        ...
        item = new PopupMenu.PopupBaseMenuItem({ reactive: false,
                                                 can_focus: false });
        ...

        this._suspendAction = this._createActionButton('media-playback-pause-symbolic', _("Suspend"));
        this._suspendAction.connect('clicked', Lang.bind(this, this._onSuspendClicked));

        this._powerOffAction = this._createActionButton('system-shutdown-symbolic', _("Power Off"));
        this._powerOffAction.connect('clicked', Lang.bind(this, this._onPowerOffClicked));

        this._altSwitcher = new AltSwitcher(this._suspendAction, this._powerOffAction);
        item.actor.add(this._altSwitcher.actor, { expand: true, x_fill: false });

        this._actionsItem = item;
        this.menu.addMenuItem(item);
    },
});


_______________________________________________
gnome-shell-list mailing list
gnome-shell-list gnome org
https://mail.gnome.org/mailman/listinfo/gnome-shell-list


-- 
00:56 <soreau> Maybe Canonical is just a division of Microsoft hired to try and take down Linux
00:56 <RAOF> Our secret is out!!!!!111111


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]