You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
992 B
44 lines
992 B
9 years ago
|
'use strict';
|
||
|
|
||
|
const Lang = imports.lang;
|
||
|
const St = imports.gi.St;
|
||
|
const Main = imports.ui.main;
|
||
|
const PanelMenu = imports.ui.panelMenu;
|
||
|
|
||
|
const IndicatorName = "Tor";
|
||
|
const DisabledIcon = 'my-caffeine-off-symbolic';
|
||
|
const EnabledIcon = 'my-caffeine-on-symbolic';
|
||
|
const TorIcon = 'tor';
|
||
|
|
||
|
let torButton;
|
||
|
|
||
|
const TorButton = new Lang.Class({
|
||
|
Name: IndicatorName,
|
||
|
Extends: PanelMenu.Button,
|
||
|
|
||
|
_init: function(metadata, params) {
|
||
|
this.parent(null, IndicatorName);
|
||
|
this._icon = new St.Icon({
|
||
|
icon_name: TorIcon,
|
||
|
style_class: 'system-status-icon'
|
||
|
});
|
||
|
|
||
|
this.actor.add_child(this._icon);
|
||
|
}
|
||
|
});
|
||
|
|
||
|
function init(extensionMeta) {
|
||
|
let theme = imports.gi.Gtk.IconTheme.get_default();
|
||
|
theme.append_search_path(extensionMeta.path + "/icons");
|
||
|
}
|
||
|
|
||
|
function enable() {
|
||
|
torButton = new TorButton();
|
||
|
Main.panel.addToStatusArea(IndicatorName, torButton);
|
||
|
}
|
||
|
|
||
|
function disable() {
|
||
|
torButton.destroy();
|
||
|
torButton = null;
|
||
|
}
|