diff options
author | Jean Felder <jfelder@src.gnome.org> | 2020-08-19 13:50:29 +0200 |
---|---|---|
committer | Jean Felder <jfelder@src.gnome.org> | 2020-09-05 23:26:13 +0200 |
commit | 2b11865d2aefa94905765eaf15e5d2df435b9417 (patch) | |
tree | 2f8e89caced5f82b2758fc3dd0eb1d1524be18a9 | |
parent | f689942a039a8101609a7baa4af80786907f0af3 (diff) |
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
-rw-r--r-- | gnomemusic/widgets/headerbar.py | 4 | ||||
-rw-r--r-- | gnomemusic/widgets/searchheaderbar.py | 4 |
2 files changed, 8 insertions, 0 deletions
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", |