Next: <AdwNoneAnimationTarget>, Previous: <AdwNavigationSplitView>, Up: Classes [Index]
It derives from <GtkWidget>.
A page-based navigation container.
<AdwNavigationView> presents one child at a
time, similar to <GtkStack>.
<AdwNavigationView> can only contain
NavigationPage children.
It maintains a navigation stack that can be controlled with
NavigationView.push and NavigationView.pop. The whole
navigation stack can also be replaced using
NavigationView.replace.
<AdwNavigationView> allows to manage pages
statically or dynamically.
Static pages can be added using the NavigationView.add method.
The <AdwNavigationView> will keep a
reference to these pages, but they aren’t accessible to the user until
NavigationView.push is called (except for the first page, which
is pushed automatically). Use the NavigationView.remove method
to remove them. This is useful for applications that have a small
number of unique pages and just need navigation between them.
Dynamic pages are automatically destroyed once they are popped off the
navigation stack. To add a page like this, push it using the
NavigationView.push method without calling
NavigationView.add first.
Static pages, as well as any pages in the navigation stack, can be
accessed by their NavigationPage:tag. For example,
NavigationView.push_by_tag can be used to push a static page
that’s not in the navigation stack without having to keep a reference to
it manually.
When used inside <AdwNavigationView>,
HeaderBar will automatically display a back button that can be
used to go back to the previous page when possible. The button also has
a context menu, allowing to pop multiple pages at once, potentially
across multiple navigation views.
Set HeaderBar:show-back-button to FALSE to disable this
behavior in rare scenarios where it’s unwanted.
<AdwHeaderBar> will also display the title of
the <AdwNavigationPage> it’s placed into,
so most applications shouldn’t need to customize it at all.
<AdwNavigationView> supports the following
shortcuts for going to the previous page:
NavigationView:pop-on-escape is set to
FALSE)
Additionally, it supports interactive gestures:
These gestures have transitions enabled regardless of the
NavigationView:animate-transitions value.
Applications can also enable shortcuts for pushing another page onto the
navigation stack via connecting to the "get-next-page" signal, in
that case the following shortcuts are supported:
For right-to-left locales, the gestures and shortcuts are reversed.
NavigationPage:can-pop can be used to disable them, along with
the header bar back buttons.
<AdwNavigationView> defines actions for
controlling the navigation stack. actions for controlling the
navigation stack:
navigation.push takes a string parameter specifying the tag of
the page to push, and is equivalent to calling
NavigationView.push_by_tag.
navigation.pop doesn’t take any parameters and pops the current
page from the navigation stack, equivalent to calling
NavigationView.pop.
<AdwNavigationView> allows to add pages as
children, equivalent to using the NavigationView.add method.
Example of an <AdwNavigationView> UI
definition:
<object class="AdwNavigationView">
<child>
<object class="AdwNavigationPage">
<property name="title" translatable="yes">Page 1</property>
<property name="child">
<object class="AdwToolbarView">
<child type="top">
<object class="AdwHeaderBar"/>
</child>
<property name="content">
<object class="GtkButton">
<property name="label" translatable="yes">Open Page 2</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="action-name">navigation.push</property>
<property name="action-target">'page-2'</property>
<style>
<class name="pill"/>
</style>
</object>
</property>
</object>
</property>
</object>
</child>
<child>
<object class="AdwNavigationPage">
<property name="title" translatable="yes">Page 2</property>
<property name="tag">page-2</property>
<property name="child">
<object class="AdwToolbarView">
<child type="top">
<object class="AdwHeaderBar"/>
</child>
<property name="content">
<!-- ... -->
</property>
</object>
</property>
</object>
</child>
</object>
<AdwNavigationView> has a single CSS node
with the name navigation-view.
<AdwNavigationView> uses the
Gtk.AccessibleRole.group role.
Whether to animate page transitions.
Gesture-based transitions are always animated.
Its value is a boolean.
Set it with (set! (navigation-view:animate-transitions self)
value).
Whether the view is horizontally homogeneous.
If the view is horizontally homogeneous, it allocates the same width for all pages.
If it’s not, the page may change width when a different page becomes visible.
Its value is a boolean.
Set it with (set! (navigation-view:hhomogeneous self) value).
A list model that contains the pages in navigation stack.
The pages are sorted from root page to visible page.
This can be used to keep an up-to-date view.
Its value is a <GListModel>, or #f.
It is read only.
Whether pressing Escape pops the current page.
Applications using <AdwNavigationView> to
implement a browser may want to disable it.
Its value is a boolean.
Set it with (set! (navigation-view:pop-on-escape self) value).
Whether the view is vertically homogeneous.
If the view is vertically homogeneous, it allocates the same height for all pages.
If it’s not, the view may change height when a different page becomes visible.
Its value is a boolean.
Set it with (set! (navigation-view:vhomogeneous self) value).
The currently visible page.
Its value is a <AdwNavigationPage>, or
#f.
It is read only.
The tag of the currently visible page.
Its value is a string, or #f.
It is read only.
Permanently adds page to self.
Any page that has been added will stay in self even after being popped from the navigation stack.
Adding a page while no page is visible will automatically push it to the navigation stack.
See NavigationView.remove.
Passed: a <AdwNavigationView>.
a navigation view
Passed: a <AdwNavigationPage>.
the page to add
Finds a page in self by its tag.
See NavigationPage:tag.
Passed: a <AdwNavigationView>.
a navigation view
Passed: a string.
a page tag
Returned: a <AdwNavigationPage>, or
#f.
the page with the given tag
Gets whether self animates page transitions.
Passed: a <AdwNavigationView>.
a navigation view
Returned: a boolean.
whether to animate page transitions
Gets whether self is horizontally homogeneous.
Passed: a <AdwNavigationView>.
a navigation view
Returned: a boolean.
whether self is horizontally homogeneous
Returns a <GListModel> that contains the
pages in navigation stack.
The pages are sorted from root page to visible page.
This can be used to keep an up-to-date view.
Passed: a <AdwNavigationView>.
a navigation view
Returned: a <GListModel>.
a list model for the navigation stack
Gets whether pressing Escape pops the current page on self.
Passed: a <AdwNavigationView>.
a navigation view
Returned: a boolean.
whether to pop the current page
Gets the previous page for page.
If page is in the navigation stack, returns the page popping page will reveal.
If page is the root page or is not in the navigation stack,
returns NULL.
Passed: a <AdwNavigationView>.
a navigation view
Passed: a <AdwNavigationPage>.
a page in self
Returned: a <AdwNavigationPage>, or
#f.
the previous page
Gets whether self is vertically homogeneous.
Passed: a <AdwNavigationView>.
a navigation view
Returned: a boolean.
whether self is vertically homogeneous
Gets the currently visible page in self.
Passed: a <AdwNavigationView>.
a navigation view
Returned: a <AdwNavigationPage>, or
#f.
the currently visible page
Gets the tag of the currently visible page in self.
Passed: a <AdwNavigationView>.
a navigation view
Returned: a string, or #f.
the tag of the currently visible page
Creates a new <AdwNavigationView>.
Returned: a <GtkWidget>.
the new created <AdwNavigationView>
Pops pages from the navigation stack until page is visible.
page must be in the navigation stack.
If NavigationView.add hasn’t been called for any of the popped
pages, they are automatically removed.
"popped" will be be emitted for each of the popped pages.
See NavigationView.pop and NavigationView.pop_to_tag.
Passed: a <AdwNavigationView>.
a navigation view
Passed: a <AdwNavigationPage>.
the page to pop to
Returned: a boolean.
TRUE if any pages have been popped
Pops pages from the navigation stack until page with the tag tag is visible.
The page must be in the navigation stack.
If NavigationView.add hasn’t been called for any of the popped
pages, they are automatically removed.
"popped" will be emitted for each of the popped pages.
See NavigationView.pop_to_page and NavigationPage:tag.
Passed: a <AdwNavigationView>.
a navigation view
Passed: a string.
a page tag
Returned: a boolean.
TRUE if any pages have been popped
Pops the visible page from the navigation stack.
Does nothing if the navigation stack contains less than two pages.
If NavigationView.add hasn’t been called, the page is
automatically removed.
"popped" will be emitted for the current visible page.
See NavigationView.pop_to_page and
NavigationView.pop_to_tag.
Passed: a <AdwNavigationView>.
a navigation view
Returned: a boolean.
TRUE if a page has been popped
Pushes page onto the navigation stack.
If NavigationView.add hasn’t been called, the page is
automatically removed once it’s popped.
"pushed" will be emitted for page.
See NavigationView.push_by_tag.
Passed: a <AdwNavigationView>.
a navigation view
Passed: a <AdwNavigationPage>.
the page to push
Pushes the page with the tag tag onto the navigation stack.
If NavigationView.add hasn’t been called, the page is
automatically removed once it’s popped.
"pushed" will be emitted for the page.
See NavigationView.push and NavigationPage:tag.
Passed: a <AdwNavigationView>.
a navigation view
Passed: a string.
the page tag
Removes page from self.
If page is currently in the navigation stack, it will be removed once it’s popped. Otherwise, it’s removed immediately.
See NavigationView.add.
Passed: a <AdwNavigationView>.
a navigation view
Passed: a <AdwNavigationPage>.
the page to remove
Replaces the current navigation stack with pages.
The last page becomes the visible page.
Replacing the navigation stack has no animation.
If NavigationView.add hasn’t been called for any pages that are
no longer in the navigation stack, they are automatically removed.
n-pages can be 0, in that case no page will be visible after calling this method. This can be useful for removing all pages from self.
The "replaced" signal will be emitted.
See NavigationView.replace_with_tags.
Passed: a <AdwNavigationView>.
a navigation view
Passed: a list or vector, each a
<AdwNavigationPage>.
the new navigation stack
Not passed: guile-gi gives the length of pages.
the number of pages in pages
Replaces the current navigation stack with pages with the tags tags.
The last page becomes the visible page.
Replacing the navigation stack has no animation.
If NavigationView.add hasn’t been called for any pages that are
no longer in the navigation stack, they are automatically removed.
n-tags can be 0, in that case no page will be visible after calling this method. This can be useful for removing all pages from self.
The "replaced" signal will be emitted.
See NavigationView.replace and NavigationPage:tag.
Passed: a <AdwNavigationView>.
a navigation view
Passed: a list or vector, each a string.
tags of the pages in the navigation stack
Not passed: guile-gi gives the length of tags.
the number of tags
Sets whether self should animate page transitions.
Gesture-based transitions are always animated.
Passed: a <AdwNavigationView>.
a navigation view
Passed: a boolean.
whether to animate page transitions
Sets self to be horizontally homogeneous or not.
If the view is horizontally homogeneous, it allocates the same width for all pages.
If it’s not, the view may change width when a different page becomes visible.
Passed: a <AdwNavigationView>.
a navigation view
Passed: a boolean.
whether to make self horizontally homogeneous
Sets whether pressing Escape pops the current page on self.
Applications using <AdwNavigationView> to
implement a browser may want to disable it.
Passed: a <AdwNavigationView>.
a navigation view
Passed: a boolean.
whether to pop the current page when pressing Escape
Sets self to be vertically homogeneous or not.
If the view is vertically homogeneous, it allocates the same height for all pages.
If it’s not, the view may change height when a different page becomes visible.
Passed: a <AdwNavigationView>.
a navigation view
Passed: a boolean.
whether to make self vertically homogeneous
Connect a handler with (connect object
navigation-view:get-next-page handler). It is called as (handler
self) ⇒ %return.
Emitted when a push shortcut or a gesture is triggered.
To support the push shortcuts and gestures, the application is expected to return the page to push in the handler.
This signal can be emitted multiple times for the gestures, for example when the gesture is cancelled by the user. As such, the application must not make any irreversible changes in the handler, such as removing the page from a forward stack.
Instead, it should be done in the "pushed" handler.
Passed: a <AdwNavigationView>.
Returned: a <AdwNavigationPage>, or
#f.
the page to push
Connect a handler with (connect object navigation-view:popped
handler). It is called as (handler self page).
Emitted after page has been popped from the navigation stack.
See NavigationView.pop.
When using NavigationView.pop_to_page or
NavigationView.pop_to_tag, this signal is emitted for each of the
popped pages.
Passed: a <AdwNavigationView>.
Passed: a <AdwNavigationPage>.
the popped page
Connect a handler with (connect object navigation-view:pushed
handler). It is called as (handler self).
Emitted after a page has been pushed to the navigation stack.
See NavigationView.push.
Passed: a <AdwNavigationView>.
Connect a handler with (connect object navigation-view:replaced
handler). It is called as (handler self).
Emitted after the navigation stack has been replaced.
See NavigationView.replace.
Passed: a <AdwNavigationView>.
Next: <AdwNoneAnimationTarget>, Previous: <AdwNavigationSplitView>, Up: Classes [Index]