diff --git a/src/automatic_partitioning_page/mod.rs b/src/automatic_partitioning_page/mod.rs new file mode 100644 index 0000000..185f52a --- /dev/null +++ b/src/automatic_partitioning_page/mod.rs @@ -0,0 +1,37 @@ +use adw::gio; +use crate::installer_stack_page; +use gtk::{prelude::*, glib as glib}; +use glib::{clone, closure_local}; + +pub fn automatic_partitioning_page( + main_carousel: &adw::Carousel, + language_changed_action: &gio::SimpleAction +) { + let automatic_partitioning_page = installer_stack_page::InstallerStackPage::new(); + automatic_partitioning_page.set_page_icon("builder"); + automatic_partitioning_page.set_back_visible(true); + automatic_partitioning_page.set_next_visible(true); + automatic_partitioning_page.set_back_sensitive(true); + automatic_partitioning_page.set_next_sensitive(false); + + let content_box = gtk::Box::builder() + .orientation(gtk::Orientation::Vertical) + .hexpand(true) + .vexpand(true) + .build(); + + automatic_partitioning_page.connect_closure( + "back-button-pressed", + false, + closure_local!( + #[weak] + main_carousel, + move |_automatic_partitioning_page: installer_stack_page::InstallerStackPage| + { + main_carousel.scroll_to(&main_carousel.nth_page(0), true) + } + ) + ); + + main_carousel.append(&automatic_partitioning_page); +} diff --git a/src/main.rs b/src/main.rs index 723dfbe..c114a5d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,6 +14,7 @@ mod eula_page; mod keyboard_page; mod timezone_page; mod partitioning_page; +mod automatic_partitioning_page; #[macro_use] extern crate rust_i18n; diff --git a/src/partitioning_page/mod.rs b/src/partitioning_page/mod.rs index 8ac3e2c..244f4cc 100644 --- a/src/partitioning_page/mod.rs +++ b/src/partitioning_page/mod.rs @@ -1,6 +1,8 @@ use crate::installer_stack_page; use gtk::{prelude::*, glib as glib, gio as gio}; use glib::{clone, closure_local}; +use crate::{automatic_partitioning_page}; + pub fn partitioning_page( main_carousel: &adw::Carousel, language_changed_action: &gio::SimpleAction @@ -82,6 +84,7 @@ pub fn partitioning_page( // partitioning_carousel.append(&partitioning_page); + automatic_partitioning_page::automatic_partitioning_page(&partitioning_carousel, &language_changed_action); partitioning_page.connect_closure( "back-button-pressed",