[gnome-music/wip/merge: 222/343] Fix back button for albums view



commit f59f5679eee4768528db69b6bd25549a4de11a90
Author: Vadim Rutkovsky <vrutkovs redhat com>
Date:   Wed Jul 17 15:44:17 2013 +0200

    Fix back button for albums view

 gnomemusic/toolbar.py |    7 ++++++-
 gnomemusic/view.py    |    6 ++----
 2 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/gnomemusic/toolbar.py b/gnomemusic/toolbar.py
index a067cc0..4a0922a 100644
--- a/gnomemusic/toolbar.py
+++ b/gnomemusic/toolbar.py
@@ -32,7 +32,7 @@ class Toolbar(GObject.GObject):
         self._selectionMenuButton.set_relief(Gtk.ReliefStyle.NONE)
         self.header_bar.set_custom_title(self._stackSwitcher)
         self._searchButton = self._ui.get_object("search-button")
-        self._backButton.connect('clicked', self.set_state)
+        self._backButton.connect('clicked', self.on_back_button_clicked)
         self._closeButton.connect('clicked', self._close_button_clicked)
 
     def _close_button_clicked(self, btn):
@@ -58,6 +58,11 @@ class Toolbar(GObject.GObject):
             self._cancelButton.hide()
         self._update()
 
+    def on_back_button_clicked(self, widget):
+        view = self._stackSwitcher.get_stack().get_visible_child()
+        view._back_button_clicked(view)
+        self.set_state(ToolbarState.ALBUMS)
+
     def set_state(self, state, btn=None):
         self._state = state
         self._update()
diff --git a/gnomemusic/view.py b/gnomemusic/view.py
index fce9e33..79e076a 100644
--- a/gnomemusic/view.py
+++ b/gnomemusic/view.py
@@ -246,10 +246,8 @@ class Albums(ViewContainer):
         self._albumWidget = Widgets.AlbumWidget(player)
         self.add(self._albumWidget)
 
-    def _on_state_changed(self, widget, data=None):
-        if (self.header_bar.get_stack() is not None) and \
-           (self == self.header_bar.get_stack().get_visible_child()):
-            self.set_visible_child(self._grid)
+    def _back_button_clicked(self, widget, data=None):
+        self.set_visible_child(self._grid)
 
     def _on_item_activated(self, widget, id, path):
         iter = self._model.get_iter(path)


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