[gnome-music/wip/mschraal/backbutton: 1/2] window: Unify behaviour of navigating back



commit 28a7c0868a6a0f116e6801afe22fad3b33a40e46
Author: theawless <thawless gmail com>
Date:   Sat Jan 14 03:50:25 2017 +0530

    window: Unify behaviour of navigating back
    
    Shortcut navigation back behaviour was missing some conditions while ui
    behaviour was good. Hence now calling the same function.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=777238

 gnomemusic/toolbar.py | 2 +-
 gnomemusic/window.py  | 4 +---
 2 files changed, 2 insertions(+), 4 deletions(-)
---
diff --git a/gnomemusic/toolbar.py b/gnomemusic/toolbar.py
index 317f717..445a0e2 100644
--- a/gnomemusic/toolbar.py
+++ b/gnomemusic/toolbar.py
@@ -123,7 +123,7 @@ class Toolbar(GObject.GObject):
         self._update()
 
     @log
-    def on_back_button_clicked(self, widget):
+    def on_back_button_clicked(self, widget=None):
         self._window = self.header_bar.get_parent()
         visible_child = self._window.curr_view.get_visible_child()
 
diff --git a/gnomemusic/window.py b/gnomemusic/window.py
index 25e261a..f0fba83 100644
--- a/gnomemusic/window.py
+++ b/gnomemusic/window.py
@@ -435,9 +435,7 @@ class Window(Gtk.ApplicationWindow):
             # Go back from Album view on Alt + Left
             if (event.keyval == Gdk.KEY_Left and
                     event_and_modifiers == Gdk.ModifierType.MOD1_MASK):
-                if (self.toolbar._state != ToolbarState.MAIN):
-                    self.curr_view.set_visible_child(self.curr_view._grid)
-                    self.toolbar.set_state(ToolbarState.MAIN)
+                self.toolbar.on_back_button_clicked()
             # Go to Albums view on Ctrl + 1
             if (event.keyval == Gdk.KEY_1
                     and event_and_modifiers == Gdk.ModifierType.CONTROL_MASK):


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