fmt and add icons to welcome and part method selector

This commit is contained in:
Ward from fusion-voyager-3 2024-08-19 09:38:35 +03:00
parent f699268608
commit ccf90bc310
7 changed files with 225 additions and 78 deletions

View File

@ -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")));

View File

@ -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"));
}

View File

@ -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"))
}

View File

@ -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: &gtk::CheckButton, partition_changed_action: &gio::SimpleAction, partition: &Partition, used_partition_array_refcell: &Rc<RefCell<Vec<String>>>, subvol_partition_array_refcell: &Rc<RefCell<Vec<String>>>) {
fn post_check_drive_mount(
row: &DriveMountRow,
partition_row_struct: &PartitionRow,
partition_button: &gtk::CheckButton,
partition_changed_action: &gio::SimpleAction,
partition: &Partition,
used_partition_array_refcell: &Rc<RefCell<Vec<String>>>,
subvol_partition_array_refcell: &Rc<RefCell<Vec<String>>>,
) {
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<RefCell<Vec<String>>>,
subvol_partition_array_refcell: &Rc<RefCell<Vec<String>>>,
) {
let drive_mount_add_button_icon = gtk::Image::builder()
.icon_name("list-add")
.halign(gtk::Align::Start)

View File

@ -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"));
}
));
//

View File

@ -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")));
}
));
//

View File

@ -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!(