-
-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add BackButton #692
base: main
Are you sure you want to change the base?
Add BackButton #692
Conversation
* Use Gtk.Image, deprecate style class, demo * Update BackButton.vala
It now won't hide when there is no preceding page since that caused problems with it not being mapped again because it's not visible so that it won't recheck whether anything changed. It could still be implemented if needed but since there's usually always exactly one page that's the first and we know which one it is (Home on appcenter, category on settings, welcome on videos) I don't think it's worth the effort. |
lib/Widgets/BackButton.vala
Outdated
var previous_page = navigation_view.get_previous_page (navigation_page); | ||
|
||
if (previous_page != null) { | ||
label = previous_page.title; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that page title can and will change.
The logic in libadwaita's own back buttons is also a lot more complicated because navigation views can be nested, and can also be structured like:
navigation split view
sidebar: navigation view
content: navigation view
and that situation is handled correctly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, tho the latter involves private api - forgot about that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that page title can and will change.
Should be fixed although I think that would be kinda questionable UX while the page itself is not visible?
The logic in libadwaita's own back buttons is also a lot more complicated because navigation views can be nested, and can also be structured like:
navigation split view
sidebar: navigation view
content: navigation viewand that situation is handled correctly
I'm guessing that if the button is on the deepest view and there is no page left it still appears and instead navigates one above?
I think for now and for our use case it might be enough to leave that out (since we also don't hide when there is no preceding page)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be fixed although I think that would be kinda questionable UX while the page itself is not visible?
Questionable yes, but I mean the property is writable, so...
I'm guessing that if the button is on the deepest view and there is no page left it still appears and instead navigates one above?
Correct.
I think for now and for our use case it might be enough to leave that out (since we also don't hide when there is no preceding page)
As you prefer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding the nested part cc @danirabbit ?
I think @tintou has some thoughts about adding Adw as a dep here in Granite |
Introduce a BackButton that automatically lables itself correctly with the preceding page and navigates back when clicked. Useful for elementary/switchboard#300 as well as in videos, appcenter, etc.
This will introduce an Adw dependency with minimum required version 1.4 which will break building granite on OS 7