|
|
@ -4,6 +4,7 @@
|
|
|
|
const Lang = imports.lang;
|
|
|
|
const Lang = imports.lang;
|
|
|
|
const St = imports.gi.St;
|
|
|
|
const St = imports.gi.St;
|
|
|
|
const Main = imports.ui.main;
|
|
|
|
const Main = imports.ui.main;
|
|
|
|
|
|
|
|
const Notify = imports.gi.Notify;
|
|
|
|
const PanelMenu = imports.ui.panelMenu;
|
|
|
|
const PanelMenu = imports.ui.panelMenu;
|
|
|
|
|
|
|
|
|
|
|
|
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
|
|
|
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
|
|
@ -11,8 +12,8 @@ const TorControlClient = Me.imports.tor_control_client.TorControlClient;
|
|
|
|
|
|
|
|
|
|
|
|
const TorIcon = 'tor';
|
|
|
|
const TorIcon = 'tor';
|
|
|
|
|
|
|
|
|
|
|
|
let torButton;
|
|
|
|
let torButton = null;
|
|
|
|
let torControlClient;
|
|
|
|
let torControlClient = null;
|
|
|
|
|
|
|
|
|
|
|
|
const TorButton = new Lang.Class({
|
|
|
|
const TorButton = new Lang.Class({
|
|
|
|
Name: 'TorButton',
|
|
|
|
Name: 'TorButton',
|
|
|
@ -43,14 +44,23 @@ function init(extensionMeta) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function enable() {
|
|
|
|
function enable() {
|
|
|
|
|
|
|
|
try {
|
|
|
|
torControlClient = new TorControlClient();
|
|
|
|
torControlClient = new TorControlClient();
|
|
|
|
torButton = new TorButton();
|
|
|
|
torButton = new TorButton();
|
|
|
|
Main.panel.addToStatusArea(torButton.Name, torButton);
|
|
|
|
Main.panel.addToStatusArea(torButton.Name, torButton);
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
|
|
Main.notifyError('Error starting extension: ' + e);
|
|
|
|
|
|
|
|
disable();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function disable() {
|
|
|
|
function disable() {
|
|
|
|
|
|
|
|
if (torButton !== null) {
|
|
|
|
torButton.destroy();
|
|
|
|
torButton.destroy();
|
|
|
|
torButton = null;
|
|
|
|
torButton = null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (torControlClient !== null) {
|
|
|
|
torControlClient.close();
|
|
|
|
torControlClient.close();
|
|
|
|
torControlClient = null;
|
|
|
|
torControlClient = null;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|