diff --git a/src/automatic_partitioning_page/mod.rs b/src/automatic_partitioning_page/mod.rs index 9b2defe..cca1b80 100644 --- a/src/automatic_partitioning_page/mod.rs +++ b/src/automatic_partitioning_page/mod.rs @@ -652,31 +652,46 @@ pub fn automatic_partitioning_page( advanced_home_seperation_selection_checkbutton_none, move |_, _| { automatic_partitioning_page.set_page_title(t!("automatic_partitioning_page_title")); - automatic_partitioning_page.set_page_subtitle(t!("automatic_partitioning_page_subtitle")); + automatic_partitioning_page + .set_page_subtitle(t!("automatic_partitioning_page_subtitle")); automatic_partitioning_page.set_back_tooltip_label(t!("back")); automatic_partitioning_page.set_next_tooltip_label(t!("next")); // - devices_selection_expander_row.set_title(&t!("devices_selection_expander_row_title_no_drive_selected")); + devices_selection_expander_row.set_title(&t!( + "devices_selection_expander_row_title_no_drive_selected" + )); // - partition_method_automatic_disk_nodisk_error_label.set_label(&t!("partition_method_automatic_disk_nodisk_error_label_label")); + partition_method_automatic_disk_nodisk_error_label.set_label(&t!( + "partition_method_automatic_disk_nodisk_error_label_label" + )); // - partition_method_automatic_disk_small_error_label - .set_label(&t!("partition_method_automatic_disk_small_error_label_label")); + partition_method_automatic_disk_small_error_label.set_label(&t!( + "partition_method_automatic_disk_small_error_label_label" + )); // - partition_method_automatic_luks_empty_error_label.set_label(&t!("partition_method_automatic_luks_empty_error_label_label")); + partition_method_automatic_luks_empty_error_label.set_label(&t!( + "partition_method_automatic_luks_empty_error_label_label" + )); // - partition_method_automatic_luks_missmatch_error_label.set_label(&t!("partition_method_automatic_luks_missmatch_error_label_label")); + partition_method_automatic_luks_missmatch_error_label.set_label(&t!( + "partition_method_automatic_luks_missmatch_error_label_label" + )); // - partition_method_automatic_luks_checkbutton.set_label(Some(&t!("partition_method_automatic_luks_checkbutton_label"))); + partition_method_automatic_luks_checkbutton.set_label(Some(&t!( + "partition_method_automatic_luks_checkbutton_label" + ))); // - partition_method_automatic_luks_password_entry.set_title(&t!("partition_method_automatic_luks_password_entry_label")); + partition_method_automatic_luks_password_entry + .set_title(&t!("partition_method_automatic_luks_password_entry_label")); // - partition_method_automatic_luks_password_confirm_entry - .set_title(&t!("partition_method_automatic_luks_password_entry_label_confirm")); + partition_method_automatic_luks_password_confirm_entry.set_title(&t!( + "partition_method_automatic_luks_password_entry_label_confirm" + )); // advanced_expander.set_label(Some(&t!("advanced_expander_label"))); // - advanced_filesystem_selection_frame.set_label(Some(&t!("advanced_filesystem_selection_frame_label"))); + advanced_filesystem_selection_frame + .set_label(Some(&t!("advanced_filesystem_selection_frame_label"))); // advanced_home_seperation_selection_frame .set_label(Some(&t!("advanced_home_seperation_selection_frame_label"))); diff --git a/src/drive_mount_row/imp.rs b/src/drive_mount_row/imp.rs index 8d52357..b8fea93 100644 --- a/src/drive_mount_row/imp.rs +++ b/src/drive_mount_row/imp.rs @@ -234,7 +234,8 @@ impl ObjectImpl for DriveMountRow { #[weak] mountopts_entry_row, move |_, _| { - partition_row_expander.set_subtitle(&t!("partition_row_expander_subtitle")); + partition_row_expander + .set_subtitle(&t!("partition_row_expander_subtitle")); mountpoint_entry_row.set_title(&t!("mountpoint_entry_row_title")); mountopts_entry_row.set_title(&t!("mountopts_entry_row_title")); } diff --git a/src/keyboard_page/mod.rs b/src/keyboard_page/mod.rs index a70e02c..9720b07 100644 --- a/src/keyboard_page/mod.rs +++ b/src/keyboard_page/mod.rs @@ -189,7 +189,8 @@ pub fn keyboard_page( keyboard_page.set_back_tooltip_label(t!("back")); keyboard_page.set_next_tooltip_label(t!("next")); // - keyboard_search_bar.set_placeholder_text(Some(&t!("keyboard_search_bar_placeholder_text"))); + keyboard_search_bar + .set_placeholder_text(Some(&t!("keyboard_search_bar_placeholder_text"))); // keyboard_test_entry.set_title(&t!("keyboard_test_entry_title")) } diff --git a/src/manual_partitioning_page/mod.rs b/src/manual_partitioning_page/mod.rs index be1642b..827cdda 100644 --- a/src/manual_partitioning_page/mod.rs +++ b/src/manual_partitioning_page/mod.rs @@ -195,7 +195,7 @@ fn create_efi_row( .build(); prow }, - swap_fs_error: Rc::new(RefCell::new(false)), + swap_fs_error: Rc::new(RefCell::new(false)), hardcode_fs_error: Rc::new(RefCell::new(false)), used: Rc::new(RefCell::new(0)), never: Rc::new(RefCell::new(true)), @@ -220,7 +220,7 @@ fn create_efi_row( .build(); prow }, - swap_fs_error: Rc::new(RefCell::new(false)), + swap_fs_error: Rc::new(RefCell::new(false)), hardcode_fs_error: Rc::new(RefCell::new(false)), used: Rc::new(RefCell::new(1)), never: Rc::new(RefCell::new(false)), @@ -236,7 +236,7 @@ fn create_efi_row( .build(); prow }, - swap_fs_error: Rc::new(RefCell::new(false)), + swap_fs_error: Rc::new(RefCell::new(false)), hardcode_fs_error: Rc::new(RefCell::new(true)), used: Rc::new(RefCell::new(0)), never: Rc::new(RefCell::new(true)), @@ -252,7 +252,7 @@ fn create_efi_row( .build(); prow }, - swap_fs_error: Rc::new(RefCell::new(false)), + swap_fs_error: Rc::new(RefCell::new(false)), hardcode_fs_error: Rc::new(RefCell::new(true)), used: Rc::new(RefCell::new(0)), never: Rc::new(RefCell::new(true)), @@ -272,13 +272,21 @@ fn create_efi_row( .build(); prow }, - swap_fs_error: Rc::new(RefCell::new(false)), + swap_fs_error: Rc::new(RefCell::new(false)), hardcode_fs_error: Rc::new(RefCell::new(false)), used: Rc::new(RefCell::new(0)), never: Rc::new(RefCell::new(false)), } }; - post_check_drive_mount(&row, &partition_row_struct, &partition_button, &partition_changed_action, &partition, &used_partition_array_refcell, &subvol_partition_array_refcell); + post_check_drive_mount( + &row, + &partition_row_struct, + &partition_button, + &partition_changed_action, + &partition, + &used_partition_array_refcell, + &subvol_partition_array_refcell, + ); partition_scroll_child.append(&partition_row_struct.widget); } @@ -293,8 +301,7 @@ fn create_efi_row( if row.mountopts().contains("subvol=") || row.mountopts().contains("subvolid") { (*subvol_partition_array_refcell.borrow_mut()).push(row.partition()); } else { - (*subvol_partition_array_refcell.borrow_mut()) - .retain(|x| x != &row.partition()); + (*subvol_partition_array_refcell.borrow_mut()).retain(|x| x != &row.partition()); } partition_changed_action.activate(None); } @@ -377,7 +384,7 @@ fn create_boot_row( .build(); prow }, - swap_fs_error: Rc::new(RefCell::new(false)), + swap_fs_error: Rc::new(RefCell::new(false)), hardcode_fs_error: Rc::new(RefCell::new(false)), used: Rc::new(RefCell::new(0)), never: Rc::new(RefCell::new(true)), @@ -402,7 +409,7 @@ fn create_boot_row( .build(); prow }, - swap_fs_error: Rc::new(RefCell::new(false)), + swap_fs_error: Rc::new(RefCell::new(false)), hardcode_fs_error: Rc::new(RefCell::new(false)), used: Rc::new(RefCell::new(1)), never: Rc::new(RefCell::new(false)), @@ -418,7 +425,7 @@ fn create_boot_row( .build(); prow }, - swap_fs_error: Rc::new(RefCell::new(false)), + swap_fs_error: Rc::new(RefCell::new(false)), hardcode_fs_error: Rc::new(RefCell::new(true)), used: Rc::new(RefCell::new(0)), never: Rc::new(RefCell::new(true)), @@ -434,7 +441,7 @@ fn create_boot_row( .build(); prow }, - swap_fs_error: Rc::new(RefCell::new(false)), + swap_fs_error: Rc::new(RefCell::new(false)), hardcode_fs_error: Rc::new(RefCell::new(true)), used: Rc::new(RefCell::new(0)), never: Rc::new(RefCell::new(true)), @@ -454,13 +461,21 @@ fn create_boot_row( .build(); prow }, - swap_fs_error: Rc::new(RefCell::new(false)), + swap_fs_error: Rc::new(RefCell::new(false)), hardcode_fs_error: Rc::new(RefCell::new(false)), used: Rc::new(RefCell::new(0)), never: Rc::new(RefCell::new(false)), } }; - post_check_drive_mount(&row, &partition_row_struct, &partition_button, &partition_changed_action, &partition, &used_partition_array_refcell, &subvol_partition_array_refcell); + post_check_drive_mount( + &row, + &partition_row_struct, + &partition_button, + &partition_changed_action, + &partition, + &used_partition_array_refcell, + &subvol_partition_array_refcell, + ); partition_scroll_child.append(&partition_row_struct.widget); } @@ -475,8 +490,7 @@ fn create_boot_row( if row.mountopts().contains("subvol=") || row.mountopts().contains("subvolid") { (*subvol_partition_array_refcell.borrow_mut()).push(row.partition()); } else { - (*subvol_partition_array_refcell.borrow_mut()) - .retain(|x| x != &row.partition()); + (*subvol_partition_array_refcell.borrow_mut()).retain(|x| x != &row.partition()); } partition_changed_action.activate(None); } @@ -559,7 +573,7 @@ fn create_root_row( .build(); prow }, - swap_fs_error: Rc::new(RefCell::new(false)), + swap_fs_error: Rc::new(RefCell::new(false)), hardcode_fs_error: Rc::new(RefCell::new(false)), used: Rc::new(RefCell::new(0)), never: Rc::new(RefCell::new(true)), @@ -584,16 +598,16 @@ fn create_root_row( .build(); prow }, - swap_fs_error: Rc::new(RefCell::new(false)), + swap_fs_error: Rc::new(RefCell::new(false)), hardcode_fs_error: Rc::new(RefCell::new(false)), used: Rc::new(RefCell::new(1)), never: Rc::new(RefCell::new(false)), } - } else if partition.part_fs == "vfat" - || partition.part_fs == "ntfs" - || partition.part_fs == "swap" - || partition.part_fs == "exfat" - || partition.part_fs == "BitLocker" + } else if partition.part_fs == "vfat" + || partition.part_fs == "ntfs" + || partition.part_fs == "swap" + || partition.part_fs == "exfat" + || partition.part_fs == "BitLocker" { PartitionRow { widget: { @@ -605,7 +619,7 @@ fn create_root_row( .build(); prow }, - swap_fs_error: Rc::new(RefCell::new(false)), + swap_fs_error: Rc::new(RefCell::new(false)), hardcode_fs_error: Rc::new(RefCell::new(true)), used: Rc::new(RefCell::new(0)), never: Rc::new(RefCell::new(true)), @@ -642,12 +656,20 @@ fn create_root_row( prow }, hardcode_fs_error: Rc::new(RefCell::new(false)), - swap_fs_error: Rc::new(RefCell::new(false)), + swap_fs_error: Rc::new(RefCell::new(false)), used: Rc::new(RefCell::new(0)), never: Rc::new(RefCell::new(false)), } }; - post_check_drive_mount(&row, &partition_row_struct, &partition_button, &partition_changed_action, &partition, &used_partition_array_refcell, &subvol_partition_array_refcell); + post_check_drive_mount( + &row, + &partition_row_struct, + &partition_button, + &partition_changed_action, + &partition, + &used_partition_array_refcell, + &subvol_partition_array_refcell, + ); partition_scroll_child.append(&partition_row_struct.widget); } @@ -662,8 +684,7 @@ fn create_root_row( if row.mountopts().contains("subvol=") || row.mountopts().contains("subvolid") { (*subvol_partition_array_refcell.borrow_mut()).push(row.partition()); } else { - (*subvol_partition_array_refcell.borrow_mut()) - .retain(|x| x != &row.partition()); + (*subvol_partition_array_refcell.borrow_mut()).retain(|x| x != &row.partition()); } partition_changed_action.activate(None); } @@ -745,7 +766,7 @@ fn create_mount_row( prow }, hardcode_fs_error: Rc::new(RefCell::new(false)), - swap_fs_error: Rc::new(RefCell::new(false)), + swap_fs_error: Rc::new(RefCell::new(false)), used: Rc::new(RefCell::new(0)), never: Rc::new(RefCell::new(true)), } @@ -770,7 +791,7 @@ fn create_mount_row( prow }, hardcode_fs_error: Rc::new(RefCell::new(false)), - swap_fs_error: Rc::new(RefCell::new(false)), + swap_fs_error: Rc::new(RefCell::new(false)), used: Rc::new(RefCell::new(1)), never: Rc::new(RefCell::new(false)), } @@ -790,12 +811,20 @@ fn create_mount_row( prow }, hardcode_fs_error: Rc::new(RefCell::new(false)), - swap_fs_error: Rc::new(RefCell::new(false)), + swap_fs_error: Rc::new(RefCell::new(false)), used: Rc::new(RefCell::new(0)), never: Rc::new(RefCell::new(false)), } }; - post_check_drive_mount(&row, &partition_row_struct, &partition_button, &partition_changed_action, &partition, &used_partition_array_refcell, &subvol_partition_array_refcell); + post_check_drive_mount( + &row, + &partition_row_struct, + &partition_button, + &partition_changed_action, + &partition, + &used_partition_array_refcell, + &subvol_partition_array_refcell, + ); partition_scroll_child.append(&partition_row_struct.widget); } @@ -810,8 +839,7 @@ fn create_mount_row( if row.mountopts().contains("subvol=") || row.mountopts().contains("subvolid") { (*subvol_partition_array_refcell.borrow_mut()).push(row.partition()); } else { - (*subvol_partition_array_refcell.borrow_mut()) - .retain(|x| x != &row.partition()); + (*subvol_partition_array_refcell.borrow_mut()).retain(|x| x != &row.partition()); } partition_changed_action.activate(None); } @@ -840,7 +868,15 @@ fn create_mount_row( ); } -fn post_check_drive_mount(row: &DriveMountRow, partition_row_struct: &PartitionRow, partition_button: >k::CheckButton, partition_changed_action: &gio::SimpleAction, partition: &Partition, used_partition_array_refcell: &Rc>>, subvol_partition_array_refcell: &Rc>>) { +fn post_check_drive_mount( + row: &DriveMountRow, + partition_row_struct: &PartitionRow, + partition_button: >k::CheckButton, + partition_changed_action: &gio::SimpleAction, + partition: &Partition, + used_partition_array_refcell: &Rc>>, + subvol_partition_array_refcell: &Rc>>, +) { partition_row_struct.widget.add_prefix(partition_button); partition_button.connect_toggled(clone!( #[weak] @@ -859,8 +895,7 @@ fn post_check_drive_mount(row: &DriveMountRow, partition_row_struct: &PartitionR row.set_partition(part_name.to_string()); (*used_partition_array_refcell.borrow_mut()).push(part_name.to_string()); } else { - (*used_partition_array_refcell.borrow_mut()) - .retain(|x| x != &partition.part_name); + (*used_partition_array_refcell.borrow_mut()).retain(|x| x != &partition.part_name); } partition_changed_action.activate(None); } @@ -876,7 +911,10 @@ fn post_check_drive_mount(row: &DriveMountRow, partition_row_struct: &PartitionR if row.mountpoint() == "[SWAP]" { if partition.part_fs == "linux-swap" { (*partition_row_struct.swap_fs_error.borrow_mut()) = false; - if *partition_row_struct.never.borrow() == false && *partition_row_struct.swap_fs_error.borrow() == false && *partition_row_struct.hardcode_fs_error.borrow() == false { + if *partition_row_struct.never.borrow() == false + && *partition_row_struct.swap_fs_error.borrow() == false + && *partition_row_struct.hardcode_fs_error.borrow() == false + { partition_row_struct.widget.set_sensitive(true); } } else { @@ -905,29 +943,35 @@ fn post_check_drive_mount(row: &DriveMountRow, partition_row_struct: &PartitionR #[strong] subvol_partition_array_refcell, move |_, _| { - let part_name = &partition.part_name; - let used_partition_array = used_partition_array_refcell.borrow(); - let subvol_partition_array = subvol_partition_array_refcell.borrow(); - if used_partition_array + let part_name = &partition.part_name; + let used_partition_array = used_partition_array_refcell.borrow(); + let subvol_partition_array = subvol_partition_array_refcell.borrow(); + if used_partition_array + .iter() + .any(|e| part_name == e && part_name != &row.partition()) + { + if subvol_partition_array .iter() .any(|e| part_name == e && part_name != &row.partition()) { - if subvol_partition_array - .iter() - .any(|e| part_name == e && part_name != &row.partition()) + if *partition_row_struct.never.borrow() == false + && *partition_row_struct.swap_fs_error.borrow() == false + && *partition_row_struct.hardcode_fs_error.borrow() == false { - if *partition_row_struct.never.borrow() == false && *partition_row_struct.swap_fs_error.borrow() == false && *partition_row_struct.hardcode_fs_error.borrow() == false { - partition_row_struct.widget.set_sensitive(true); - } - (*partition_row_struct.used.borrow_mut()) = 2; - } else { - partition_row_struct.widget.set_sensitive(false); - (*partition_row_struct.used.borrow_mut()) = 1; + partition_row_struct.widget.set_sensitive(true); } - } else if *partition_row_struct.never.borrow() == false && *partition_row_struct.swap_fs_error.borrow() == false && *partition_row_struct.hardcode_fs_error.borrow() == false { - partition_row_struct.widget.set_sensitive(true); - (*partition_row_struct.used.borrow_mut()) = 0; + (*partition_row_struct.used.borrow_mut()) = 2; + } else { + partition_row_struct.widget.set_sensitive(false); + (*partition_row_struct.used.borrow_mut()) = 1; } + } else if *partition_row_struct.never.borrow() == false + && *partition_row_struct.swap_fs_error.borrow() == false + && *partition_row_struct.hardcode_fs_error.borrow() == false + { + partition_row_struct.widget.set_sensitive(true); + (*partition_row_struct.used.borrow_mut()) = 0; + } } )); } @@ -941,7 +985,6 @@ fn create_hardcoded_rows( used_partition_array_refcell: &Rc>>, subvol_partition_array_refcell: &Rc>>, ) { - let drive_mount_add_button_icon = gtk::Image::builder() .icon_name("list-add") .halign(gtk::Align::Start) diff --git a/src/partitioning_page/mod.rs b/src/partitioning_page/mod.rs index 83ed6b3..5b7a0c8 100644 --- a/src/partitioning_page/mod.rs +++ b/src/partitioning_page/mod.rs @@ -46,10 +46,55 @@ pub fn partitioning_page( content_box.add_css_class("linked"); - let automatic_method_button = gtk::Button::builder().icon_name("builder").build(); + let manual_method_button_icon = gtk::Image::builder() + .icon_name("emblem-system-symbolic") + .margin_end(2) + .halign(gtk::Align::Start) + .build(); + + let manual_method_button_label = gtk::Label::builder() + .label(t!("manual_method_button_label")) + .halign(gtk::Align::Center) + .hexpand(true) + .build(); + + let manual_method_button_child_box = gtk::Box::new(gtk::Orientation::Horizontal, 0); + + manual_method_button_child_box.append(&manual_method_button_icon); + manual_method_button_child_box.append(&manual_method_button_label); + + let automatic_method_button_icon = gtk::Image::builder() + .icon_name("builder") + .margin_end(2) + .halign(gtk::Align::Start) + .build(); + + let automatic_method_button_label = gtk::Label::builder() + .label(t!("automatic_method_button_label")) + .halign(gtk::Align::Center) + .hexpand(true) + .build(); + + let automatic_method_button_child_box = gtk::Box::new(gtk::Orientation::Horizontal, 0); + + automatic_method_button_child_box.append(&automatic_method_button_icon); + automatic_method_button_child_box.append(&automatic_method_button_label); + + let method_labels_size_group = gtk::SizeGroup::new(gtk::SizeGroupMode::Both); + let method_icons_size_group = gtk::SizeGroup::new(gtk::SizeGroupMode::Both); + + method_labels_size_group.add_widget(&manual_method_button_label); + method_labels_size_group.add_widget(&automatic_method_button_label); + + method_icons_size_group.add_widget(&manual_method_button_icon); + method_icons_size_group.add_widget(&automatic_method_button_icon); let manual_method_button = gtk::Button::builder() - .icon_name("emblem-system-symbolics") + .child(&manual_method_button_child_box) + .build(); + + let automatic_method_button = gtk::Button::builder() + .child(&automatic_method_button_child_box) .build(); automatic_method_button.connect_clicked(clone!( @@ -79,9 +124,9 @@ pub fn partitioning_page( partitioning_page.set_back_tooltip_label(t!("back")); partitioning_page.set_next_tooltip_label(t!("next")); // - automatic_method_button.set_label(&t!("automatic_method_button_label")); + automatic_method_button_label.set_label(&t!("automatic_method_button_label")); // - manual_method_button.set_label(&t!("manual_method_button_label")); + manual_method_button_label.set_label(&t!("manual_method_button_label")); } )); // diff --git a/src/timezone_page/mod.rs b/src/timezone_page/mod.rs index 901f873..b54a8ee 100644 --- a/src/timezone_page/mod.rs +++ b/src/timezone_page/mod.rs @@ -159,7 +159,8 @@ pub fn timezone_page( timezone_page.set_back_tooltip_label(t!("back")); timezone_page.set_next_tooltip_label(t!("next")); // - timezone_search_bar.set_placeholder_text(Some(&t!("timezone_search_bar_placeholder_text"))); + timezone_search_bar + .set_placeholder_text(Some(&t!("timezone_search_bar_placeholder_text"))); } )); // diff --git a/src/welcome_page/mod.rs b/src/welcome_page/mod.rs index c19a392..b6db66c 100644 --- a/src/welcome_page/mod.rs +++ b/src/welcome_page/mod.rs @@ -21,14 +21,55 @@ pub fn welcome_page(window: &adw::ApplicationWindow, main_carousel: &adw::Carous content_box.add_css_class("linked"); - let live_media_button = gtk::Button::builder() + let live_media_button_icon = gtk::Image::builder() .icon_name("drive-optical") + .margin_end(2) + .halign(gtk::Align::Start) + .build(); + + let live_media_button_label = gtk::Label::builder() .label(t!("live_media_button_label")) + .halign(gtk::Align::Center) + .hexpand(true) + .build(); + + let live_media_button_child_box = gtk::Box::new(gtk::Orientation::Horizontal, 0); + + live_media_button_child_box.append(&live_media_button_icon); + live_media_button_child_box.append(&live_media_button_label); + + let install_media_button_icon = gtk::Image::builder() + .icon_name("drive-harddisk") + .margin_end(2) + .halign(gtk::Align::Start) + .build(); + + let install_media_button_label = gtk::Label::builder() + .label(t!("install_media_button_label")) + .halign(gtk::Align::Center) + .hexpand(true) + .build(); + + let install_media_button_child_box = gtk::Box::new(gtk::Orientation::Horizontal, 0); + + install_media_button_child_box.append(&install_media_button_icon); + install_media_button_child_box.append(&install_media_button_label); + + let media_labels_size_group = gtk::SizeGroup::new(gtk::SizeGroupMode::Both); + let media_icons_size_group = gtk::SizeGroup::new(gtk::SizeGroupMode::Both); + + media_labels_size_group.add_widget(&live_media_button_label); + media_labels_size_group.add_widget(&install_media_button_label); + + media_icons_size_group.add_widget(&live_media_button_icon); + media_icons_size_group.add_widget(&install_media_button_icon); + + let live_media_button = gtk::Button::builder() + .child(&live_media_button_child_box) .build(); let install_media_button = gtk::Button::builder() - .icon_name("drive-harddisk") - .label(t!("install_media_button_label")) + .child(&install_media_button_child_box) .build(); install_media_button.connect_clicked(clone!(