[gnome-music/wip/jfelder/3-36-selection-fixes: 2/5] headerbar: Hide the search button when selection-mode is active




commit 2b11865d2aefa94905765eaf15e5d2df435b9417
Author: Jean Felder <jfelder src gnome org>
Date:   Wed Aug 19 13:50:29 2020 +0200

    headerbar: Hide the search button when selection-mode is active
    
    It is not possible to start or change a search when selection-mode is
    active. Thus, there should be no search button.
    
    Fix the issue by hiding the search button (for HeaderBar and
    SearchHeaderBar) when selection-mode is active.
    
    Closes: #405

 gnomemusic/widgets/headerbar.py       | 4 ++++
 gnomemusic/widgets/searchheaderbar.py | 4 ++++
 2 files changed, 8 insertions(+)
---
diff --git a/gnomemusic/widgets/headerbar.py b/gnomemusic/widgets/headerbar.py
index 909974a2..3d928d9c 100644
--- a/gnomemusic/widgets/headerbar.py
+++ b/gnomemusic/widgets/headerbar.py
@@ -139,6 +139,10 @@ class HeaderBar(Gtk.HeaderBar):
             "search-mode-active", self._search_button, "active",
             GObject.BindingFlags.BIDIRECTIONAL
             | GObject.BindingFlags.SYNC_CREATE)
+        self.bind_property(
+            "selection-mode", self._search_button, "visible",
+            GObject.BindingFlags.INVERT_BOOLEAN
+            | GObject.BindingFlags.SYNC_CREATE)
 
         self.connect(
             "notify::selection-mode-allowed",
diff --git a/gnomemusic/widgets/searchheaderbar.py b/gnomemusic/widgets/searchheaderbar.py
index 2b6de962..f8a0955a 100644
--- a/gnomemusic/widgets/searchheaderbar.py
+++ b/gnomemusic/widgets/searchheaderbar.py
@@ -88,6 +88,10 @@ class SearchHeaderBar(Gtk.HeaderBar):
             "search-mode-active", self._search_button, "active",
             GObject.BindingFlags.BIDIRECTIONAL
             | GObject.BindingFlags.SYNC_CREATE)
+        self.bind_property(
+            "selection-mode", self._search_button, "visible",
+            GObject.BindingFlags.INVERT_BOOLEAN
+            | GObject.BindingFlags.SYNC_CREATE)
 
         self.connect(
             "notify::selection-mode-allowed",


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