[gnome-music/wip/rate-limit: 3/5] widgets: don't listen to row-changed always - we need them only when selection mode is on
- From: Vadim Rutkovsky <vrutkovsky src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/rate-limit: 3/5] widgets: don't listen to row-changed always - we need them only when selection mode is on
- Date: Wed, 17 Jun 2015 09:37:36 +0000 (UTC)
commit b7bc4d361f7732ed87b7ca1197cf6fd51c9d18f6
Author: Vadim Rutkovsky <vrutkovs redhat com>
Date: Tue Jun 16 17:40:14 2015 +0200
widgets: don't listen to row-changed always - we need them only when selection mode is on
gnomemusic/widgets.py | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/gnomemusic/widgets.py b/gnomemusic/widgets.py
index bffce41..ce3573b 100644
--- a/gnomemusic/widgets.py
+++ b/gnomemusic/widgets.py
@@ -388,7 +388,7 @@ class ArtistAlbums(Gtk.Box):
GObject.TYPE_BOOLEAN,
GObject.TYPE_INT
)
- self.model.connect('row-changed', self._model_row_changed)
+ self.row_changed_source_id = None
self._hbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
self._albumBox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL,
@@ -490,6 +490,13 @@ class ArtistAlbums(Gtk.Box):
if self.selectionMode == selectionMode:
return
self.selectionMode = selectionMode
+ try:
+ if self.row_changed_source_id:
+ self.model.disconnect(self.row_changed_source_id)
+ self.row_changed_source_id = self.model.connect('row-changed', self._model_row_changed)
+ except Exception as e:
+ logger.warning("Exception while tracking row-changed: %s", e)
+
for widget in self.widgets:
widget.set_selection_mode(selectionMode)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]