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



commit c82a6e31e4652a2bc470395a7babc8ab3b36bbae
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 71b7f016..29338808 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)
 
         visible_child = self.curr_view.props.visible_child
         if not ((self.curr_view == self.views[View.SEARCH]


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