-
-
Notifications
You must be signed in to change notification settings - Fork 60
Add BackButton #692
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
Merged
Merged
Add BackButton #692
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
cbd7dd0
Add BackButton
leolost2605 bc9594d
Hide when last page
leolost2605 2d92c89
Use Gtk.Image, deprecate style class, demo (#694)
danirabbit 476bde9
Don't warn when used outside navigation view
leolost2605 79aaada
Don't hide
leolost2605 cb566a7
Bind title
leolost2605 c63f8bb
Fix build
leolost2605 2ca97ea
Merge branch 'main' into leolost/back-button
zeebok cb60b9d
Apply suggestions from code review
leolost2605 3756d07
Merge main
danirabbit a8395ad
Merge branch 'main' into leolost/back-button
danirabbit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| /* | ||
| * Copyright 2025 elementary, Inc. (https://elementary.io) | ||
| * SPDX-License-Identifier: GPL-2.0-or-later | ||
| */ | ||
|
|
||
| /** | ||
| * BackButton is meant to be used in headers to navigate in | ||
| * {@link Adw.NavigationView}. | ||
| * | ||
| * By default `action_name` is set to `navigation.pop` | ||
| */ | ||
| [Version (since = "7.7.0")] | ||
| public class Granite.BackButton : Gtk.Button { | ||
| /** | ||
| * Text of the label inside of #this | ||
| */ | ||
| public new string label { get; set; } | ||
|
|
||
| public BackButton (string label) { | ||
| Object (label: label); | ||
| } | ||
|
|
||
| construct { | ||
| var image = new Gtk.Image.from_icon_name ("go-previous-symbolic"); | ||
|
|
||
| var label_widget = new Gtk.Label (""); | ||
|
|
||
| var box = new Gtk.Box (HORIZONTAL, 0); | ||
| box.append (image); | ||
| box.append (label_widget); | ||
|
|
||
| action_name = "navigation.pop"; | ||
| child = box; | ||
| tooltip_markup = Granite.markup_accel_tooltip ({"<alt>Left"}); | ||
|
|
||
| add_css_class ("text-button"); | ||
| bind_property ("label", label_widget, "label"); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.