Skip to content

Commit

Permalink
session: fix blocking ui
Browse files Browse the repository at this point in the history
  • Loading branch information
alunux committed Feb 17, 2018
1 parent 6ab1a95 commit af27d8b
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions src/panel-session-manager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -79,34 +79,49 @@ public class PanelSessionManager {
}

public async void logout () {
if (session != null) {
if (session == null) {
return;
}

Idle.add(() => {
try {
yield session.logout (0);
session.logout(0);
} catch (Error e) {
stderr.printf("Unable to logout: %s\n", e.message);
}
}
return false;
});
}

public async void reboot () {
if (session != null) {
if (session == null) {
return;
}

Idle.add(() => {
try {
yield session.reboot ();
session.reboot.begin();
} catch (Error e) {
stderr.printf("Unable to reboot: %s\n", e.message);
}
}
return false;
});
}


public async void shutdown () {
if (session != null) {
if (session == null) {
return;
}

Idle.add(() => {
try {
yield session.shutdown ();
session.shutdown.begin();
} catch (Error e) {
stderr.printf("Unable to shutdown: %s\n", e.message);
}
}
return false;
});
}

public bool can_shutdown () {
Expand Down

0 comments on commit af27d8b

Please sign in to comment.