Adjust about page to match design, open links
This commit is contained in:
parent
b77e89d762
commit
a305f7501e
3 changed files with 58 additions and 6 deletions
37
Cargo.lock
generated
37
Cargo.lock
generated
|
|
@ -1194,6 +1194,7 @@ dependencies = [
|
|||
"libcosmic",
|
||||
"log",
|
||||
"notify",
|
||||
"open",
|
||||
"patch",
|
||||
"rust-embed",
|
||||
"serde",
|
||||
|
|
@ -3148,6 +3149,15 @@ dependencies = [
|
|||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "is-docker"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "928bae27f42bc99b60d9ac7334e3a21d10ad8f1835a4e12ec3ec0464765ed1b3"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "is-terminal"
|
||||
version = "0.4.12"
|
||||
|
|
@ -3159,6 +3169,16 @@ dependencies = [
|
|||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "is-wsl"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "173609498df190136aa7dea1a91db051746d339e18476eed5ca40521f02d7aa5"
|
||||
dependencies = [
|
||||
"is-docker",
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.10"
|
||||
|
|
@ -4172,6 +4192,17 @@ dependencies = [
|
|||
"pkg-config",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "open"
|
||||
version = "5.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eedff767bc49d336bff300224f73307ae36963c843e38dc9312a22171b012cbc"
|
||||
dependencies = [
|
||||
"is-wsl",
|
||||
"libc",
|
||||
"pathdiff",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "option-ext"
|
||||
version = "0.2.0"
|
||||
|
|
@ -4356,6 +4387,12 @@ dependencies = [
|
|||
"nom_locate",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pathdiff"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd"
|
||||
|
||||
[[package]]
|
||||
name = "percent-encoding"
|
||||
version = "2.3.1"
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ grep = "0.3.1"
|
|||
ignore = "0.4.21"
|
||||
lexical-sort = "0.3.1"
|
||||
log = "0.4.20"
|
||||
open = "5.0.2"
|
||||
patch = "0.7.0"
|
||||
notify = "6.1.1"
|
||||
serde = { version = "1", features = ["serde_derive"] }
|
||||
|
|
|
|||
26
src/main.rs
26
src/main.rs
|
|
@ -321,6 +321,7 @@ pub enum Message {
|
|||
FindSearchValueChanged(String),
|
||||
GitProjectStatus(Vec<(String, PathBuf, Vec<GitStatus>)>),
|
||||
Key(Modifiers, keyboard::Key),
|
||||
LaunchUrl(String),
|
||||
Modifiers(Modifiers),
|
||||
NewFile,
|
||||
NewWindow,
|
||||
|
|
@ -721,24 +722,31 @@ impl App {
|
|||
|
||||
fn about(&self) -> Element<Message> {
|
||||
let cosmic_theme::Spacing { space_xxs, .. } = self.core().system_theme().cosmic().spacing;
|
||||
let repository = "https://github.com/pop-os/cosmic-edit";
|
||||
let hash = env!("VERGEN_GIT_SHA");
|
||||
let date = env!("VERGEN_GIT_COMMIT_DATE");
|
||||
widget::column::with_children(vec![
|
||||
widget::svg(widget::svg::Handle::from_memory(
|
||||
&include_bytes!(
|
||||
"../res/icons/hicolor/256x256/apps/com.system76.CosmicEdit.svg"
|
||||
"../res/icons/hicolor/128x128/apps/com.system76.CosmicEdit.svg"
|
||||
)[..],
|
||||
))
|
||||
.into(),
|
||||
widget::text::heading(fl!("cosmic-text-editor")).into(),
|
||||
widget::button::link("https://github.com/pop-os/cosmic-edit")
|
||||
widget::text::title3(fl!("cosmic-text-editor")).into(),
|
||||
widget::button::link(repository)
|
||||
.on_press(Message::LaunchUrl(repository.to_string()))
|
||||
.padding(0)
|
||||
.into(),
|
||||
widget::text(fl!(
|
||||
widget::button::link(fl!(
|
||||
"git-description",
|
||||
hash = env!("VERGEN_GIT_SHA"),
|
||||
date = env!("VERGEN_GIT_COMMIT_DATE")
|
||||
hash = hash,
|
||||
date = date
|
||||
))
|
||||
.on_press(Message::LaunchUrl(format!("{}/commits/{}", repository, hash)))
|
||||
.padding(0)
|
||||
.into(),
|
||||
])
|
||||
.align_items(Alignment::Center)
|
||||
.spacing(space_xxs)
|
||||
.into()
|
||||
}
|
||||
|
|
@ -1592,6 +1600,12 @@ impl Application for App {
|
|||
Message::GitProjectStatus(project_status) => {
|
||||
self.git_project_status = Some(project_status);
|
||||
}
|
||||
Message::LaunchUrl(url) => match open::that_detached(&url) {
|
||||
Ok(()) => {}
|
||||
Err(err) => {
|
||||
log::warn!("failed to open {:?}: {}", url, err);
|
||||
}
|
||||
},
|
||||
Message::Key(modifiers, key) => {
|
||||
for (key_bind, action) in self.key_binds.iter() {
|
||||
if key_bind.matches(modifiers, &key) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue