[gnome-music/wip/jfelder/search-selection-reset: 4/9] aaa
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/search-selection-reset: 4/9] aaa
- Date: Thu, 28 Feb 2019 14:18:35 +0000 (UTC)
commit 7f9679d924a96db1b29a66fa817e899e2f9d76f3
Author: Jean Felder <jfelder src gnome org>
Date: Wed Feb 27 08:59:40 2019 +0100
aaa
gnomemusic/window.py | 34 ++++++++++++++--------------------
1 file changed, 14 insertions(+), 20 deletions(-)
---
diff --git a/gnomemusic/window.py b/gnomemusic/window.py
index 2060ec1b..00491470 100644
--- a/gnomemusic/window.py
+++ b/gnomemusic/window.py
@@ -172,10 +172,10 @@ class Window(Gtk.ApplicationWindow):
self._box.pack_start(selection_toolbar, False, False, 0)
self.add(self._box)
- self._headerbar._search_button.connect(
- 'toggled', self._on_search_toggled)
selection_toolbar.connect(
'add-to-playlist', self._on_add_to_playlist)
+ self._search.connect(
+ "notify::search-mode-enabled", self._on_search_mode_changed)
self._headerbar.props.state = HeaderBar.State.MAIN
self._headerbar.show()
@@ -440,24 +440,18 @@ class Window(Gtk.ApplicationWindow):
self._stack.set_visible_child(self.views[view_enum])
@log
- def _on_search_toggled(self, button, data=None):
- if (not button.get_active()
- and (self.curr_view == self.views[View.SEARCH]
- or self.curr_view == self.views[View.EMPTY])):
- child = self.curr_view.get_visible_child()
- if self._headerbar.props.state == HeaderBar.State.MAIN:
- # We should get back to the view before the search
- self._stack.set_visible_child(
- self.views[View.SEARCH].previous_view)
- self._searchbar.clear()
- elif (self.views[View.SEARCH].previous_view == self.views[View.ALBUM]
- and child != self.curr_view._album_widget
- and child != self.curr_view._artist_albums_widget):
- self._stack.set_visible_child(self.views[View.ALBUM])
- self._searchbar.clear()
-
- if self.props.selection_mode:
- self.props.selection_mode = False
+ def _on_search_mode_changed(self, klass, param):
+ if (self._search.props.search_mode_enabled
+ or self._search.props.state == Search.State.NONE):
+ return
+
+ # Get back to the view before the search
+ search_views = [self.views[View.EMPTY], self.views[View.SEARCH]]
+ if self.curr_view in search_views:
+ self._stack.set_visible_child(
+ self.views[View.SEARCH].previous_view)
+
+ self._searchbar.clear()
@log
def _switch_back_from_childview(self, klass=None):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]