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



commit 3e6f9a26203178a64c4598d94200ec0750c007be
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 widget 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 33e69658..9042717c 100644
--- a/gnomemusic/window.py
+++ b/gnomemusic/window.py
@@ -496,8 +496,12 @@ class Window(Gtk.ApplicationWindow):
         if self.props.selection_mode:
             return
 
-        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)
 
         self._searchbar.reveal(False)
 


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