[gnome-games] search-bar: Don't subclass HdySearchBar
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] search-bar: Don't subclass HdySearchBar
- Date: Mon, 19 Aug 2019 17:43:09 +0000 (UTC)
commit 0054e645f2019386e2d87b13f3f5593f1670adea
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date: Mon Aug 19 22:42:51 2019 +0500
search-bar: Don't subclass HdySearchBar
data/ui/search-bar.ui | 20 +++++++++++++-------
src/ui/search-bar.vala | 11 +++++++++--
2 files changed, 22 insertions(+), 9 deletions(-)
---
diff --git a/data/ui/search-bar.ui b/data/ui/search-bar.ui
index 61ece7e1..2eed478f 100644
--- a/data/ui/search-bar.ui
+++ b/data/ui/search-bar.ui
@@ -1,18 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="3.24"/>
- <template class="GamesSearchBar" parent="HdySearchBar">
+ <template class="GamesSearchBar" parent="GtkBin">
<property name="visible">True</property>
<child>
- <object class="HdyColumn">
+ <object class="HdySearchBar" id="search_bar">
<property name="visible">True</property>
- <property name="maximum-width">400</property>
- <property name="linear-growth-width">300</property>
+ <property name="search-mode-enabled" bind-source="GamesSearchBar"
bind-property="search-mode-enabled" bind-flags="sync-create|bidirectional"/>
<child>
- <object class="GtkSearchEntry" id="entry">
+ <object class="HdyColumn">
<property name="visible">True</property>
- <signal name="search-changed" handler="on_search_changed"/>
- <signal name="activate" handler="on_search_activated"/>
+ <property name="maximum-width">400</property>
+ <property name="linear-growth-width">300</property>
+ <child>
+ <object class="GtkSearchEntry" id="entry">
+ <property name="visible">True</property>
+ <signal name="search-changed" handler="on_search_changed"/>
+ <signal name="activate" handler="on_search_activated"/>
+ </object>
+ </child>
</object>
</child>
</object>
diff --git a/src/ui/search-bar.vala b/src/ui/search-bar.vala
index 2d663210..6b1f0b12 100644
--- a/src/ui/search-bar.vala
+++ b/src/ui/search-bar.vala
@@ -1,14 +1,17 @@
// This file is part of GNOME Games. License: GPL-3.0+.
[GtkTemplate (ui = "/org/gnome/Games/ui/search-bar.ui")]
-private class Games.SearchBar : Hdy.SearchBar {
+private class Games.SearchBar : Gtk.Bin {
public string text { get; private set; }
+ public bool search_mode_enabled { get; set; }
+ [GtkChild]
+ private Hdy.SearchBar search_bar;
[GtkChild]
private Gtk.SearchEntry entry;
construct {
- connect_entry (entry);
+ search_bar.connect_entry (entry);
}
[GtkCallback]
@@ -24,4 +27,8 @@ private class Games.SearchBar : Hdy.SearchBar {
public void focus_entry () {
entry.grab_focus_without_selecting ();
}
+
+ public bool handle_event (Gdk.Event event) {
+ return search_bar.handle_event (event);
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]