summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDavid Lönnhager <david.l@mullvad.net>2025-05-05 18:41:05 +0200
committerDavid Lönnhager <david.l@mullvad.net>2025-05-06 10:20:41 +0200
commit7942d8eca1794d005f852973c4746eca2f828659 (patch)
tree55b6974ef2d3238f37526b9f980a4dcf73c56d75
parent7909b095fc3db2068b53a9c744d66129b2b2df4a (diff)
downloadmullvadvpn-7942d8eca1794d005f852973c4746eca2f828659.tar.xz
mullvadvpn-7942d8eca1794d005f852973c4746eca2f828659.zip
Set window icon for installer-downloader
-rw-r--r--installer-downloader/CHANGELOG.md4
-rw-r--r--installer-downloader/Cargo.toml2
-rw-r--r--installer-downloader/src/winapi_impl/ui.rs10
3 files changed, 15 insertions, 1 deletions
diff --git a/installer-downloader/CHANGELOG.md b/installer-downloader/CHANGELOG.md
index 5749bffa2a..10211d4e0c 100644
--- a/installer-downloader/CHANGELOG.md
+++ b/installer-downloader/CHANGELOG.md
@@ -20,6 +20,10 @@ Line wrap the file at 100 chars. Th
* **Security**: in case of vulnerabilities.
## [Unreleased]
+### Added
+#### Windows
+- Add window icon.
+
### Changed
- Changed title to "Mullvad VPN loader".
diff --git a/installer-downloader/Cargo.toml b/installer-downloader/Cargo.toml
index bb99b592fb..01eac790fd 100644
--- a/installer-downloader/Cargo.toml
+++ b/installer-downloader/Cargo.toml
@@ -33,7 +33,7 @@ talpid-platform-metadata = { path = "../talpid-platform-metadata" }
mullvad-update = { path = "../mullvad-update", features = ["client"] }
[target.'cfg(target_os = "windows")'.dependencies]
-native-windows-gui = { version = "1.0.12", features = ["frame", "image-decoder", "progress-bar"], default-features = false }
+native-windows-gui = { version = "1.0.12", features = ["embed-resource", "frame", "image-decoder", "progress-bar"], default-features = false }
windows-sys = { workspace = true, features = ["Win32_UI", "Win32_UI_WindowsAndMessaging", "Win32_Graphics", "Win32_Graphics_Gdi"] }
mullvad-paths = { path = "../mullvad-paths" }
diff --git a/installer-downloader/src/winapi_impl/ui.rs b/installer-downloader/src/winapi_impl/ui.rs
index b9502d0036..79e91de915 100644
--- a/installer-downloader/src/winapi_impl/ui.rs
+++ b/installer-downloader/src/winapi_impl/ui.rs
@@ -48,6 +48,9 @@ pub const BETA_LINK_HANDLER_ID: usize = 0x10002;
pub struct AppWindow {
pub window: nwg::Window,
+ pub window_icon_res: nwg::EmbedResource,
+ pub window_icon: Option<nwg::Icon>,
+
pub banner: nwg::ImageFrame,
pub banner_text: nwg::Label,
@@ -142,10 +145,17 @@ impl AppWindow {
/// Set up UI elements, position them, and register window message handlers
/// Note that some additional setup happens in [Self::on_init]
pub fn layout(mut self) -> Result<Rc<RefCell<AppWindow>>, nwg::NwgError> {
+ nwg::EmbedResource::builder().build(&mut self.window_icon_res)?;
+
+ // Load icon embedded using the build script. This has a default id of 1.
+ // See `winres::WindowsResource::set_icon`.
+ self.window_icon = self.window_icon_res.icon(1, None);
+
nwg::Window::builder()
.size((WINDOW_WIDTH as i32, WINDOW_HEIGHT as i32))
.center(true)
.title(WINDOW_TITLE)
+ .icon(self.window_icon.as_ref())
.flags(WindowFlags::WINDOW)
.build(&mut self.window)?;