[gnome-music/wip/mschraal/move-searchbar-handling: 2/3] window: Fix back button crash



commit 21093925a2512a4d4aff19c6119b0d8b3ade50e2
Author: Marinus Schraal <mschraal gnome org>
Date:   Tue Sep 4 16:07:09 2018 +0200

    window: Fix back button crash
    
    The keyboard shortcut for going back would call a function only available
    on views with child possibility on all views.
    Make the call exclusive to Album and Search view.

 gnomemusic/window.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/gnomemusic/window.py b/gnomemusic/window.py
index 907e76a8..9c07e38a 100644
--- a/gnomemusic/window.py
+++ b/gnomemusic/window.py
@@ -498,8 +498,12 @@ class Window(Gtk.ApplicationWindow):
 
         visible_child = self.curr_view.props.visible_child
 
-        view = self._stack.props.visible_child
-        view._back_button_clicked(view)
+        views_with_child = [
+            self.views[View.ALBUM],
+            self.views[View.SEARCH]
+        ]
+        if self.curr_view in views_with_child:
+            self.curr_view._back_button_clicked(self.curr_view)
 
         if not ((self.curr_view == self.views[View.SEARCH]
                  or self.curr_view == self.views[View.EMPTY])


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]