Skip to content

Commit c67df2b

Browse files
committed
Update add remove_proxy function
1 parent 46b4d07 commit c67df2b

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

extension.js

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -240,15 +240,8 @@ const FrequencyIndicator = new Lang.Class({
240240
return title_text;
241241
},
242242

243-
add_event: function () {
244-
if (this.proxy) {
245-
if (event) this.proxy.disconnectSignal (event);
246-
if (event_style) this.proxy.disconnectSignal (event_style);
247-
delete this.proxy;
248-
this.proxy = null;
249-
event = 0;
250-
event_style = 0;
251-
}
243+
add_event: function () {
244+
this.remove_proxy ();
252245
if (monitor_timeout > 0) {
253246
if (!GLib.spawn_command_line_async (EXTENSIONDIR + "/cpufreq-service")) {
254247
//error ("Unable to start cpufreq service...");
@@ -275,13 +268,19 @@ const FrequencyIndicator = new Lang.Class({
275268
//else GLib.spawn_command_line_async ("killall cpufreq-service");
276269
},
277270

278-
remove_events: function () {
271+
remove_proxy: function () {
279272
if (this.proxy) {
280273
if (event) this.proxy.disconnectSignal (event);
274+
if (event_style) this.proxy.disconnectSignal (event_style);
281275
delete this.proxy;
282-
this.proxy = null;
283-
event = 0;
284276
}
277+
this.proxy = null;
278+
event = 0;
279+
event_style = 0;
280+
},
281+
282+
remove_events: function () {
283+
this.remove_proxy ();
285284
if (settingsID) this.settings.disconnect (settingsID);
286285
if (powerID) this.power.disconnect (powerID);
287286
if (monitor_event) GLib.source_remove (monitor_event);

0 commit comments

Comments
 (0)