Move permissions to settings list
This commit is contained in:
parent
60009324c8
commit
c3658dba5b
1 changed files with 34 additions and 36 deletions
70
src/tab.rs
70
src/tab.rs
|
|
@ -964,9 +964,7 @@ impl Item {
|
||||||
ItemThumbnail::NotImage => icon,
|
ItemThumbnail::NotImage => icon,
|
||||||
ItemThumbnail::Rgba(_) => {
|
ItemThumbnail::Rgba(_) => {
|
||||||
if let Some(Location::Path(path)) = &self.location_opt {
|
if let Some(Location::Path(path)) = &self.location_opt {
|
||||||
widget::image::viewer(widget::image::Handle::from_path(path))
|
widget::image(widget::image::Handle::from_path(path)).into()
|
||||||
.min_scale(1.0)
|
|
||||||
.into()
|
|
||||||
} else {
|
} else {
|
||||||
icon
|
icon
|
||||||
}
|
}
|
||||||
|
|
@ -1069,6 +1067,7 @@ impl Item {
|
||||||
let mut details = widget::column().spacing(space_xxxs);
|
let mut details = widget::column().spacing(space_xxxs);
|
||||||
details = details.push(widget::text::heading(self.name.clone()));
|
details = details.push(widget::text::heading(self.name.clone()));
|
||||||
details = details.push(widget::text(format!("Type: {}", self.mime)));
|
details = details.push(widget::text(format!("Type: {}", self.mime)));
|
||||||
|
let mut settings = Vec::new();
|
||||||
//TODO: translate!
|
//TODO: translate!
|
||||||
//TODO: correct display of folder size?
|
//TODO: correct display of folder size?
|
||||||
match &self.metadata {
|
match &self.metadata {
|
||||||
|
|
@ -1095,45 +1094,36 @@ impl Item {
|
||||||
details =
|
details =
|
||||||
details.push(widget::text(format!("Accessed: {}", format_time(time))));
|
details.push(widget::text(format!("Accessed: {}", format_time(time))));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(target_os = "windows"))]
|
#[cfg(not(target_os = "windows"))]
|
||||||
{
|
{
|
||||||
details = details.push(
|
settings.push(
|
||||||
widget::Row::new()
|
widget::settings::item::builder(format_permissions_owner(
|
||||||
.push(widget::text(format!("{}:", fl!("owner"))))
|
metadata,
|
||||||
.push(widget::text(format_permissions_owner(
|
PermissionOwner::Owner,
|
||||||
metadata,
|
))
|
||||||
PermissionOwner::Owner,
|
.description(fl!("owner"))
|
||||||
)))
|
.control(widget::text(format_permissions(
|
||||||
.push(widget::text(format!(
|
metadata,
|
||||||
"({})",
|
PermissionOwner::Owner,
|
||||||
format_permissions(metadata, PermissionOwner::Owner,)
|
))),
|
||||||
)))
|
|
||||||
.spacing(10),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
details = details.push(
|
settings.push(
|
||||||
widget::Row::new()
|
widget::settings::item::builder(format_permissions_owner(
|
||||||
.push(widget::text(format!("{}:", fl!("group"))))
|
metadata,
|
||||||
.push(widget::text(format_permissions_owner(
|
PermissionOwner::Group,
|
||||||
metadata,
|
))
|
||||||
PermissionOwner::Group,
|
.description(fl!("group"))
|
||||||
)))
|
.control(widget::text(format_permissions(
|
||||||
.push(widget::text(format!(
|
metadata,
|
||||||
"({})",
|
PermissionOwner::Group,
|
||||||
format_permissions(metadata, PermissionOwner::Group,)
|
))),
|
||||||
)))
|
|
||||||
.spacing(10),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
details = details.push(
|
settings.push(widget::settings::item::builder(fl!("other")).control(
|
||||||
widget::Row::new()
|
widget::text(format_permissions(metadata, PermissionOwner::Other)),
|
||||||
.push(widget::text(format!("{}", fl!("other"))))
|
));
|
||||||
.push(widget::text(format!(
|
|
||||||
"({})",
|
|
||||||
format_permissions(metadata, PermissionOwner::Other,)
|
|
||||||
)))
|
|
||||||
.spacing(10),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
|
|
@ -1148,6 +1138,14 @@ impl Item {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !settings.is_empty() {
|
||||||
|
let mut section = widget::settings::section();
|
||||||
|
for setting in settings {
|
||||||
|
section = section.add(setting);
|
||||||
|
}
|
||||||
|
column = column.push(section);
|
||||||
|
}
|
||||||
|
|
||||||
column.into()
|
column.into()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue