From ceb4fc3a50ec8b832b2eea88fc6e0ea7a1f0022c Mon Sep 17 00:00:00 2001 From: Ward from fusion-voyager-3 Date: Thu, 8 Aug 2024 18:56:02 +0300 Subject: [PATCH] begin auto parting work --- src/automatic_partitioning_page/mod.rs | 37 ++++++++++++++++++++++++++ src/main.rs | 1 + src/partitioning_page/mod.rs | 3 +++ 3 files changed, 41 insertions(+) create mode 100644 src/automatic_partitioning_page/mod.rs 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",