[gnome-music/wip/jfelder/fix-searchbar: 29/29] searchbar: Fix Match fields sensitivity on source changes



commit bfec39b881dbd8cb07a31a7f0d34ef6b53c38706
Author: Jean Felder <jfelder src gnome org>
Date:   Tue Jan 29 16:12:20 2019 +0100

    searchbar: Fix Match fields sensitivity on source changes
    
    When switching back to the local search after a tag removal, the Match
    fields are still greyed out. Indeed, match fields are only updated
    when a change occurs from the DropDown (coming from selection-changed
    signal).
    
    Moving the update logic to source_manager's active property
    notifications fixes the issue.

 gnomemusic/widgets/searchbar.py | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/gnomemusic/widgets/searchbar.py b/gnomemusic/widgets/searchbar.py
index 04eb3e9f..87b2490b 100644
--- a/gnomemusic/widgets/searchbar.py
+++ b/gnomemusic/widgets/searchbar.py
@@ -285,6 +285,8 @@ class DropDown(Gtk.Revealer):
     def initialize_filters(self, searchbar):
         self._source_manager = SourceManager(
             'source', _("Sources"), searchbar._search_entry)
+        self._source_manager.connect(
+            "notify::active", self._on_source_manager_value_changed)
 
         self._source_filter.props.manager = self._source_manager
         self._source_filter.connect(
@@ -306,11 +308,12 @@ class DropDown(Gtk.Revealer):
     def _on_selection_changed(self, klass, manager, id_):
         manager.active = id_
 
-        if manager == self._source_manager:
-            is_tracker = self._is_tracker(id_)
-            self._search_filter.props.sensitive = is_tracker
-            self.search_manager.props.active = (
-                'search_all' if not is_tracker else '')
+    @log
+    def _on_source_manager_value_changed(self, klass, value):
+        is_tracker = self._is_tracker(klass.props.active)
+        self._search_filter.props.sensitive = is_tracker
+        self.search_manager.props.active = (
+            'search_all' if not is_tracker else '')
 
     @log
     def _is_tracker(self, grilo_id):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]