window: Use AdwNavigationView

Instead of leaflet for the accounts view.
This commit is contained in:
Maximiliano Sandoval R 2023-06-20 21:30:56 +02:00
parent 16da28f680
commit f483735bce
Failed to generate hash of commit
3 changed files with 11 additions and 27 deletions

View file

@ -24,15 +24,7 @@
<child>
<object class="AdwToolbarView">
<child type="top">
<object class="AdwHeaderBar">
<child type="start">
<object class="GtkButton">
<property name="icon-name">go-previous-symbolic</property>
<property name="action-name">win.back</property>
<property name="tooltip-text" translatable="yes">Back</property>
</object>
</child>
</object>
<object class="AdwHeaderBar" />
</child>
<child>
<object class="GtkScrolledWindow">

View file

@ -110,12 +110,11 @@
<object class="GtkStackPage">
<property name="name">unlocked</property>
<property name="child">
<object class="AdwLeaflet" id="deck">
<property name="can-unfold">False</property>
<property name="can-navigate-back">True</property>
<object class="AdwNavigationView" id="navigation_view">
<child>
<object class="AdwLeafletPage">
<property name="name">accounts</property>
<object class="AdwNavigationPage">
<property name="tag">accounts</property>
<property name="title" translatable="yes">Accounts</property>
<property name="child">
<object class="GtkStack" id="accounts_stack">
<property name="transition-type">crossfade</property>
@ -237,14 +236,9 @@
</object>
</child>
<child>
<object class="AdwLeafletPage">
<property name="name">account</property>
<property name="child">
<object class="AccountDetailsPage" id="account_details">
<signal name="provider-changed" handler="on_provider_changed" swapped="true" />
<signal name="removed" handler="on_account_removed" swapped="true" />
</object>
</property>
<object class="AccountDetailsPage" id="account_details">
<signal name="provider-changed" handler="on_provider_changed" swapped="true" />
<signal name="removed" handler="on_account_removed" swapped="true" />
</object>
</child>
</object>

View file

@ -46,7 +46,7 @@ mod imp {
#[template_child]
pub search_entry: TemplateChild<gtk::SearchEntry>,
#[template_child]
pub deck: TemplateChild<adw::Leaflet>,
pub navigation_view: TemplateChild<adw::NavigationView>,
#[template_child]
pub error_revealer: TemplateChild<ErrorRevealer>,
#[template_child]
@ -247,8 +247,7 @@ impl Window {
View::Accounts => {
self.set_default_widget(gtk::Widget::NONE);
imp.main_stack.set_visible_child_name("unlocked");
imp.deck.set_visible_child_name("accounts");
imp.deck.set_can_navigate_back(false);
imp.navigation_view.pop();
if imp.providers.model().n_items() == 0 {
if self.model().has_providers() {
// We do have at least one provider
@ -269,8 +268,7 @@ impl Window {
self.set_default_widget(gtk::Widget::NONE);
imp.search_entry.set_key_capture_widget(gtk::Widget::NONE);
imp.main_stack.set_visible_child_name("unlocked");
imp.deck.set_visible_child_name("account");
imp.deck.set_can_navigate_back(true);
imp.navigation_view.push_by_tag("account");
imp.account_details.set_account(&account);
}
}