add disk names and impl scroll overflow

This commit is contained in:
Ward from fusion-voyager-3 2024-10-11 19:11:15 +03:00
parent 390b3dae75
commit 10f44e28ec
9 changed files with 67 additions and 9 deletions

View File

@ -14,6 +14,11 @@ then
lsblk -b --output SIZE -n -d /dev/"$2"
fi
if [[ "$1" = "get_block_model" ]]
then
cat /sys/class/block/"$2"/device/model
fi
if [[ "$1" = "has_encryption" ]]
then
if blkid -o value -s TYPE $(lsblk -sJp | jq -r --arg dsk /dev/"$2" '.blockdevices | .[] | select(.name == $dsk) | .children | .[0] | .name') | grep -i luks > /dev/null 2>&1

View File

@ -377,8 +377,8 @@ pub fn automatic_partitioning_page(
device_button.set_group(Some(&null_checkbutton));
let device_row = adw::ActionRow::builder()
.activatable_widget(&device_button)
.title(&device.block_name)
.subtitle(&device.block_size_pretty)
.title(&device.block_model)
.subtitle(device.clone().block_name + " " + &device.block_size_pretty)
.build();
device_row.add_prefix(&device_button);
devices_selection_expander_row_viewport_box.append(&device_row);

View File

@ -34,6 +34,7 @@ pub struct PikaKeymap {
#[derive(Default, Clone, Debug)]
pub struct BlockDevice {
pub block_name: String,
pub block_model: String,
pub block_size: f64,
pub block_size_pretty: String,
}

View File

@ -24,15 +24,18 @@ pub fn eula_page(main_carousel: &adw::Carousel, language_changed_action: &gio::S
.vexpand(true)
.editable(false)
.buffer(&eula_buffer)
.right_margin(10)
.left_margin(10)
.build();
let eula_selection_text_scroll = gtk::ScrolledWindow::builder()
.vexpand(true)
.hexpand(true)
.has_frame(true)
.overflow(gtk::Overflow::Hidden)
.child(&eula_selection_text_view)
.build();
eula_selection_text_scroll.add_css_class("round-all-scroll");
eula_selection_text_scroll.add_css_class("round-all-scroll-no-padding");
let eula_accept_checkbutton = gtk::CheckButton::builder()
.margin_top(15)

View File

@ -29,16 +29,17 @@ pub fn keyboard_page(
.selection_mode(gtk::SelectionMode::None)
.build();
keyboard_selection_row_viewport_listbox.add_css_class("boxed-list");
keyboard_selection_row_viewport_listbox.add_css_class("round-border-only");
keyboard_selection_row_viewport_listbox.add_css_class("no-round-borders");
let keyboard_selection_row_viewport = gtk::ScrolledWindow::builder()
.vexpand(true)
.hexpand(true)
.has_frame(true)
.overflow(gtk::Overflow::Hidden)
.child(&keyboard_selection_row_viewport_listbox)
.build();
keyboard_selection_row_viewport.add_css_class("round-border-only-top-with-padding");
keyboard_selection_row_viewport.add_css_class("round-border-only-top-with-no-padding");
let keyboard_search_bar = gtk::SearchEntry::builder()
.hexpand(true)

View File

@ -32,16 +32,17 @@ pub fn language_page(
.selection_mode(gtk::SelectionMode::None)
.build();
language_selection_row_viewport_listbox.add_css_class("boxed-list");
language_selection_row_viewport_listbox.add_css_class("round-all-scroll");
language_selection_row_viewport_listbox.add_css_class("no-round-borders");
let language_selection_row_viewport = gtk::ScrolledWindow::builder()
.vexpand(true)
.hexpand(true)
.has_frame(true)
.overflow(gtk::Overflow::Hidden)
.child(&language_selection_row_viewport_listbox)
.build();
language_selection_row_viewport.add_css_class("round-all-scroll");
language_selection_row_viewport.add_css_class("round-all-scroll-no-padding");
let language_search_bar = gtk::SearchEntry::builder()
.hexpand(true)

View File

@ -196,8 +196,10 @@ pub fn get_block_devices() -> Vec<BlockDevice> {
match blockdev {
Ok(r) => {
let block_size = get_block_size(&r);
let block_model = get_block_model(&r);
block_devices.push(BlockDevice {
block_name: r,
block_model,
block_size,
block_size_pretty: pretty_bytes::converter::convert(block_size),
})
@ -230,6 +232,24 @@ fn get_block_size(block_dev: &str) -> f64 {
size
}
fn get_block_model(block_dev: &str) -> String {
let command = match std::process::Command::new("sudo")
.arg("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh")
.arg("get_block_model")
.arg(block_dev)
.output()
{
Ok(t) => t,
Err(_) => return "Unknown".to_owned(),
};
let model = match String::from_utf8(command.stdout) {
Ok(t) => t.trim().to_owned(),
Err(_) => "Unknown".to_owned(),
};
model
}
pub fn get_partitions() -> Vec<Partition> {
let mut partitions = Vec::new();

View File

@ -72,6 +72,28 @@
padding-bottom: 3px;
}
.round-all-scroll-no-padding {
border-top-right-radius: 15px;
border-top-left-radius: 15px;
border-bottom-right-radius: 15px;
border-bottom-left-radius: 15px;
padding-top: 0px;
padding-right: 0px;
padding-left: 0px;
padding-bottom: 0px;
}
.round-border-only-top-with-no-padding {
border-top-right-radius: 15px;
border-top-left-radius: 15px;
border-bottom-right-radius: 0px;
border-bottom-left-radius: 0px;
padding-top: 0px;
padding-right: 0px;
padding-left: 0px;
padding-bottom: 0px;
}
.round-border-only-bottom {
border-top-right-radius: 0px;
border-top-left-radius: 0px;
@ -84,6 +106,10 @@
border-top-left-radius: 0px;
border-bottom-right-radius: 0px;
border-bottom-left-radius: 0px;
padding-top: 0px;
padding-right: 0px;
padding-left: 0px;
padding-bottom: 0px;
}

View File

@ -28,16 +28,17 @@ pub fn timezone_page(
.selection_mode(gtk::SelectionMode::None)
.build();
timezone_selection_row_viewport_listbox.add_css_class("boxed-list");
timezone_selection_row_viewport_listbox.add_css_class("round-all-scroll");
timezone_selection_row_viewport_listbox.add_css_class("no-round-borders");
let timezone_selection_row_viewport = gtk::ScrolledWindow::builder()
.vexpand(true)
.hexpand(true)
.has_frame(true)
.overflow(gtk::Overflow::Hidden)
.child(&timezone_selection_row_viewport_listbox)
.build();
timezone_selection_row_viewport.add_css_class("round-all-scroll");
timezone_selection_row_viewport.add_css_class("round-all-scroll-no-padding");
let timezone_search_bar = gtk::SearchEntry::builder()
.hexpand(true)