diff --git a/Cargo.lock b/Cargo.lock index 1ef0a49f..333fde12 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1293,7 +1293,6 @@ dependencies = [ "unix_permissions_ext", "url", "uzers", - "vergen", "walkdir", "wayland-client", "xdg", @@ -3575,6 +3574,7 @@ dependencies = [ "iced_winit", "lazy_static", "libc", + "license", "mime 0.3.17", "palette", "rfd", @@ -3649,6 +3649,17 @@ dependencies = [ "redox_syscall 0.5.7", ] +[[package]] +name = "license" +version = "3.5.1+3.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8825807237bd9fa571b99ffea06a26901b0e44692208f87e3b040a499f1504a7" +dependencies = [ + "reword", + "serde", + "serde_json", +] + [[package]] name = "linux-raw-sys" version = "0.3.8" @@ -4255,15 +4266,6 @@ dependencies = [ "syn 2.0.87", ] -[[package]] -name = "num_threads" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9" -dependencies = [ - "libc", -] - [[package]] name = "objc" version = "0.2.7" @@ -5253,6 +5255,15 @@ dependencies = [ "usvg", ] +[[package]] +name = "reword" +version = "7.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe272098dce9ed76b479995953f748d1851261390b08f8a0ff619c885a1f0765" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "rfd" version = "0.14.1" @@ -5392,12 +5403,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "rustversion" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" - [[package]] name = "rustybuzz" version = "0.14.1" @@ -6037,14 +6042,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", - "itoa", - "libc", "num-conv", - "num_threads", "powerfmt", "serde", "time-core", - "time-macros", ] [[package]] @@ -6053,16 +6054,6 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" -[[package]] -name = "time-macros" -version = "0.2.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" -dependencies = [ - "num-conv", - "time-core", -] - [[package]] name = "tiny-keccak" version = "2.0.2" @@ -6556,18 +6547,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" -[[package]] -name = "vergen" -version = "8.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2990d9ea5967266ea0ccf413a4aa5c42a93dbcfda9cb49a97de6931726b12566" -dependencies = [ - "anyhow", - "cfg-if", - "rustversion", - "time", -] - [[package]] name = "version-compare" version = "0.2.0" diff --git a/Cargo.toml b/Cargo.toml index 52b6721e..236b6933 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,9 +6,6 @@ edition = "2021" license = "GPL-3.0-only" rust-version = "1.71" -[build-dependencies] -vergen = { version = "8", features = ["git", "gitcl"] } - [dependencies] chrono = { version = "0.4", features = ["unstable-locales"] } dirs = "5.0.1" @@ -67,7 +64,7 @@ features = ["multi-window", "tokio", "winit"] [features] default = ["bzip2", "desktop", "gvfs", "liblzma", "notify", "wgpu"] -desktop = ["libcosmic/desktop", "dep:xdg"] +desktop = ["libcosmic/desktop", "libcosmic/about", "dep:xdg"] gvfs = ["dep:gio", "dep:glib"] jemalloc = ["dep:tikv-jemallocator"] notify = ["dep:notify-rust"] diff --git a/build.rs b/build.rs deleted file mode 100644 index be102417..00000000 --- a/build.rs +++ /dev/null @@ -1,17 +0,0 @@ -fn main() -> Result<(), Box> { - // Rebuild if i18n files change - println!("cargo:rerun-if-changed=i18n"); - - // Emit version information (if not cached by just vendor) - let mut vergen = vergen::EmitBuilder::builder(); - println!("cargo:rerun-if-env-changed=VERGEN_GIT_COMMIT_DATE"); - if std::env::var_os("VERGEN_GIT_COMMIT_DATE").is_none() { - vergen.git_commit_date(); - } - println!("cargo:rerun-if-env-changed=VERGEN_GIT_SHA"); - if std::env::var_os("VERGEN_GIT_SHA").is_none() { - vergen.git_sha(false); - } - vergen.fail_on_error().emit()?; - Ok(()) -} diff --git a/i18n/en/cosmic_files.ftl b/i18n/en/cosmic_files.ftl index 7b6409b3..2d78327d 100644 --- a/i18n/en/cosmic_files.ftl +++ b/i18n/en/cosmic_files.ftl @@ -106,7 +106,8 @@ execute = Execute # Context Pages ## About -git-description = Git commit {$hash} on {$date} +repository = Repository +support = Support ## Add Network Drive add-network-drive = Add network drive diff --git a/src/app.rs b/src/app.rs index 9ec2b8d9..1a6fc2b9 100644 --- a/src/app.rs +++ b/src/app.rs @@ -32,6 +32,7 @@ use cosmic::{ dnd_destination::DragId, menu::{action::MenuAction, key_bind::KeyBind}, segmented_button::{self, Entity}, + about::About, }, Application, ApplicationExt, Element, }; @@ -503,6 +504,7 @@ impl PartialEq for WatcherWrapper { /// The [`App`] stores application-specific state. pub struct App { core: Core, + about: About, nav_bar_context_id: segmented_button::Entity, nav_model: segmented_button::SingleSelectModel, tab_model: segmented_button::Model, @@ -1075,38 +1077,6 @@ impl App { Task::none() } - fn about(&self) -> Element { - let cosmic_theme::Spacing { space_xxs, .. } = theme::active().cosmic().spacing; - let repository = "https://github.com/pop-os/cosmic-files"; - let hash = env!("VERGEN_GIT_SHA"); - let short_hash: String = hash.chars().take(7).collect(); - let date = env!("VERGEN_GIT_COMMIT_DATE"); - widget::column::with_children(vec![ - widget::svg(widget::svg::Handle::from_memory( - &include_bytes!( - "../res/icons/hicolor/128x128/apps/com.system76.CosmicFiles.svg" - )[..], - )) - .into(), - widget::text::title3(fl!("cosmic-files")).into(), - widget::button::link(repository) - .on_press(Message::LaunchUrl(repository.to_string())) - .padding(0) - .into(), - widget::button::link(fl!( - "git-description", - hash = short_hash.as_str(), - date = date - )) - .on_press(Message::LaunchUrl(format!("{}/commits/{}", repository, hash))) - .padding(0) - .into(), - ]) - .align_x(Alignment::Center) - .spacing(space_xxs) - .into() - } - fn network_drive(&self) -> Element { let cosmic_theme::Spacing { space_xxs, space_m, .. @@ -1429,8 +1399,21 @@ impl Application for App { let window_id_opt = core.main_window_id(); + let about = About::default() + .name(fl!("cosmic-files")) + .icon(Self::APP_ID) + .version(env!("CARGO_PKG_VERSION")) + .author("System76") + .license("GPL-3.0-only") + .developers([("Jeremy Soller", "jeremy@system76.com")]) + .links([ + (fl!("repository"), "https://github.com/pop-os/cosmic-files"), + (fl!("support"), "https://github.com/pop-os/cosmic-files/issues"), + ]); + let mut app = App { core, + about, nav_bar_context_id: segmented_button::Entity::null(), nav_model: segmented_button::ModelBuilder::default().build(), tab_model: segmented_button::ModelBuilder::default().build(), @@ -3308,7 +3291,7 @@ impl Application for App { } Some(match &self.context_page { - ContextPage::About => self.about(), + ContextPage::About => widget::about(&self.about, Message::LaunchUrl), ContextPage::EditHistory => self.edit_history(), ContextPage::NetworkDrive => self.network_drive(), ContextPage::Preview(entity_opt, kind) => self.preview(entity_opt, kind, true),