@@ -222,11 +222,13 @@ MouseArea {
222222 focus: true
223223 text: i18n.tr("Yes")
224224 onClicked: {
225+ doOnClosedAllWindows = function(unitySessionService, rebootDialog) {
226+ return function() {
227+ unitySessionService.reboot();
228+ rebootDialog.hide();
229+ }
230+ }(unitySessionService, rebootDialog);
225231 topLevelSurfaceList.closeAllWindows();
226− doOnClosedAllWindows = function() {
227− unitySessionService.reboot();
228− rebootDialog.hide();
229− }
230232 }
231233 color: theme.palette.normal.negative
232234 Component.onCompleted: if (root.hasKeyboard) forceActiveFocus(Qt.TabFocusReason)
@@ -245,11 +247,13 @@ MouseArea {
245247 focus: true
246248 text: i18n.ctr("Button: Power off the system", "Power off")
247249 onClicked: {
250+ doOnClosedAllWindows = function(root, powerDialog) {
251+ return function() {
252+ powerDialog.hide();
253+ root.powerOffClicked();
254+ }
255+ }(root, powerDialog);
248256 topLevelSurfaceList.closeAllWindows();
249− doOnClosedAllWindows = function() {
250− powerDialog.hide();
251− root.powerOffClicked();
252− }
253257 }
254258 color: theme.palette.normal.negative
255259 Component.onCompleted: if (root.hasKeyboard) forceActiveFocus(Qt.TabFocusReason)
@@ -258,11 +262,13 @@ MouseArea {
258262 width: parent.width
259263 text: i18n.ctr("Button: Restart the system", "Restart")
260264 onClicked: {
265+ doOnClosedAllWindows = function(unitySessionService, powerDialog) {
266+ return function() {
267+ unitySessionService.reboot();
268+ powerDialog.hide();
269+ }
270+ }(unitySessionService, powerDialog);
261271 topLevelSurfaceList.closeAllWindows();
262− doOnClosedAllWindows = function() {
263− unitySessionService.reboot();
264− powerDialog.hide();
265− }
266272 }
267273 }
268274 Button {
@@ -302,11 +308,13 @@ MouseArea {
302308 }
303309
304310 onLogoutReady: {
311+ doOnClosedAllWindows = function(unitySessionService) {
312+ return function() {
313+ Qt.quit();
314+ unitySessionService.endSession();
315+ }
316+ }(unitySessionService);
305317 topLevelSurfaceList.closeAllWindows();
306− doOnClosedAllWindows = function() {
307− Qt.quit();
308− unitySessionService.endSession();
309− }
310318 }
311319 }
312320}