Skip to content

Commit

Permalink
Fix minor problem with trayListener
Browse files Browse the repository at this point in the history
  • Loading branch information
AzzamAlsharafi committed Aug 26, 2022
1 parent 09c29f5 commit 0e07ffc
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const SystemMenu = GObject.registerClass(
addOptionsToMenu(this.subMenu.menu);
}

destroy(){
destroy() {
this.subMenu.destroy();
super.destroy();
}
Expand Down Expand Up @@ -99,7 +99,7 @@ function addOptionsToMenu(menu) {
}
}

function updateLocation(trayLocation){
function updateLocation(trayLocation) {
if (trayLocation) {
if (systemMenu != null) {
systemMenu.destroy();
Expand Down Expand Up @@ -131,13 +131,15 @@ function enable() {

updateLocation(settings.get_boolean("tray-location"));

settings.connect("changed::tray-location", () => {
trayListener = settings.connect("changed::tray-location", () => {
updateLocation(settings.get_boolean("tray-location"));
})
}

function disable() {
settings.disconnect(trayListener);
if (trayListener != null) {
settings.disconnect(trayListener);
}

if (trayMenu != null) {
trayMenu.destroy();
Expand Down

0 comments on commit 0e07ffc

Please sign in to comment.