[gnome-music/wip/jfelder/searchbar-child: 5/8] headerbar: Remove search state



commit 7a2410bbc8731acd4f6f90c2d9dc39f3c060f1d8
Author: Jean Felder <jfelder src gnome org>
Date:   Thu Nov 15 22:55:39 2018 +0100

    headerbar: Remove search state
    
    SEARCH state referred to the child state of the search mode. With the
    introduction of search_mode_allowed in the previous commit, Hearderbar
    CHILD state can directly be used when the search mode is in child
    state.

 gnomemusic/views/searchview.py  | 4 ++--
 gnomemusic/widgets/headerbar.py | 3 +--
 gnomemusic/window.py            | 7 +------
 3 files changed, 4 insertions(+), 10 deletions(-)
---
diff --git a/gnomemusic/views/searchview.py b/gnomemusic/views/searchview.py
index 0304c39d..01b08705 100644
--- a/gnomemusic/views/searchview.py
+++ b/gnomemusic/views/searchview.py
@@ -130,7 +130,7 @@ class SearchView(BaseView):
             item = self.model[_iter][5]
 
             self._album_widget.update(item)
-            self._headerbar.props.state = HeaderBar.State.SEARCH
+            self._headerbar.props.state = HeaderBar.State.CHILD
 
             self._headerbar.props.title = title
             self._headerbar.props.subtitle = artist
@@ -152,7 +152,7 @@ class SearchView(BaseView):
                 'selection-mode', self._artist_albums_widget, 'selection-mode',
                 GObject.BindingFlags.BIDIRECTIONAL)
 
-            self._headerbar.props.state = HeaderBar.State.SEARCH
+            self._headerbar.props.state = HeaderBar.State.CHILD
             self._headerbar.props.title = artist
             self._headerbar.props.subtitle = ''
             self.set_visible_child(self._artist_albums_widget)
diff --git a/gnomemusic/widgets/headerbar.py b/gnomemusic/widgets/headerbar.py
index f72305b1..e42e557a 100644
--- a/gnomemusic/widgets/headerbar.py
+++ b/gnomemusic/widgets/headerbar.py
@@ -83,8 +83,7 @@ class HeaderBar(Gtk.HeaderBar):
         """States the Headerbar can have"""
         MAIN = 0
         CHILD = 1
-        SEARCH = 2
-        EMPTY = 3
+        EMPTY = 2
 
     __gtype_name__ = "HeaderBar"
 
diff --git a/gnomemusic/window.py b/gnomemusic/window.py
index 2e12e72a..95f6683f 100644
--- a/gnomemusic/window.py
+++ b/gnomemusic/window.py
@@ -436,13 +436,8 @@ class Window(Gtk.ApplicationWindow):
 
     @log
     def _toggle_view(self, view_enum):
-        # TODO: The SEARCH state actually refers to the child state of
-        # the search mode. This fixes the behaviour as needed, but is
-        # incorrect: searchview currently does not switch states
-        # correctly.
         if (not self.props.selection_mode
-                and not self._headerbar.props.state == HeaderBar.State.CHILD
-                and not self._headerbar.props.state == HeaderBar.State.SEARCH):
+                and not self._headerbar.props.state == HeaderBar.State.CHILD):
             self._stack.set_visible_child(self.views[view_enum])
 
     @log


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