From aed674e412b5f46ec3d1a366da18d1e8a72dc556 Mon Sep 17 00:00:00 2001 From: Ward from fusion-voyager-3 Date: Tue, 18 Jun 2024 04:44:03 +0300 Subject: [PATCH] move bottom toolbar to page --- src/build_ui/mod.rs | 34 ++-------------------------------- src/content/mod.rs | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 32 deletions(-) diff --git a/src/build_ui/mod.rs b/src/build_ui/mod.rs index 73b7197..3c68214 100644 --- a/src/build_ui/mod.rs +++ b/src/build_ui/mod.rs @@ -20,47 +20,17 @@ pub fn build_ui(app: &adw::Application) { .title_widget(&adw::WindowTitle::builder().title(PRETTY_NAME).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() .transition_type(StackTransitionType::Crossfade) .build(); - content_stack.add_named(&content::content(), Some("content_page")); - - - let window_toolbar = adw::ToolbarView::builder() .content(&content_stack) .build(); + content_stack.add_named(&content::content(), Some("content_page")); + window_toolbar.add_top_bar(&window_headerbar); - window_toolbar.add_bottom_bar(&window_bottombar); let window = adw::ApplicationWindow::builder() .application(app) diff --git a/src/content/mod.rs b/src/content/mod.rs index 6b17496..409c6ff 100644 --- a/src/content/mod.rs +++ b/src/content/mod.rs @@ -105,6 +105,35 @@ pub fn content() -> gtk::Box { content_box.append(&kernel_branch_expander_row_boxedlist); 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 }