From 03a0f8ec744bc568c839986cc468c3593affa99b Mon Sep 17 00:00:00 2001 From: Ward from fusion-voyager-3 Date: Mon, 19 Aug 2024 10:28:09 +0300 Subject: [PATCH] Add some buttons to manual parting --- locales/en_US.json | 12 +++++----- src/manual_partitioning_page/mod.rs | 35 ++++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 8 deletions(-) diff --git a/locales/en_US.json b/locales/en_US.json index 1eddf82..17c50c7 100644 --- a/locales/en_US.json +++ b/locales/en_US.json @@ -14,14 +14,9 @@ "manual_method_button_label": "Manually Partition The Drive", "automatic_method_button_label": "Automatically Partition\nThe Drive", "manual_partitioning_page_title": "Manual Disk Partitioning", - "manual_partitioning_page_subtitle": "Use This Page to Create a Custom Filesystem Table for PikaOS to install into.\nNotes:\n - This installer doesn't erase any data automatically, format your drives manually via gparted.\n - To Add a linux-swap partition set mountpoint to [SWAP]", - "open_gparted": "Open GPARTED", - "manual_part_note": " - Press the plus button below to begin adding filesystem entries.", - "refresh_part_table": "Refresh Partition Table", - "validate_fs_table": "Validate Filesystem Table", + "manual_partitioning_page_subtitle": "Use This Page to Create a Custom Filesystem Table for PikaOS to install into.\nNotes:\n - This Installer Doesn't Erase Any Data Automatically, Format Your Drives MANUALLY Via The Disk Utility.\n - To Add a linux-swap Partition Set Mountpoint to [SWAP]", "fstab_status_valid": "Filesystem Table Status: All entries are valid!", "partition_row_subtitle_needs_mapper": "This partition needs a mapper!", - "fstab_subvol_warn": "Filesystem Table Warning: Partition reuse check will be skipped due to subvol usage.", "fstab_multiple_part_mountpoint_err": "Filesystem Table Error: Multiple partitions are configured to the same mountpoint!", "fstab_no_mountpoint_err": "Filesystem Table Error: One or more partitions don't have a mountpoint configured!", "fstab_no_partition_err": "Filesystem Table Error: One or more entries don't have a partition configured!", @@ -103,5 +98,8 @@ "advanced_home_seperation_selection_checkbutton_partition_label": "Yes, via a Partition", "advanced_home_seperation_selection_checkbutton_none_label": "No", "fs_unknown": "Unknown", - "drive_mount_add_button_label": "Add A Custom FIlesystem Entry" + "drive_mount_add_button_label": "Add A Custom FIlesystem Entry", + "open_disk_utility_button_label": "Open Disk Partitioning Utility", + "filesystem_table_refresh_button_label": "Refresh Filesystem Table", + "filesystem_table_validate_button_label": "Validate Filesystem Table" } diff --git a/src/manual_partitioning_page/mod.rs b/src/manual_partitioning_page/mod.rs index c89ca30..64b242c 100644 --- a/src/manual_partitioning_page/mod.rs +++ b/src/manual_partitioning_page/mod.rs @@ -4,7 +4,7 @@ use crate::partitioning_page::{get_partitions, CrypttabEntry, FstabEntry, Partit use adw::gio; use adw::prelude::*; use glib::{clone, closure_local, ffi::gboolean}; -use gtk::{glib, prelude::*}; +use gtk::{glib, prelude::*, Orientation}; use std::{cell::RefCell, rc::Rc}; mod func; @@ -69,7 +69,40 @@ pub fn manual_partitioning_page( &subvol_partition_array_refcell, ); + let open_disk_utility_button = gtk::Button::builder() + .label(t!("open_disk_utility_button_label")) + .margin_top(10) + .margin_end(5) + .halign(gtk::Align::Start) + .build(); + + let filesystem_table_refresh_button = gtk::Button::builder() + .label(t!("filesystem_table_refresh_button_label")) + .margin_top(10) + .margin_end(5) + .halign(gtk::Align::Start) + .build(); + filesystem_table_refresh_button.add_css_class("destructive-action"); + + let filesystem_table_validate_button = gtk::Button::builder() + .label(t!("filesystem_table_validate_button_label")) + .margin_top(10) + .hexpand(true) + .halign(gtk::Align::End) + .build(); + filesystem_table_validate_button.add_css_class("suggested-action"); + + let utility_buttons_box = gtk::Box::builder() + .orientation(Orientation::Horizontal) + .hexpand(true) + .build(); + + utility_buttons_box.append(&open_disk_utility_button); + utility_buttons_box.append(&filesystem_table_refresh_button); + utility_buttons_box.append(&filesystem_table_validate_button); + content_box.append(&drive_mounts_viewport); + content_box.append(&utility_buttons_box); // manual_partitioning_page.connect_closure(