[gnome-music/wip/mschraal/searchview-rework: 1/15] searchview: Stop inheriting BaseView
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/searchview-rework: 1/15] searchview: Stop inheriting BaseView
- Date: Sat, 3 Aug 2019 10:28:34 +0000 (UTC)
commit 94a37ce7ecdaa189a7cdbd17779f03c30dc7562a
Author: Marinus Schraal <mschraal gnome org>
Date: Mon Jul 29 21:37:24 2019 +0200
searchview: Stop inheriting BaseView
gnomemusic/views/searchview.py | 45 ++++++++++++++++++++++++++++++++++++------
1 file changed, 39 insertions(+), 6 deletions(-)
---
diff --git a/gnomemusic/views/searchview.py b/gnomemusic/views/searchview.py
index 8fca353f..eabce4cc 100644
--- a/gnomemusic/views/searchview.py
+++ b/gnomemusic/views/searchview.py
@@ -28,7 +28,6 @@ from gnomemusic import log
from gnomemusic.player import PlayerPlaylist
from gnomemusic.utils import View
from gnomemusic.search import Search
-from gnomemusic.views.baseview import BaseView
from gnomemusic.widgets.albumcover import AlbumCover
from gnomemusic.widgets.albumwidget import AlbumWidget
from gnomemusic.widgets.headerbar import HeaderBar
@@ -37,24 +36,56 @@ from gnomemusic.widgets.artisttile import ArtistTile
from gnomemusic.widgets.songwidget import SongWidget
-class SearchView(BaseView):
+class SearchView(Gtk.Stack):
+ """Search view
+ """
+
+ __gtype_name__ = "SearchView"
search_state = GObject.Property(type=int, default=Search.State.NONE)
+ selected_items_count = GObject.Property(type=int, default=0, minimum=0)
+ selection_mode = GObject.Property(type=bool, default=False)
def __repr__(self):
return '<SearchView>'
@log
- def __init__(self, application, player):
+ def __init__(self, application, player=None):
+ """Initialize search view
+
+ :param Gtk.Application application: Application object
+ """
+ super().__init__(transition_type=Gtk.StackTransitionType.CROSSFADE)
+
+ self.name = "search"
+ self.title = None
+
self._application = application
self._coremodel = application.props.coremodel
self._model = self._coremodel.props.songs_search
self._album_model = self._coremodel.props.albums_search
self._artist_model = self._coremodel.props.artists_search
- super().__init__('search', None, application)
-
self._player = self._application.props.player
+ self._grid = Gtk.Grid(orientation=Gtk.Orientation.HORIZONTAL)
+ self._box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
+
+ # Setup the main view
+ self._setup_view()
+
+ self._grid.add(self._box)
+ self.add(self._grid)
+ self.show_all()
+
+ self._window = application.props.window
+ self._headerbar = self._window._headerbar
+
+ self.connect("notify::selection-mode", self._on_selection_mode_changed)
+
+ self.bind_property(
+ 'selection-mode', self._window, 'selection-mode',
+ GObject.BindingFlags.BIDIRECTIONAL)
+
self.previous_view = None
self._album_widget = AlbumWidget(player, self)
@@ -67,6 +98,7 @@ class SearchView(BaseView):
self._artist_albums_widget = None
self._search_mode_active = False
+
# self.connect("notify::search-state", self._on_search_state_changed)
@log
@@ -254,7 +286,8 @@ class SearchView(BaseView):
@log
def _on_selection_mode_changed(self, widget, data=None):
- super()._on_selection_mode_changed(widget, data)
+ if not self.props.selection_mode:
+ self.unselect_all()
@log
def _on_search_state_changed(self, klass, param):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]