[gnome-music/wip/mschraal/minor-searchbar-cleanup: 4/6] headerbar: Move Dropdown creation to Searchbar
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/minor-searchbar-cleanup: 4/6] headerbar: Move Dropdown creation to Searchbar
- Date: Mon, 13 Aug 2018 15:42:27 +0000 (UTC)
commit 9fa3bdd78de97bf987dbee24a68474edb6b88e78
Author: Marinus Schraal <mschraal gnome org>
Date: Mon Aug 13 14:20:34 2018 +0200
headerbar: Move Dropdown creation to Searchbar
gnomemusic/searchbar.py | 9 +++++++--
gnomemusic/widgets/headerbar.py | 6 ++----
gnomemusic/window.py | 4 ++--
3 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/gnomemusic/searchbar.py b/gnomemusic/searchbar.py
index 90c13dca..37906c23 100644
--- a/gnomemusic/searchbar.py
+++ b/gnomemusic/searchbar.py
@@ -250,6 +250,8 @@ class DropDown(Gtk.Revealer):
self.add(frame)
+ self.show()
+
@log
def initialize_filters(self, searchbar):
self._source_manager = SourceManager(
@@ -288,12 +290,12 @@ class Searchbar(Gtk.SearchBar):
return '<Searchbar>'
@log
- def __init__(self, stack_switcher, dropdown):
+ def __init__(self, stack_switcher):
super().__init__()
self._timeout = None
self._stack_switcher = stack_switcher
- self._dropdown = dropdown
+
self._search_box = Gtk.Box(
orientation=Gtk.Orientation.HORIZONTAL, halign=Gtk.Align.CENTER)
self._search_box.get_style_context().add_class('linked')
@@ -304,6 +306,9 @@ class Searchbar(Gtk.SearchBar):
self._search_entry.show()
self._search_box.add(self._search_entry)
+ self._dropdown = DropDown()
+ self._dropdown.initialize_filters(self)
+
arrow = Gtk.Image.new_from_icon_name(
'pan-down-symbolic', Gtk.IconSize.BUTTON)
self._drop_down_button = Gtk.ToggleButton()
diff --git a/gnomemusic/widgets/headerbar.py b/gnomemusic/widgets/headerbar.py
index 06409616..5604532d 100644
--- a/gnomemusic/widgets/headerbar.py
+++ b/gnomemusic/widgets/headerbar.py
@@ -28,7 +28,7 @@ from gettext import gettext as _, ngettext
from gi.repository import GObject, Gtk
from gnomemusic import log
-from gnomemusic.searchbar import Searchbar, DropDown
+from gnomemusic.searchbar import Searchbar
from gnomemusic.utils import View
@@ -111,9 +111,7 @@ class HeaderBar(Gtk.HeaderBar):
can_focus=False, halign="center")
self._stack_switcher.show()
- self.dropdown = DropDown()
- self.searchbar = Searchbar(self._stack_switcher, self.dropdown)
- self.dropdown.initialize_filters(self.searchbar)
+ self.searchbar = Searchbar(self._stack_switcher)
self._selection_menu = SelectionBarMenuButton()
diff --git a/gnomemusic/window.py b/gnomemusic/window.py
index 4b8c51d2..625bec21 100644
--- a/gnomemusic/window.py
+++ b/gnomemusic/window.py
@@ -174,7 +174,8 @@ class Window(Gtk.ApplicationWindow):
self._overlay = Gtk.Overlay()
self._overlay.add(self._stack)
- self._overlay.add_overlay(self.headerbar.dropdown)
+ # FIXME: Need to find a proper way to do this.
+ self._overlay.add_overlay(self.headerbar.searchbar._dropdown)
self.set_titlebar(self.headerbar)
self._box.pack_start(self.headerbar.searchbar, False, False, 0)
self._box.pack_start(self._overlay, True, True, 0)
@@ -250,7 +251,6 @@ class Window(Gtk.ApplicationWindow):
self.headerbar.props.state = HeaderBar.State.MAIN
self.headerbar.props.stack = self._stack
self.headerbar.searchbar.show()
- self.headerbar.dropdown.show()
@log
def _select_all(self, action=None, param=None):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]