Blame SOURCES/0001-system-don-t-throw-an-exception-if-power-off-disable.patch

ad7cac
From 5bd84b34622a3e5919e979b99d1d4872d355d18d Mon Sep 17 00:00:00 2001
ad7cac
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
ad7cac
Date: Mon, 4 Jun 2018 13:48:02 -0400
12ec7d
Subject: [PATCH] system: don't throw an exception if power off disabled
12ec7d
12ec7d
---
12ec7d
 js/ui/status/system.js | 13 ++++++++-----
12ec7d
 1 file changed, 8 insertions(+), 5 deletions(-)
12ec7d
12ec7d
diff --git a/js/ui/status/system.js b/js/ui/status/system.js
ad7cac
index 68a0b4b5b..2ab38419f 100644
12ec7d
--- a/js/ui/status/system.js
12ec7d
+++ b/js/ui/status/system.js
12ec7d
@@ -40,66 +40,69 @@ var AltSwitcher = new Lang.Class({
ad7cac
         this._clickAction.connect('long-press', this._onLongPress.bind(this));
12ec7d
 
12ec7d
         this.actor = new St.Bin();
ad7cac
         this.actor.connect('destroy', this._onDestroy.bind(this));
12ec7d
         this.actor.connect('notify::mapped', () => { this._flipped = false; });
12ec7d
     },
12ec7d
 
ad7cac
     _sync() {
12ec7d
         let childToShow = null;
12ec7d
 
12ec7d
         if (this._standard.visible && this._alternate.visible) {
12ec7d
             let [x, y, mods] = global.get_pointer();
12ec7d
             let altPressed = (mods & Clutter.ModifierType.MOD1_MASK) != 0;
12ec7d
             if (this._flipped)
12ec7d
                 childToShow = altPressed ? this._standard : this._alternate;
12ec7d
             else
12ec7d
                 childToShow = altPressed ? this._alternate : this._standard;
12ec7d
         } else if (this._standard.visible) {
12ec7d
             childToShow = this._standard;
12ec7d
         } else if (this._alternate.visible) {
12ec7d
             childToShow = this._alternate;
12ec7d
         }
12ec7d
 
12ec7d
         let childShown = this.actor.get_child();
12ec7d
         if (childShown != childToShow) {
12ec7d
             if (childShown) {
12ec7d
                 if (childShown.fake_release)
12ec7d
                     childShown.fake_release();
12ec7d
                 childShown.remove_action(this._clickAction);
12ec7d
             }
12ec7d
-            childToShow.add_action(this._clickAction);
12ec7d
 
12ec7d
-            let hasFocus = this.actor.contains(global.stage.get_key_focus());
12ec7d
-            this.actor.set_child(childToShow);
12ec7d
-            if (hasFocus)
12ec7d
-                childToShow.grab_key_focus();
12ec7d
+            if (childToShow) {
12ec7d
+                childToShow.add_action(this._clickAction);
12ec7d
+
12ec7d
+                let hasFocus = this.actor.contains(global.stage.get_key_focus());
12ec7d
+                this.actor.set_child(childToShow);
12ec7d
+                if (hasFocus)
12ec7d
+                    childToShow.grab_key_focus();
12ec7d
+            }
12ec7d
 
12ec7d
             // The actors might respond to hover, so
12ec7d
             // sync the pointer to make sure they update.
12ec7d
             global.sync_pointer();
12ec7d
         }
12ec7d
 
12ec7d
         this.actor.visible = (childToShow != null);
12ec7d
     },
12ec7d
 
ad7cac
     _onDestroy() {
12ec7d
         if (this._capturedEventId > 0) {
12ec7d
             global.stage.disconnect(this._capturedEventId);
12ec7d
             this._capturedEventId = 0;
12ec7d
         }
12ec7d
     },
12ec7d
 
ad7cac
     _onCapturedEvent(actor, event) {
12ec7d
         let type = event.type();
12ec7d
         if (type == Clutter.EventType.KEY_PRESS || type == Clutter.EventType.KEY_RELEASE) {
12ec7d
             let key = event.get_key_symbol();
12ec7d
             if (key == Clutter.KEY_Alt_L || key == Clutter.KEY_Alt_R)
12ec7d
                 this._sync();
12ec7d
         }
12ec7d
 
12ec7d
         return Clutter.EVENT_PROPAGATE;
12ec7d
     },
12ec7d
 
ad7cac
     _onLongPress(action, actor, state) {
12ec7d
         if (state == Clutter.LongPressState.QUERY ||
12ec7d
             state == Clutter.LongPressState.CANCEL)
12ec7d
-- 
ad7cac
2.17.1
12ec7d