[gnome-music/wip/jfelder/gtk4-v3] searchheaderbar: Ensure that the entry gets the first key press
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/gtk4-v3] searchheaderbar: Ensure that the entry gets the first key press
- Date: Fri, 11 Feb 2022 21:21:28 +0000 (UTC)
commit 6ec014ed359ae9ff88232add2c085261fd56de8d
Author: Jean Felder <jfelder src gnome org>
Date: Fri Feb 11 21:16:33 2022 +0100
searchheaderbar: Ensure that the entry gets the first key press
gnomemusic/widgets/searchheaderbar.py | 14 ++++++++++++++
1 file changed, 14 insertions(+)
---
diff --git a/gnomemusic/widgets/searchheaderbar.py b/gnomemusic/widgets/searchheaderbar.py
index 0e539e0eb..65d7529e7 100644
--- a/gnomemusic/widgets/searchheaderbar.py
+++ b/gnomemusic/widgets/searchheaderbar.py
@@ -22,12 +22,16 @@
# code, but you are not obligated to do so. If you do not wish to do so,
# delete this exception statement from your version.
+from __future__ import annotations
from enum import IntEnum
+import typing
from gi.repository import Adw, GObject, Gtk
from gnomemusic.search import Search
from gnomemusic.widgets.headerbar import HeaderBar, SelectionBarMenuButton
+if typing.TYPE_CHECKING:
+ from gnomemusic.application import Application
@Gtk.Template(resource_path="/org/gnome/Music/ui/SearchHeaderBar.ui")
@@ -101,6 +105,16 @@ class SearchHeaderBar(Adw.Bin):
self._entry.connect("search-changed", self._search_entry_changed)
+ self._win_id = application.connect(
+ "notify::window", self._on_window_ready)
+
+ def _on_window_ready(
+ self, application: Application,
+ value: GObject.ParamSpecObject) -> None:
+ self._entry.set_key_capture_widget(application.props.window)
+ application.disconnect(self._win_id)
+ self._win_id = 0
+
@GObject.Property(type=bool, default=False)
def selection_mode(self):
"""Selection mode
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]