[gnome-music/gnome-3-14] view: Reshow search bar when returning to results



commit fac59137a1395d73d2e2596095bfb911d92acdef
Author: Arnel Borja <arnelborja src gnome org>
Date:   Sat Nov 22 16:56:53 2014 +0800

    view: Reshow search bar when returning to results
    
    Don't clear the search text and reshow the search bar when returning to
    search results.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=740490

 gnomemusic/searchbar.py |    5 +++--
 gnomemusic/view.py      |    1 +
 gnomemusic/window.py    |    3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/gnomemusic/searchbar.py b/gnomemusic/searchbar.py
index 35b175f..606100d 100644
--- a/gnomemusic/searchbar.py
+++ b/gnomemusic/searchbar.py
@@ -300,14 +300,15 @@ class Searchbar(Gd.Revealer):
         return False
 
     @log
-    def show_bar(self, show):
+    def show_bar(self, show, clear=True):
         self.set_reveal_child(show)
         self._search_button.set_active(show)
 
         if show:
+            if clear:
+                self._search_entry.set_text('')
             self._search_entry.grab_focus()
         else:
-            self._search_entry.set_text('')
             self._dropDownButton.set_active(False)
 
     @log
diff --git a/gnomemusic/view.py b/gnomemusic/view.py
index 7ee34e6..026b8bd 100644
--- a/gnomemusic/view.py
+++ b/gnomemusic/view.py
@@ -1227,6 +1227,7 @@ class Search(ViewContainer):
 
     @log
     def _back_button_clicked(self, widget, data=None):
+        self.header_bar.searchbar.show_bar(True, False)
         if self.get_visible_child() == self._artistAlbumsWidget:
             self._artistAlbumsWidget.destroy()
             self._artistAlbumsWidget = None
diff --git a/gnomemusic/window.py b/gnomemusic/window.py
index a2244bf..760895b 100644
--- a/gnomemusic/window.py
+++ b/gnomemusic/window.py
@@ -359,7 +359,8 @@ class Window(Gtk.ApplicationWindow):
 
     @log
     def _on_search_toggled(self, button, data=None):
-        self.toolbar.searchbar.show_bar(button.get_active())
+        self.toolbar.searchbar.show_bar(button.get_active(),
+                                        self.curr_view != self.views[4])
         if not button.get_active() and self.curr_view == self.views[4] and \
            self.toolbar._state == ToolbarState.MAIN:
             self._stack.set_visible_child(self.prev_view)


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