mirror of
https://gitlab.gnome.org/World/Authenticator.git
synced 2025-03-04 00:34:40 +01:00
window: Put a Clamp in beetween search bar & entry
This commit is contained in:
parent
c43ac99d3d
commit
004a7bd664
2 changed files with 23 additions and 12 deletions
|
@ -200,14 +200,21 @@
|
||||||
<child type="top">
|
<child type="top">
|
||||||
<object class="GtkSearchBar" id="search_bar">
|
<object class="GtkSearchBar" id="search_bar">
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkSearchEntry" id="search_entry">
|
<object class="AdwClamp">
|
||||||
<property name="placeholder-text" translatable="yes">Search…</property>
|
<property name="tightening-threshold">300</property>
|
||||||
<signal name="search-started" handler="on_search_started" swapped="true" />
|
<property name="maximum-size">400</property>
|
||||||
<signal name="search-changed" handler="on_search_changed" swapped="true" />
|
<child>
|
||||||
<signal name="stop-search" handler="on_search_stopped" swapped="true" />
|
<object class="GtkSearchEntry" id="search_entry">
|
||||||
<accessibility>
|
<property name="hexpand">True</property>
|
||||||
<property name="label" translatable="yes">Search</property>
|
<property name="placeholder-text" translatable="yes">Search…</property>
|
||||||
</accessibility>
|
<signal name="search-started" handler="on_search_started" swapped="true" />
|
||||||
|
<signal name="search-changed" handler="on_search_changed" swapped="true" />
|
||||||
|
<signal name="stop-search" handler="on_search_stopped" swapped="true" />
|
||||||
|
<accessibility>
|
||||||
|
<property name="label" translatable="yes">Search</property>
|
||||||
|
</accessibility>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
|
|
@ -45,6 +45,8 @@ mod imp {
|
||||||
#[template_child]
|
#[template_child]
|
||||||
pub account_details: TemplateChild<AccountDetailsPage>,
|
pub account_details: TemplateChild<AccountDetailsPage>,
|
||||||
#[template_child]
|
#[template_child]
|
||||||
|
pub search_bar: TemplateChild<gtk::SearchBar>,
|
||||||
|
#[template_child]
|
||||||
pub search_entry: TemplateChild<gtk::SearchEntry>,
|
pub search_entry: TemplateChild<gtk::SearchEntry>,
|
||||||
#[template_child]
|
#[template_child]
|
||||||
pub navigation_view: TemplateChild<adw::NavigationView>,
|
pub navigation_view: TemplateChild<adw::NavigationView>,
|
||||||
|
@ -160,6 +162,8 @@ mod imp {
|
||||||
win.add_css_class("devel");
|
win.add_css_class("devel");
|
||||||
}
|
}
|
||||||
win.set_view(View::Accounts);
|
win.set_view(View::Accounts);
|
||||||
|
|
||||||
|
self.search_bar.connect_entry(&*self.search_entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl WidgetImpl for Window {}
|
impl WidgetImpl for Window {}
|
||||||
|
@ -234,7 +238,7 @@ impl Window {
|
||||||
View::Login => {
|
View::Login => {
|
||||||
self.set_default_widget(Some(&*imp.unlock_button));
|
self.set_default_widget(Some(&*imp.unlock_button));
|
||||||
imp.main_stack.set_visible_child_name("login");
|
imp.main_stack.set_visible_child_name("login");
|
||||||
imp.search_entry.set_key_capture_widget(gtk::Widget::NONE);
|
imp.search_bar.set_key_capture_widget(gtk::Widget::NONE);
|
||||||
imp.password_entry.grab_focus();
|
imp.password_entry.grab_focus();
|
||||||
}
|
}
|
||||||
View::Accounts => {
|
View::Accounts => {
|
||||||
|
@ -249,17 +253,17 @@ impl Window {
|
||||||
imp.providers.set_view(ProvidersListView::NoSearchResults);
|
imp.providers.set_view(ProvidersListView::NoSearchResults);
|
||||||
} else {
|
} else {
|
||||||
imp.accounts_stack.set_visible_child_name("empty");
|
imp.accounts_stack.set_visible_child_name("empty");
|
||||||
imp.search_entry.set_key_capture_widget(gtk::Widget::NONE);
|
imp.search_bar.set_key_capture_widget(gtk::Widget::NONE);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
imp.providers.set_view(ProvidersListView::List);
|
imp.providers.set_view(ProvidersListView::List);
|
||||||
imp.accounts_stack.set_visible_child_name("accounts");
|
imp.accounts_stack.set_visible_child_name("accounts");
|
||||||
imp.search_entry.set_key_capture_widget(Some(self));
|
imp.search_bar.set_key_capture_widget(Some(self));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
View::Account(account) => {
|
View::Account(account) => {
|
||||||
self.set_default_widget(gtk::Widget::NONE);
|
self.set_default_widget(gtk::Widget::NONE);
|
||||||
imp.search_entry.set_key_capture_widget(gtk::Widget::NONE);
|
imp.search_bar.set_key_capture_widget(gtk::Widget::NONE);
|
||||||
imp.main_stack.set_visible_child_name("unlocked");
|
imp.main_stack.set_visible_child_name("unlocked");
|
||||||
imp.navigation_view.push_by_tag("account");
|
imp.navigation_view.push_by_tag("account");
|
||||||
imp.account_details.set_account(&account);
|
imp.account_details.set_account(&account);
|
||||||
|
|
Loading…
Add table
Reference in a new issue