ca2e09fe8b
Since we eventually want to add a system for changing the top panel contents depending on the current state of the shell, let's use the "session mode" feature for this, and add a mechanism for updating the session mode at runtime. Add support for every key besides the two functional keys, and make all the components update automatically when the session mode is changed. Add a new lock-screen mode, and make the lock screen change to this when locked. https://bugzilla.gnome.org/show_bug.cgi?id=683156
58 lines
2.6 KiB
JavaScript
58 lines
2.6 KiB
JavaScript
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
|
|
|
const Clutter = imports.gi.Clutter;
|
|
const GObject = imports.gi.GObject;
|
|
const Lang = imports.lang;
|
|
const St = imports.gi.St;
|
|
|
|
const Main = imports.ui.main;
|
|
const PanelMenu = imports.ui.panelMenu;
|
|
const PopupMenu = imports.ui.popupMenu;
|
|
const VolumeMenu = imports.ui.status.volume;
|
|
|
|
const Indicator = new Lang.Class({
|
|
Name: 'LockScreenMenuIndicator',
|
|
Extends: PanelMenu.SystemStatusButton,
|
|
|
|
_init: function() {
|
|
this.parent(null, _("Volume, network, battery"));
|
|
|
|
this._volume = Main.panel.statusArea.volume;
|
|
if (this._volume) {
|
|
this._volumeIcon = this.addIcon(null);
|
|
this._volume.mainIcon.bind_property('gicon', this._volumeIcon, 'gicon',
|
|
GObject.BindingFlags.SYNC_CREATE);
|
|
this._volume.mainIcon.bind_property('visible', this._volumeIcon, 'visible',
|
|
GObject.BindingFlags.SYNC_CREATE);
|
|
|
|
this._volumeControl = VolumeMenu.getMixerControl();
|
|
this._volumeMenu = new VolumeMenu.VolumeMenu(this._volumeControl);
|
|
this.menu.addMenuItem(this._volumeMenu);
|
|
}
|
|
|
|
this._network = Main.panel.statusArea.network;
|
|
if (this._network) {
|
|
this._networkIcon = this.addIcon(null);
|
|
this._network.mainIcon.bind_property('gicon', this._networkIcon, 'gicon',
|
|
GObject.BindingFlags.SYNC_CREATE);
|
|
this._network.mainIcon.bind_property('visible', this._networkIcon, 'visible',
|
|
GObject.BindingFlags.SYNC_CREATE);
|
|
|
|
this._networkSecondaryIcon = this.addIcon(null);
|
|
this._network.secondaryIcon.bind_property('gicon', this._networkSecondaryIcon, 'gicon',
|
|
GObject.BindingFlags.SYNC_CREATE);
|
|
this._network.secondaryIcon.bind_property('visible', this._networkSecondaryIcon, 'visible',
|
|
GObject.BindingFlags.SYNC_CREATE);
|
|
}
|
|
|
|
this._battery = Main.panel.statusArea.battery;
|
|
if (this._battery) {
|
|
this._batteryIcon = this.addIcon(null);
|
|
this._battery.mainIcon.bind_property('gicon', this._batteryIcon, 'gicon',
|
|
GObject.BindingFlags.SYNC_CREATE);
|
|
this._battery.mainIcon.bind_property('visible', this._batteryIcon, 'visible',
|
|
GObject.BindingFlags.SYNC_CREATE);
|
|
}
|
|
}
|
|
});
|