[gnome-music/wip/jfelder/selection-misc-cleanups: 8/13] albumsview: Do not change selection-mode if the view is not visible
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/selection-misc-cleanups: 8/13] albumsview: Do not change selection-mode if the view is not visible
- Date: Thu, 9 Jan 2020 17:48:17 +0000 (UTC)
commit 1ff49de1b129c90aa2182cfb49825fb23685dc66
Author: Jean Felder <jfelder src gnome org>
Date: Thu Jan 9 16:27:25 2020 +0100
albumsview: Do not change selection-mode if the view is not visible
A user can only select songs or albums in the visible view.
gnomemusic/views/albumsview.py | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/gnomemusic/views/albumsview.py b/gnomemusic/views/albumsview.py
index da72e244..6dab441b 100644
--- a/gnomemusic/views/albumsview.py
+++ b/gnomemusic/views/albumsview.py
@@ -72,11 +72,12 @@ class AlbumsView(Gtk.Stack):
self._flowbox.bind_model(model, self._create_widget)
self._flowbox.connect("child-activated", self._on_child_activated)
- self.connect("notify::selection-mode", self._on_selection_mode_changed)
-
self.bind_property(
- 'selection-mode', self._window, 'selection-mode',
- GObject.BindingFlags.BIDIRECTIONAL)
+ "selection-mode", self._window, "selection-mode",
+ GObject.BindingFlags.DEFAULT)
+
+ self._window.connect(
+ "notify::selection-mode", self._on_window_selection_mode_changed)
self._album_widget = AlbumWidget(application.props.player, self)
self._album_widget.bind_property(
@@ -146,7 +147,13 @@ class AlbumsView(Gtk.Stack):
return GLib.SOURCE_REMOVE
- def _on_selection_mode_changed(self, widget, data=None):
+ def _on_window_selection_mode_changed(self, widget, data=None):
+ selection_mode = self._window.props.selection_mode
+ if (selection_mode == self.props.selection_mode
+ or self.get_parent().get_visible_child() != self):
+ return
+
+ self.props.selection_mode = selection_mode
if not self.props.selection_mode:
self.unselect_all()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]