move bottom toolbar to page

This commit is contained in:
Ward from fusion-voyager-3 2024-06-18 04:44:03 +03:00
parent 89ffdbfc26
commit aed674e412
2 changed files with 31 additions and 32 deletions

View File

@ -20,47 +20,17 @@ pub fn build_ui(app: &adw::Application) {
.title_widget(&adw::WindowTitle::builder().title(PRETTY_NAME).build()) .title_widget(&adw::WindowTitle::builder().title(PRETTY_NAME).build())
.build(); .build();
let window_bottombar = gtk::Box::builder()
.hexpand(true)
.homogeneous(true)
.margin_bottom(15)
.margin_start(15)
.margin_end(15)
.margin_start(15)
.build();
let apply_button = gtk::Button::builder()
.halign(Align::End)
.label("Apply Changes")
.build();
apply_button.add_css_class("pill");
apply_button.add_css_class("destructive-action");
let cancel_button = gtk::Button::builder()
.halign(Align::Start)
.label("Cancel Changes")
.build();
cancel_button.add_css_class("pill");
window_bottombar.append(&cancel_button);
window_bottombar.append(&apply_button);
let content_stack = gtk::Stack::builder() let content_stack = gtk::Stack::builder()
.transition_type(StackTransitionType::Crossfade) .transition_type(StackTransitionType::Crossfade)
.build(); .build();
content_stack.add_named(&content::content(), Some("content_page"));
let window_toolbar = adw::ToolbarView::builder() let window_toolbar = adw::ToolbarView::builder()
.content(&content_stack) .content(&content_stack)
.build(); .build();
content_stack.add_named(&content::content(), Some("content_page"));
window_toolbar.add_top_bar(&window_headerbar); window_toolbar.add_top_bar(&window_headerbar);
window_toolbar.add_bottom_bar(&window_bottombar);
let window = adw::ApplicationWindow::builder() let window = adw::ApplicationWindow::builder()
.application(app) .application(app)

View File

@ -105,6 +105,35 @@ pub fn content() -> gtk::Box {
content_box.append(&kernel_branch_expander_row_boxedlist); content_box.append(&kernel_branch_expander_row_boxedlist);
content_box.append(&button_box); content_box.append(&button_box);
let window_bottombar = gtk::Box::builder()
.hexpand(true)
.homogeneous(true)
.margin_bottom(15)
.margin_start(15)
.margin_end(15)
.margin_start(15)
.build();
let apply_button = gtk::Button::builder()
.halign(Align::End)
.label("Apply Changes")
.build();
apply_button.add_css_class("pill");
apply_button.add_css_class("destructive-action");
let cancel_button = gtk::Button::builder()
.halign(Align::Start)
.label("Cancel Changes")
.build();
cancel_button.add_css_class("pill");
window_bottombar.append(&cancel_button);
window_bottombar.append(&apply_button);
content_box.append(&window_bottombar);
content_box content_box
} }