Skip to content

Commit

Permalink
Merge pull request #3 from atisne/fix-rewrite_functions
Browse files Browse the repository at this point in the history
Homogenise the syntax of functions
  • Loading branch information
guyou committed Apr 10, 2020
2 parents df90730 + 175ad41 commit 2438a4c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
24 changes: 12 additions & 12 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const VpnIndicator = new Lang.Class({
this.parent(0.0, "VPN Indicator", false);
},

enable () {
enable: function () {
// Create the button with label for the panel
let button = new St.Bin({
style_class: 'panel-button',
Expand Down Expand Up @@ -124,7 +124,7 @@ const VpnIndicator = new Lang.Class({
this._refresh();
},

_refresh () {
_refresh: function () {
// Stop the refreshes
this._clearTimeout();

Expand Down Expand Up @@ -168,7 +168,7 @@ const VpnIndicator = new Lang.Class({
}
},

_updateMenu (vpnStatus, statusText) {
_updateMenu: function (vpnStatus, statusText) {
// Set the status text on the menu
_statusLabel.text = vpnStatus.panelText;

Expand All @@ -177,7 +177,7 @@ const VpnIndicator = new Lang.Class({
_disconnectMenuItem.actor.reactive = vpnStatus.canDisconnect;
},

_updatePanel(vpnStatus) {
_updatePanel: function (vpnStatus) {
// Update the panel button
_panelLabel.text = vpnStatus.panelText;
_panelLabel.style_class = vpnStatus.styleClass;
Expand All @@ -201,7 +201,7 @@ const VpnIndicator = new Lang.Class({
}
},

_spawn (cmd, state) {
_spawn: function (cmd, state) {
let [successP, argv] = this._parseCmd(cmd);
if (successP) {
let successS, pid;
Expand Down Expand Up @@ -244,30 +244,30 @@ const VpnIndicator = new Lang.Class({
}
},

_connect () {
_connect: function () {
// Run the connect command
this._spawn(CMD_CONNECT, _states["GlobalProtect status: Connecting"]);
},

_disconnect () {
_disconnect: function () {
// Run the disconnect command
this._spawn(CMD_DISCONNECT, _states["GlobalProtect status: Disconnecting"]);
},

_clearTimeout () {
_clearTimeout: function () {
// Remove the refresh timer if active
if (this._timeout) {
Mainloop.source_remove(this._timeout);
this._timeout = undefined;
}
},

_setTimeout (timeoutDuration) {
_setTimeout: function (timeoutDuration) {
// Refresh after an interval
this._timeout = Mainloop.timeout_add_seconds(timeoutDuration, Lang.bind(this, this._refresh));
},

disable () {
disable: function () {

// Clear timeout and remove menu callback
this._clearTimeout();
Expand All @@ -281,7 +281,7 @@ const VpnIndicator = new Lang.Class({
}
},

destroy () {
destroy: function () {
// Call destroy on the parent
this.parent();
}
Expand All @@ -308,4 +308,4 @@ function disable() {

function destroy () {
_vpnIndicator.destroy();
}
}
1 change: 1 addition & 0 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"uuid": "globalprotectvpn@guyou",
"version": 1,
"shell-version": [
"3.22",
"3.28.4",
"3.34"
]
Expand Down

0 comments on commit 2438a4c

Please sign in to comment.