-
-
Notifications
You must be signed in to change notification settings - Fork 12
VariantWidget: use toolbarview, backbutton #220
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
Open
danirabbit
wants to merge
4
commits into
main
Choose a base branch
from
danirabbit/variantwidget-modernize
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| /* | ||
| * SPDX-License-Identifier: GPL-3.0-or-later | ||
| * SPDX-FileCopyrightText: 2017-2023 elementary, Inc. (https://elementary.io) | ||
| * SPDX-FileCopyrightText: 2017-2026 elementary, Inc. (https://elementary.io) | ||
| */ | ||
|
|
||
| public class VariantWidget : Gtk.Frame { | ||
|
|
@@ -11,7 +11,6 @@ public class VariantWidget : Gtk.Frame { | |
|
|
||
| public signal void going_to_main (); | ||
|
|
||
| private Gtk.Box variant_box; | ||
| private Adw.NavigationView navigation_view; | ||
| private Adw.NavigationPage variant_page; | ||
|
|
||
|
|
@@ -29,47 +28,43 @@ public class VariantWidget : Gtk.Frame { | |
|
|
||
| var main_page = new Adw.NavigationPage (main_scrolled, main_title); | ||
|
|
||
| variant_listbox = new Gtk.ListBox (); | ||
| variant_listbox.activate_on_single_click = false; | ||
| variant_listbox = new Gtk.ListBox () { | ||
| activate_on_single_click = false | ||
| }; | ||
|
|
||
| var variant_scrolled = new Gtk.ScrolledWindow () { | ||
| child = variant_listbox, | ||
| hscrollbar_policy = NEVER, | ||
| vexpand = true | ||
| }; | ||
|
|
||
| var back_button = new Gtk.Button.with_label (main_page.title) { | ||
| halign = START, | ||
| margin_top = 6, | ||
| margin_end = 6, | ||
| margin_bottom = 6, | ||
| margin_start = 6 | ||
| var back_button = new Granite.BackButton (main_page.title) { | ||
| halign = START | ||
| }; | ||
| back_button.add_css_class (Granite.STYLE_CLASS_BACK_BUTTON); | ||
|
|
||
| var variant_title = new Gtk.Label ("") { | ||
| hexpand = true, | ||
| justify = CENTER, | ||
| margin_end = 6, | ||
| margin_start = 6, | ||
| mnemonic_widget = variant_listbox, | ||
| wrap = true | ||
| }; | ||
| variant_title.add_css_class (Granite.STYLE_CLASS_H4_LABEL); | ||
|
|
||
| var header_box = new Gtk.CenterBox () { | ||
| start_widget = back_button, | ||
| center_widget = variant_title, | ||
| hexpand = true | ||
| var header_box = new Gtk.HeaderBar () { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| hexpand = true, | ||
| show_title_buttons = false, | ||
| title_widget = variant_title | ||
| }; | ||
| header_box.pack_start (back_button); | ||
|
|
||
| variant_box = new Gtk.Box (VERTICAL, 0); | ||
| variant_box.add_css_class (Granite.STYLE_CLASS_VIEW); | ||
| variant_box.append (header_box); | ||
| variant_box.append (new Gtk.Separator (HORIZONTAL)); | ||
| variant_box.append (variant_scrolled); | ||
| var toolbarview = new Adw.ToolbarView () { | ||
| content = variant_scrolled, | ||
| top_bar_style = RAISED_BORDER | ||
| }; | ||
| toolbarview.add_top_bar (header_box); | ||
| toolbarview.add_css_class (Granite.STYLE_CLASS_VIEW); | ||
|
|
||
| variant_page = new Adw.NavigationPage (variant_box, ""); | ||
| variant_page = new Adw.NavigationPage (toolbarview, ""); | ||
|
|
||
| navigation_view = new Adw.NavigationView (); | ||
| navigation_view.add (main_page); | ||
|
|
||
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.

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.
Clicking the
Input Languagebutton now get you back to the language selection instead of all keyboard layouts.