[gnome-games/wip/exalm/searchbar] search-bar: Make search bar adaptive
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/searchbar] search-bar: Make search bar adaptive
- Date: Mon, 3 Dec 2018 13:14:20 +0000 (UTC)
commit e973eefde5983c0132e325ad296e3a2e7177e174
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date: Mon Dec 3 18:12:55 2018 +0500
search-bar: Make search bar adaptive
Use Hdy.SearchBar and Hdy.Column to make search bar shrink in narrow
windows.
data/ui/search-bar.ui | 16 +++++++++++-----
src/main.vala | 1 +
src/ui/search-bar.vala | 2 +-
3 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/data/ui/search-bar.ui b/data/ui/search-bar.ui
index 3416d49f..2af4e451 100644
--- a/data/ui/search-bar.ui
+++ b/data/ui/search-bar.ui
@@ -1,14 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.16 -->
- <template class="GamesSearchBar" parent="GtkSearchBar">
+ <template class="GamesSearchBar" parent="HdySearchBar">
<property name="visible">True</property>
<child>
- <object class="GtkSearchEntry" id="entry">
+ <object class="HdyColumn">
<property name="visible">True</property>
- <property name="width-chars">40</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>
</template>
diff --git a/src/main.vala b/src/main.vala
index 7aa30afe..b9325ee3 100644
--- a/src/main.vala
+++ b/src/main.vala
@@ -8,6 +8,7 @@ int main (string[] args) {
Grl.init (ref args);
typeof (Hdy.Column).ensure ();
+ typeof (Hdy.SearchBar).ensure ();
typeof (Hdy.TitleBar).ensure ();
var app = new Games.Application ();
diff --git a/src/ui/search-bar.vala b/src/ui/search-bar.vala
index fa1d61bd..aefcc64a 100644
--- a/src/ui/search-bar.vala
+++ b/src/ui/search-bar.vala
@@ -1,7 +1,7 @@
// This file is part of GNOME Games. License: GPL-3.0+.
[GtkTemplate (ui = "/org/gnome/Games/ui/search-bar.ui")]
-private class Games.SearchBar : Gtk.SearchBar {
+private class Games.SearchBar : Hdy.SearchBar {
public string text { get; private set; }
[GtkChild]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]