From f23f9c25e2caac3378741c07e87874f14ef150b4 Mon Sep 17 00:00:00 2001 From: Ward from fusion-voyager-3 Date: Sat, 20 Jan 2024 19:05:35 +0300 Subject: [PATCH] add gparted button --- src/partitioning_page.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/partitioning_page.rs b/src/partitioning_page.rs index da074da..000282f 100644 --- a/src/partitioning_page.rs +++ b/src/partitioning_page.rs @@ -590,6 +590,17 @@ pub fn partitioning_page(window: &adw::ApplicationWindow, content_stack: >k::S .label("Use this utility to partition/mount/format your drives.") .build(); + let partition_method_manual_gparted_button_content = adw::ButtonContent::builder() + .label("Open GPARTED") + .icon_name("gparted") + .build(); + + let partition_method_manual_gparted_button = gtk::Button::builder() + .child(&partition_method_manual_gparted_button_content_box) + .halign(Align::Center) + .valign(Align::End) + .build(); + partition_method_manual_luks_listbox.append(&partition_method_manual_luks_password_entry); partition_method_manual_luks_box.append(&partition_method_manual_luks_listbox); partition_method_manual_header_box.append(&partition_method_manual_header_text); @@ -600,12 +611,15 @@ pub fn partitioning_page(window: &adw::ApplicationWindow, content_stack: >k::S partition_method_manual_chroot_listbox.append(&partition_method_manual_chroot_dir_entry); partition_method_manual_chroot_box.append(&partition_method_manual_chroot_listbox); partition_method_manual_chroot_box.append(&partition_method_manual_chroot_dir_button); + partition_method_manual_gparted_button_content_box.append(&partition_method_manual_gparted_button_content); + partition_method_manual_gparted_button_content_box.append(&partition_method_manual_gparted_button_content_text); partition_method_manual_main_box.append(&partition_method_manual_chroot_box); partition_method_manual_main_box.append(&partition_method_manual_luks_box); partition_method_manual_main_box.append(&partition_method_manual_luks_error_label); partition_method_manual_main_box.append(&partition_method_manual_chroot_error_label); partition_method_manual_main_box.append(&partition_method_manual_boot_error_label); partition_method_manual_main_box.append(&partition_method_manual_efi_error_label); + partition_method_manual_main_box.append(&partition_method_manual_gparted_button); // clone partition_method_manual_chroot_dir_file_dialog as rust becuase glib breaks it show function for some reason let partition_method_manual_chroot_dir_file_dialog_clone = partition_method_manual_chroot_dir_file_dialog.clone(); @@ -901,6 +915,12 @@ pub fn partitioning_page(window: &adw::ApplicationWindow, content_stack: >k::S } })); + partition_method_manual_gparted_button.connect_clicked(move |_| { + Command::new("gparted") + .spawn() + .expect("gparted failed to start"); + }); + /// add all pages to partitioning stack partitioning_stack.add_titled(&partitioning_method_main_box, Some("partition_method_select_page"), "partition_method_select_page"); partitioning_stack.add_titled(&partition_method_automatic_main_box, Some("partition_method_automatic_page"), "partition_method_automatic_page");