diff --git a/src/frontend/new_version.rs b/src/frontend/new_version.rs index d26e79a..a05c458 100644 --- a/src/frontend/new_version.rs +++ b/src/frontend/new_version.rs @@ -6,7 +6,7 @@ use reqwest::Client; use semver::Version; use serde::Deserialize; use std::time::Duration; -use tracing::{debug, error, warn}; +use tracing::{debug, warn}; /// Check new release every hour const NEW_VERSION_CHECK_INTERVAL: Duration = Duration::from_secs(3600); @@ -38,16 +38,21 @@ impl Component for NewVersion { view! { #[root] - // TODO: Use LinkButton once https://gitlab.gnome.org/GNOME/glib/-/issues/3403 is fixed - // for macOS - gtk::Button { + gtk::LinkButton { add_css_class: "suggested-action", - // TODO: Use LinkButton once https://gitlab.gnome.org/GNOME/glib/-/issues/3403 is fixed - // for macOS - connect_clicked => move |_| { + remove_css_class: "link", + set_has_frame: true, + #[track = "model.changed_new_version()"] + set_label: T + .new_version_available( + model.new_version.as_ref().map(Version::to_string).unwrap_or_default() + ) + .as_str(), + set_tooltip: &T.new_version_available_button_open(), + set_uri: &{ let repository = env!("CARGO_PKG_REPOSITORY"); - let link = if repository.starts_with("https://github.com") { + if repository.starts_with("https://github.com") { // Turn: // https://github.com/autonomys/space-acres // Into: @@ -55,37 +60,8 @@ impl Component for NewVersion { format!("{}/releases", env!("CARGO_PKG_REPOSITORY")) } else { repository.to_string() - }; - - if let Err(error) = open::that_detached(link) { - error!(%error, "Failed to open releases page in default browser"); } }, - remove_css_class: "flat", - remove_css_class: "link", - remove_css_class: "text-button", - #[track = "model.changed_new_version()"] - set_label: T - .new_version_available( - model.new_version.as_ref().map(Version::to_string).unwrap_or_default() - ) - .as_str(), - set_tooltip: &T.new_version_available_button_open(), - // TODO: Use LinkButton once https://gitlab.gnome.org/GNOME/glib/-/issues/3403 is fixed - // for macOS - // set_uri: &{ - // let repository = env!("CARGO_PKG_REPOSITORY"); - // - // if repository.starts_with("https://github.com") { - // // Turn: - // // https://github.com/autonomys/space-acres - // // Into: - // // https://github.com/autonomys/space-acres/releases - // format!("{}/releases", env!("CARGO_PKG_REPOSITORY")) - // } else { - // repository.to_string() - // } - // }, set_use_underline: false, #[track = "model.changed_new_version()"] set_visible: model.new_version.is_some(), diff --git a/src/frontend/running.rs b/src/frontend/running.rs index e47ce07..dbcdb6f 100644 --- a/src/frontend/running.rs +++ b/src/frontend/running.rs @@ -27,7 +27,7 @@ use subspace_farmer::farm::{ FarmingNotification, ProvingResult, SectorPlottingDetails, SectorUpdate, }; use subspace_runtime_primitives::{Balance, SSC}; -use tracing::{debug, error, warn}; +use tracing::{debug, warn}; #[derive(Debug)] pub struct RunningInit { @@ -51,9 +51,6 @@ pub enum RunningInput { FarmerNotification(FarmerNotification), ToggleFarmDetails, TogglePausePlotting, - // TODO: Use LinkButton once https://gitlab.gnome.org/GNOME/glib/-/issues/3403 is fixed - // for macOS - OpenRewardAddressInExplorer, } #[derive(Debug)] @@ -152,20 +149,12 @@ impl Component for RunningView { model.farmer_state.reward_eta_progress_circle.widget().clone(), }, - // TODO: Use LinkButton once https://gitlab.gnome.org/GNOME/glib/-/issues/3403 is fixed - // for macOS - gtk::Button { - // TODO: Use LinkButton once https://gitlab.gnome.org/GNOME/glib/-/issues/3403 is fixed - // for macOS - connect_clicked => RunningInput::OpenRewardAddressInExplorer, + gtk::LinkButton { remove_css_class: "link", set_cursor_from_name: Some("pointer"), - set_has_frame: false, set_tooltip: &T.running_farmer_account_balance_tooltip(), - // TODO: Use LinkButton once https://gitlab.gnome.org/GNOME/glib/-/issues/3403 is fixed - // for macOS - // #[watch] - // set_uri: &model.farmer_state.reward_address_url, + #[track = "model.farmer_state.changed_reward_address_url()"] + set_uri: &model.farmer_state.reward_address_url, set_use_underline: false, gtk::Label { @@ -504,11 +493,6 @@ impl RunningView { debug!("Failed to send RunningOutput::TogglePausePlotting"); } } - RunningInput::OpenRewardAddressInExplorer => { - if let Err(error) = open::that_detached(&self.farmer_state.reward_address_url) { - error!(%error, "Failed to open explorer in default browser"); - } - } } } diff --git a/src/frontend/running/node.rs b/src/frontend/running/node.rs index a468db0..d14c362 100644 --- a/src/frontend/running/node.rs +++ b/src/frontend/running/node.rs @@ -35,7 +35,6 @@ pub enum NodeInput { }, NodeNotification(NodeNotification), OpenNodeFolder, - OpenP2pPortsDocs, } #[derive(Debug)] @@ -125,10 +124,7 @@ impl Component for NodeView { }, }, - gtk::Button { - // TODO: Use LinkButton once https://gitlab.gnome.org/GNOME/glib/-/issues/3403 is fixed - // for macOS - connect_clicked => NodeInput::OpenP2pPortsDocs, + gtk::LinkButton { remove_css_class: "link", set_cursor_from_name: Some("pointer"), #[track = "model.changed_connected_peers()"] @@ -140,7 +136,6 @@ impl Component for NodeView { _ => "warning-label", }, ], - set_has_frame: false, #[track = "model.changed_connected_peers()"] set_tooltip: T .running_node_connections_tooltip( @@ -148,10 +143,7 @@ impl Component for NodeView { IN_PEERS + OUT_PEERS, ) .as_str(), - // TODO: Use LinkButton once https://gitlab.gnome.org/GNOME/glib/-/issues/3403 is fixed - // for macOS - // #[watch] - // set_uri: "https://docs.autonomys.xyz/farming/guides/port-config", + set_uri: "https://docs.autonomys.xyz/farming/guides/port-config", set_use_underline: false, gtk::Box { @@ -395,13 +387,6 @@ impl NodeView { error!(%error, path = %node_path.display(), "Failed to open node folder"); } } - NodeInput::OpenP2pPortsDocs => { - if let Err(error) = - open::that_detached("https://docs.autonomys.xyz/farming/guides/port-config") - { - error!(%error, "Failed to P2P ports docs"); - } - } } }