[gnome-music/wip/jfelder/selection-misc-cleanups: 7/20] 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: 7/20] albumsview: Do not change selection-mode if the view is not visible
- Date: Fri, 10 Jan 2020 13:33:48 +0000 (UTC)
commit 503d065c10083a4ab0e18a66a53357982d9ed833
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 if the view is visible.
gnomemusic/views/albumsview.py | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/gnomemusic/views/albumsview.py b/gnomemusic/views/albumsview.py
index da72e244..10316f45 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_selection_mode_changed)
self._album_widget = AlbumWidget(application.props.player, self)
self._album_widget.bind_property(
@@ -147,6 +148,12 @@ class AlbumsView(Gtk.Stack):
return GLib.SOURCE_REMOVE
def _on_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]