add partitining selector
This commit is contained in:
parent
806f415178
commit
9a37dcccb9
@ -1,6 +1,6 @@
|
||||
use std::path::Path;
|
||||
use gtk::{prelude::*, glib as glib, gio as gio};
|
||||
use crate::{efi_error_page, welcome_page, language_page, eula_page, keyboard_page, timezone_page};
|
||||
use crate::{efi_error_page, welcome_page, language_page, eula_page, keyboard_page, timezone_page, partitioning_page};
|
||||
|
||||
pub fn build_ui(app: &adw::Application) {
|
||||
glib::set_prgname(Some("pikaos_installer"));
|
||||
@ -59,5 +59,7 @@ pub fn build_ui(app: &adw::Application) {
|
||||
|
||||
timezone_page::timezone_page(&carousel, &language_changed_action);
|
||||
|
||||
partitioning_page::partitioning_page(&carousel, &language_changed_action);
|
||||
|
||||
window.present()
|
||||
}
|
@ -13,6 +13,7 @@ mod language_page;
|
||||
mod eula_page;
|
||||
mod keyboard_page;
|
||||
mod timezone_page;
|
||||
mod partitioning_page;
|
||||
|
||||
#[macro_use]
|
||||
extern crate rust_i18n;
|
||||
|
100
src/partitioning_page/mod.rs
Normal file
100
src/partitioning_page/mod.rs
Normal file
@ -0,0 +1,100 @@
|
||||
use crate::installer_stack_page;
|
||||
use gtk::{prelude::*, glib as glib, gio as gio};
|
||||
use glib::{clone, closure_local};
|
||||
pub fn partitioning_page(
|
||||
main_carousel: &adw::Carousel,
|
||||
language_changed_action: &gio::SimpleAction
|
||||
) {
|
||||
let partitioning_page = installer_stack_page::InstallerStackPage::new();
|
||||
partitioning_page.set_page_icon("media-floppy-symbolic");
|
||||
partitioning_page.set_back_sensitive(true);
|
||||
partitioning_page.set_back_visible(true);
|
||||
partitioning_page.set_next_visible(false);
|
||||
|
||||
let partitioning_carousel = adw::Carousel::builder()
|
||||
.allow_long_swipes(false)
|
||||
.allow_mouse_drag(false)
|
||||
.allow_scroll_wheel(false)
|
||||
.interactive(false)
|
||||
.vexpand(true)
|
||||
.hexpand(true)
|
||||
.build();
|
||||
|
||||
let content_box = gtk::Box::builder()
|
||||
.orientation(gtk::Orientation::Vertical)
|
||||
.vexpand(true)
|
||||
.hexpand(true)
|
||||
.valign(gtk::Align::Center)
|
||||
.halign(gtk::Align::Center)
|
||||
.homogeneous(true)
|
||||
.build();
|
||||
|
||||
content_box.add_css_class("linked");
|
||||
|
||||
let automatic_method_button = gtk::Button::builder()
|
||||
.icon_name("builder")
|
||||
.build();
|
||||
|
||||
let manual_method_button = gtk::Button::builder()
|
||||
.icon_name("org.gnome.Settings")
|
||||
.build();
|
||||
|
||||
automatic_method_button.connect_clicked(
|
||||
clone!(
|
||||
#[weak]
|
||||
partitioning_carousel,
|
||||
move |_|
|
||||
partitioning_carousel.scroll_to(&partitioning_carousel.nth_page(1), true)
|
||||
)
|
||||
);
|
||||
|
||||
manual_method_button.connect_clicked(
|
||||
clone!(
|
||||
#[weak]
|
||||
partitioning_carousel,
|
||||
move |_|
|
||||
partitioning_carousel.scroll_to(&partitioning_carousel.nth_page(2), true)
|
||||
)
|
||||
);
|
||||
|
||||
content_box.append(&automatic_method_button);
|
||||
content_box.append(&manual_method_button);
|
||||
|
||||
partitioning_page.set_child_widget(&content_box);
|
||||
|
||||
//
|
||||
language_changed_action.connect_activate(
|
||||
clone!(
|
||||
#[weak]
|
||||
partitioning_page,
|
||||
move |_, _| {
|
||||
partitioning_page.set_page_title(t!("partitioning"));
|
||||
partitioning_page.set_page_subtitle(t!("choose_install_method"));
|
||||
partitioning_page.set_back_tooltip_label(t!("back"));
|
||||
partitioning_page.set_next_tooltip_label(t!("next"));
|
||||
//
|
||||
automatic_method_button.set_label(&t!("auto_partition_drive"));
|
||||
//
|
||||
manual_method_button.set_label(&t!("manual_partition_drive"));
|
||||
}
|
||||
)
|
||||
);
|
||||
//
|
||||
|
||||
partitioning_carousel.append(&partitioning_page);
|
||||
|
||||
partitioning_page.connect_closure(
|
||||
"back-button-pressed",
|
||||
false,
|
||||
closure_local!(
|
||||
#[weak]
|
||||
main_carousel,
|
||||
move |_partitioning_page: installer_stack_page::InstallerStackPage|
|
||||
{
|
||||
main_carousel.scroll_to(&main_carousel.nth_page(4), true)
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
main_carousel.append(&partitioning_carousel)
|
||||
}
|
@ -19,6 +19,7 @@ pub fn welcome_page(
|
||||
.hexpand(true)
|
||||
.valign(gtk::Align::Center)
|
||||
.halign(gtk::Align::Center)
|
||||
.homogeneous(true)
|
||||
.build();
|
||||
|
||||
content_box.add_css_class("linked");
|
||||
|
Loading…
Reference in New Issue
Block a user