[gnome-music/wip/mschraal/selection-fixes: 2/2] window: Use active_view property in Window
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/selection-fixes: 2/2] window: Use active_view property in Window
- Date: Thu, 17 Oct 2019 18:34:24 +0000 (UTC)
commit 234484759697abdf010b930e4e041b924f4ecf5a
Author: Marinus Schraal <mschraal gnome org>
Date: Thu Oct 17 17:53:33 2019 +0200
window: Use active_view property in Window
Replace Stack.get_visible_child calls with the active_view property.
gnomemusic/window.py | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/gnomemusic/window.py b/gnomemusic/window.py
index efe4c4bb..40b59407 100644
--- a/gnomemusic/window.py
+++ b/gnomemusic/window.py
@@ -306,9 +306,9 @@ class Window(Gtk.ApplicationWindow):
if not self.props.selection_mode:
return
if self._headerbar.props.state == HeaderBar.State.MAIN:
- view = self._stack.get_visible_child()
+ view = self.props.active_view
else:
- view = self._stack.get_visible_child().get_visible_child()
+ view = self.props.active_view.get_visible_child()
view.select_all()
@@ -317,10 +317,10 @@ class Window(Gtk.ApplicationWindow):
if not self.props.selection_mode:
return
if self._headerbar.props.state == HeaderBar.State.MAIN:
- view = self._stack.get_visible_child()
+ view = self.props.active_view
view.unselect_all()
else:
- view = self._stack.get_visible_child().get_visible_child()
+ view = self.props.active_view.get_visible_child()
view.select_none()
@log
@@ -405,7 +405,7 @@ class Window(Gtk.ApplicationWindow):
if keyval == Gdk.KEY_AudioNext:
self._player.next()
- child = self._stack.get_visible_child()
+ child = self.props.active_view
if (keyval == Gdk.KEY_Delete
and child == self.views[View.PLAYLIST]):
self.views[View.PLAYLIST].remove_playlist()
@@ -440,7 +440,7 @@ class Window(Gtk.ApplicationWindow):
@log
def _on_notify_mode(self, stack, param):
self.prev_view = self.curr_view
- self.curr_view = stack.get_visible_child()
+ self.curr_view = self.props.active_view
# Disable search mode when switching view
search_views = [self.views[View.EMPTY], self.views[View.SEARCH]]
@@ -506,7 +506,7 @@ class Window(Gtk.ApplicationWindow):
@log
def _on_add_to_playlist(self, widget):
- if self._stack.get_visible_child() == self.views[View.PLAYLIST]:
+ if self.props.active_view == self.views[View.PLAYLIST]:
return
selected_songs = self._app._coreselection.props.selected_items
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]